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

@applitools/nml-client

Package Overview
Dependencies
Maintainers
46
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/nml-client - npm Package Compare versions

Comparing version 1.5.13 to 1.5.14

33

CHANGELOG.md
# Changelog
## [1.5.14](https://github.com/applitools/eyes.sdk.javascript1/compare/js/nml-client@1.5.13...js/nml-client@1.5.14) (2023-10-17)
### 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/driver bumped to 1.14.4
#### 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/spec-driver-webdriver bumped to 1.0.48
## [1.5.13](https://github.com/applitools/eyes.sdk.javascript1/compare/js/nml-client@1.5.12...js/nml-client@1.5.13) (2023-09-29)

@@ -4,0 +37,0 @@

2

dist/client.js

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

takeSnapshots: (0, take_snapshots_1.makeTakeSnapshots)({ requests, logger }),
getSupportedRenderEnvironments: requests.getSupportedRenderEnvironments,
getSupportedEnvironments: requests.getSupportedEnvironments,
};
}
exports.makeNMLClient = makeNMLClient;

@@ -36,10 +36,10 @@ "use strict";

const req = (0, req_broker_1.makeReqBroker)({ settings, logger: mainLogger });
const getSupportedRenderEnvironmentsWithCache = utils.general.cachify(getSupportedRenderEnvironments, () => 'default');
const getSupportedEnvironmentsWithCache = utils.general.cachify(getSupportedEnvironments, () => 'default');
return {
getSupportedRenderEnvironments: getSupportedRenderEnvironmentsWithCache,
getSupportedEnvironments: getSupportedEnvironmentsWithCache,
takeScreenshots,
takeSnapshots,
};
async function getSupportedRenderEnvironments({ logger: _logger }) {
const response = await (0, req_1.default)(settings.renderEnvironmentsUrl);
async function getSupportedEnvironments({ logger: _logger }) {
const response = await (0, req_1.default)(settings.supportedEnvironmentsUrl);
const result = await response.json();

@@ -51,17 +51,17 @@ return result;

logger.log('Request "takeScreenshots" called with settings', settings);
const supportedRenderEnvironments = await getSupportedRenderEnvironmentsWithCache({ logger });
const { localEnvironment, renderEnvironments, rendererSettings } = settings.renderers.reduce((result, renderer) => {
const supportedEnvironments = await getSupportedEnvironmentsWithCache({ logger });
const { localEnvironment, renderEnvironments, environmentSettings } = settings.environments.reduce((result, environment) => {
var _a;
if (utils.types.has(renderer, 'environment')) {
result.localEnvironment = { ...renderer.environment, renderEnvironmentId: utils.general.guid(), renderer };
if (!utils.types.has(environment, 'iosDeviceInfo') && !utils.types.has(environment, 'androidDeviceInfo')) {
result.localEnvironment = { ...environment, environmentId: utils.general.guid() };
}
else {
const deviceInfo = utils.types.has(renderer, 'iosDeviceInfo')
? renderer.iosDeviceInfo
: renderer.androidDeviceInfo;
const deviceInfo = utils.types.has(environment, 'iosDeviceInfo')
? environment.iosDeviceInfo
: environment.androidDeviceInfo;
const orientation = deviceInfo.screenOrientation === 'landscape' ? 'landscapeLeft' : (_a = deviceInfo.screenOrientation) !== null && _a !== void 0 ? _a : 'portrait';
const rawEnvironment = supportedRenderEnvironments[deviceInfo.deviceName][orientation].env;
const rawEnvironment = supportedEnvironments[deviceInfo.deviceName][orientation].env;
result.renderEnvironments.push({
renderEnvironmentId: utils.general.guid(),
renderer,
requested: environment,
environmentId: utils.general.guid(),
deviceName: rawEnvironment.deviceInfo,

@@ -71,3 +71,3 @@ os: rawEnvironment.os + (deviceInfo.version ? ` ${deviceInfo.version}` : ''),

});
result.rendererSettings.push({ ...supportedRenderEnvironments[deviceInfo.deviceName], orientation });
result.environmentSettings.push({ ...supportedEnvironments[deviceInfo.deviceName], orientation });
}

@@ -78,3 +78,3 @@ return result;

renderEnvironments: [],
rendererSettings: [],
environmentSettings: [],
});

@@ -90,4 +90,4 @@ try {

...settings,
renderers: undefined,
deviceList: !localEnvironment ? rendererSettings : undefined,
environments: undefined,
deviceList: !localEnvironment ? environmentSettings : undefined,
},

@@ -100,5 +100,5 @@ },

const screenshots = localEnvironment
? [{ image: result.payload.result.screenshotUrl, renderEnvironment: localEnvironment }]
: renderEnvironments.map((renderEnvironment, index) => {
return { image: result.payload[index].result.screenshotUrl, renderEnvironment };
? [{ image: result.payload.result.screenshotUrl, environment: localEnvironment }]
: renderEnvironments.map((environment, index) => {
return { image: result.payload[index].result.screenshotUrl, environment };
});

@@ -143,3 +143,3 @@ logger.log('Request "takeScreenshots" finished successfully with body', screenshots);

}
return Array(settings.renderers.length).fill(snapshot);
return Array(settings.environments.length).fill(snapshot);
}

@@ -146,0 +146,0 @@ catch (error) {

{
"name": "@applitools/nml-client",
"version": "1.5.13",
"version": "1.5.14",
"description": "Client to integrate the SDKs to the Native Mobile Library (NML)",

@@ -39,8 +39,8 @@ "homepage": "https://applitools.com",

"dependencies": {
"@applitools/logger": "2.0.11",
"@applitools/req": "1.6.1",
"@applitools/utils": "1.6.1"
"@applitools/logger": "2.0.12",
"@applitools/req": "1.6.2",
"@applitools/utils": "1.6.2"
},
"devDependencies": {
"@applitools/spec-driver-webdriver": "^1.0.47",
"@applitools/spec-driver-webdriver": "^1.0.48",
"@applitools/test-server": "^1.2.2",

@@ -47,0 +47,0 @@ "@applitools/test-utils": "^1.5.17",

import type { BrokerServerSettings, ScreenshotSettings, Screenshot, SnapshotSettings, IOSSnapshot, AndroidSnapshot } from '../types';
import { type Logger } from '@applitools/logger';
export interface NMLRequests {
getSupportedRenderEnvironments(options: {
getSupportedEnvironments(options: {
logger?: Logger;

@@ -6,0 +6,0 @@ }): Promise<Record<string, any>>;

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

}): Promise<TSnapshot[]>;
getSupportedRenderEnvironments(options: {
getSupportedEnvironments(options: {
logger?: Logger;

@@ -20,3 +20,3 @@ }): Promise<Record<string, any>>;

brokerUrl: string;
renderEnvironmentsUrl: string;
supportedEnvironmentsUrl: string;
agentId?: string;

@@ -27,3 +27,3 @@ proxy?: Proxy;

export type NMLClientSettings = BrokerServerSettings;
export interface IOSDeviceRenderer {
export interface IOSDeviceEnvironment {
iosDeviceInfo: {

@@ -35,3 +35,3 @@ deviceName: string;

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

@@ -43,12 +43,14 @@ deviceName: string;

}
export interface EnvironmentRenderer {
environment: any;
export interface LocalEnvironment {
os: string;
deviceName: string;
viewportSize: Size;
}
export type Renderer = IOSDeviceRenderer | AndroidDeviceRenderer | EnvironmentRenderer;
export interface RenderEnvironment {
export type Environment = IOSDeviceEnvironment | AndroidDeviceEnvironment | LocalEnvironment;
export interface ActualEnvironment {
requested?: IOSDeviceEnvironment | AndroidDeviceEnvironment;
environmentId: string;
os: string;
deviceName: string;
viewportSize: Size;
renderEnvironmentId: string;
renderer: Renderer;
}

@@ -62,3 +64,3 @@ export type Selector = string | {

export type ScreenshotSettings = {
renderers: Renderer[];
environments: Environment[];
webview?: boolean | string;

@@ -95,6 +97,6 @@ region?: Region | Selector;

calculatedRegions?: Region[];
renderEnvironment: RenderEnvironment;
environment: ActualEnvironment;
};
export type SnapshotSettings = {
renderers: Renderer[];
environments: Environment[];
resourceSeparation?: boolean;

@@ -101,0 +103,0 @@ waitBeforeCapture?: number;

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