UNPKG

@gatling.io/core

Version:

Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).

56 lines (55 loc) 3.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.underlyingJvmXToXWithBiSessionToSession = exports.underlyingJvmXToXWithSessionToSession = exports.underlyingXWithSessionToSession = exports.underlyingXWithSessionTo = exports.underlyingSessionToDuration = exports.underlyingSessionToJava = exports.isSessionTo = exports.underlyingSessionTo = exports.underlyingBiSessionTransform = exports.underlyingSessionTransform = exports.wrapSession = void 0; const byteArrays_1 = require("./gatlingJvm/byteArrays"); const collections_1 = require("./gatlingJvm/collections"); const duration_1 = require("./utils/duration"); const wrapSession = (_underlying) => ({ _underlying, get: (key) => _underlying.get(key), // FIXME won't work on feeders set: (key, value) => { return (0, exports.wrapSession)(_underlying.set(key, (0, collections_1.asJava)(value))); }, // FIXME ??? setByteArray: (key, value) => (0, exports.wrapSession)(_underlying.set(key, (0, byteArrays_1.asByteArray)(value))), setAll: (newAttributes) => { let session = _underlying; for (const key in newAttributes) { session = session.set(key, (0, collections_1.asJava)(newAttributes[key])); } return (0, exports.wrapSession)(session); }, remove: (key) => (0, exports.wrapSession)(_underlying.remove(key)), reset: () => (0, exports.wrapSession)(_underlying.reset()), removeAll: (...keys) => (0, exports.wrapSession)(_underlying.removeAll(...keys)), contains: (key) => _underlying.contains(key), isFailed: () => _underlying.isFailed(), markAsSucceeded: () => (0, exports.wrapSession)(_underlying.markAsSucceeded()), markAsFailed: () => (0, exports.wrapSession)(_underlying.markAsFailed()), scenario: () => _underlying.scenario(), groups: () => _underlying.groups(), userId: () => _underlying.userId(), toString: () => _underlying.toString() }); exports.wrapSession = wrapSession; const underlyingSessionTransform = (f) => (jvmSession) => f((0, exports.wrapSession)(jvmSession))._underlying; exports.underlyingSessionTransform = underlyingSessionTransform; const underlyingBiSessionTransform = (f) => (jvmMain, jvmForked) => f((0, exports.wrapSession)(jvmMain), (0, exports.wrapSession)(jvmForked))._underlying; exports.underlyingBiSessionTransform = underlyingBiSessionTransform; const underlyingSessionTo = (f) => (jvmSession) => f((0, exports.wrapSession)(jvmSession)); exports.underlyingSessionTo = underlyingSessionTo; const isSessionTo = (value) => typeof value === "function"; exports.isSessionTo = isSessionTo; const underlyingSessionToJava = (f) => (jvmSession) => (0, collections_1.asJava)(f((0, exports.wrapSession)(jvmSession))); exports.underlyingSessionToJava = underlyingSessionToJava; const underlyingSessionToDuration = (f) => (jvmSession) => (0, duration_1.toJvmDuration)(f((0, exports.wrapSession)(jvmSession))); exports.underlyingSessionToDuration = underlyingSessionToDuration; const underlyingXWithSessionTo = (f) => (x, jvmSession) => f(x, (0, exports.wrapSession)(jvmSession)); exports.underlyingXWithSessionTo = underlyingXWithSessionTo; const underlyingXWithSessionToSession = (f) => (x, jvmSession) => f(x, (0, exports.wrapSession)(jvmSession))._underlying; exports.underlyingXWithSessionToSession = underlyingXWithSessionToSession; const underlyingJvmXToXWithSessionToSession = (f, wrap) => (jvmXs, jvmSession) => f(wrap(jvmXs), (0, exports.wrapSession)(jvmSession))._underlying; exports.underlyingJvmXToXWithSessionToSession = underlyingJvmXToXWithSessionToSession; const underlyingJvmXToXWithBiSessionToSession = (f, wrap) => (jvmXs, jvmMain, jvmForked) => f(wrap(jvmXs), (0, exports.wrapSession)(jvmMain), (0, exports.wrapSession)(jvmForked))._underlying; exports.underlyingJvmXToXWithBiSessionToSession = underlyingJvmXToXWithBiSessionToSession;