Comparing version 0.0.4-alpha-12 to 0.0.4-alpha-13
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Session = exports.Log = exports.Input = exports.BrowsingContext = exports.Browser = exports.BiDi = void 0; | ||
exports.Storage = exports.Session = exports.Log = exports.Input = exports.BrowsingContext = exports.Browser = exports.BiDi = void 0; | ||
const ws_1 = __importDefault(require("ws")); | ||
@@ -29,2 +29,4 @@ const node_timers_1 = require("node:timers"); | ||
exports.Input = commands_5.default; | ||
const commands_6 = __importDefault(require("./modules/storage/commands")); | ||
exports.Storage = commands_6.default; | ||
const RESPONSE_TIMEOUT = 60 * 1000; | ||
@@ -31,0 +33,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* This class provides methods that allow the manipulation of cookies | ||
*/ | ||
class Storage { | ||
/** | ||
* Initializes a new instance of Storage | ||
* @param {BiDi} BidiConnection - A bidirectional connection object | ||
*/ | ||
constructor(BidiConnection) { | ||
this._ws = BidiConnection; | ||
} | ||
/** | ||
* Gets cookies from the storage | ||
* @param {StorageGetCookiesParameters} params - Parameters required to get the cookies | ||
* @return {Promise<StorageGetCookiesResult>} A promise that resolves to the result of getting the cookies | ||
*/ | ||
getCookies(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const parameters = { | ||
method: "storage.getCookies", | ||
params: params | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(parameters) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
} | ||
/** | ||
* Sets a cookie in the storage | ||
* @param {StorageSetCookieParameters} params - Parameters required to set the cookie | ||
* @return {Promise<StorageSetCookieResult>}A promise that resolves to the result of setting the cookie | ||
*/ | ||
setCookie(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const parameters = { | ||
method: 'storage.setCookie', | ||
params: params | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(parameters) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
} | ||
/** | ||
* Deletes cookies from the storage | ||
* @param {StorageDeleteCookiesParameters} params - Parameters required to delete the cookies | ||
* @return {Promise<DeleteCookiesResult>} A promise that resolves to the result of deleting the cookies | ||
*/ | ||
deleteCookies(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const parameters = { | ||
method: 'storage.deleteCookies', | ||
params: params | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(parameters) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
} | ||
} | ||
exports.default = Storage; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -17,2 +17,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import Input from './modules/input/commands'; | ||
import Storage from './modules/storage/commands'; | ||
const RESPONSE_TIMEOUT = 60 * 1000; | ||
@@ -133,2 +134,2 @@ /** | ||
} | ||
export { BiDi, Browser, BrowsingContext, Input, Log, Session, }; | ||
export { BiDi, Browser, BrowsingContext, Input, Log, Session, Storage }; |
@@ -1,1 +0,1 @@ | ||
"use strict"; | ||
export {}; |
@@ -1,1 +0,75 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
/** | ||
* This class provides methods that allow the manipulation of cookies | ||
*/ | ||
export default class Storage { | ||
/** | ||
* Initializes a new instance of Storage | ||
* @param {BiDi} BidiConnection - A bidirectional connection object | ||
*/ | ||
constructor(BidiConnection) { | ||
this._ws = BidiConnection; | ||
} | ||
/** | ||
* Gets cookies from the storage | ||
* @param {StorageGetCookiesParameters} params - Parameters required to get the cookies | ||
* @return {Promise<StorageGetCookiesResult>} A promise that resolves to the result of getting the cookies | ||
*/ | ||
getCookies(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const parameters = { | ||
method: "storage.getCookies", | ||
params: params | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(parameters) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
} | ||
/** | ||
* Sets a cookie in the storage | ||
* @param {StorageSetCookieParameters} params - Parameters required to set the cookie | ||
* @return {Promise<StorageSetCookieResult>}A promise that resolves to the result of setting the cookie | ||
*/ | ||
setCookie(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const parameters = { | ||
method: 'storage.setCookie', | ||
params: params | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(parameters) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
} | ||
/** | ||
* Deletes cookies from the storage | ||
* @param {StorageDeleteCookiesParameters} params - Parameters required to delete the cookies | ||
* @return {Promise<DeleteCookiesResult>} A promise that resolves to the result of deleting the cookies | ||
*/ | ||
deleteCookies(params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const parameters = { | ||
method: 'storage.deleteCookies', | ||
params: params | ||
}; | ||
return new Promise((resolve, reject) => { | ||
this._ws.sendCommand(parameters) | ||
.then(response => resolve(response)) | ||
.catch(error => reject(error)); | ||
}); | ||
}); | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict"; | ||
export {}; |
@@ -7,2 +7,3 @@ import WebSocket from 'ws'; | ||
import Input from './modules/input/commands'; | ||
import Storage from './modules/storage/commands'; | ||
/** | ||
@@ -47,2 +48,2 @@ * BiDi class for handling WebSocket connections | ||
} | ||
export { BiDi, Browser, BrowsingContext, Input, Log, Session, }; | ||
export { BiDi, Browser, BrowsingContext, Input, Log, Session, Storage }; |
{ | ||
"name": "wd-bidi", | ||
"version": "0.0.4-alpha-12", | ||
"version": "0.0.4-alpha-13", | ||
"description": "WebDriver BiDi API for automation testing", | ||
@@ -5,0 +5,0 @@ "main": "./build/cjs/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
139727
3268
0
96