Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createReplicator (transforms) {
// NOTE: we will serialize replicator results
// to JSON with a command or command result.
// Therefore there is no need to do additional job here,
// so we use identity functions for serialization.
const replicator = new Replicator({
serialize: identity,
deserialize: identity
});
return replicator.addTransforms(transforms);
}
import Replicator from 'replicator';
import evalFunction from './eval-function';
var identityFn = val => val;
// NOTE: we will serialize replicator results
// to JSON with a command or command result.
// Therefore there is no need to do additional job here,
// so we use identity functions for serialization.
var replicator = new Replicator({
serialize: identityFn,
deserialize: identityFn
});
export default replicator.addTransforms([
{
type: 'Function',
shouldTransform () {
return false;
},
fromSerializable: evalFunction
}
]);
import { compileHybridFunction, compileFunctionArgumentOfHybridFunction } from '../../../compiler/es-next/hybrid-function';
import { ExecuteHybridFunctionCommand } from '../../../test-run/commands';
import { APIError } from '../../../errors/runtime';
import MESSAGE from '../../../errors/runtime/message';
import getCallsite from '../../../errors/get-callsite';
const DEFAULT_CALLSITE_NAMES = {
instantiation: 'Hybrid',
execution: '__$$hybridFunction$$'
};
// NOTE: we will serialize replicator results
// to JSON with a command or command result.
// Therefore there is no need to do additional job here,
// so we use identity functions for serialization.
var replicator = new Replicator({
serialize: identity,
deserialize: identity
});
replicator.addTransforms([
{
type: 'Function',
shouldTransform (type) {
return type === 'function';
},
toSerializable (fn) {
var isHybrid = !!fn[compiledCode];
if (isHybrid)
import hammerhead from '../../deps/hammerhead';
import DriverStatus from '../../status';
import Replicator from 'replicator';
import evalFunction from './eval-function';
import { UncaughtErrorInClientExecutedCode } from '../../../../errors/test-run';
const HYBRID_COMPILED_CODE = '[[hybridCompiledCode]]';
var Promise = hammerhead.Promise;
var identityFn = val => val;
// NOTE: we will serialize replicator results
// to JSON with a command or command result.
// Therefore there is no need to do additional job here,
// so we use identity functions for serialization.
var replicator = new Replicator({
serialize: identityFn,
deserialize: identityFn
});
replicator.addTransforms([
{
type: 'Function',
shouldTransform (type) {
return type === 'function';
},
toSerializable (fn) {
return {
isHybridCode: !!fn[HYBRID_COMPILED_CODE],
fnCode: fn[HYBRID_COMPILED_CODE] || fn.toString()
export function createReplicator (transforms) {
// NOTE: we will serialize replicator results
// to JSON with a command or command result.
// Therefore there is no need to do additional job here,
// so we use identity functions for serialization.
const replicator = new Replicator({
serialize: identity,
deserialize: identity
});
return replicator.addTransforms(transforms);
}
function getReplicator() {
if (!replicator) {
replicator = new Replicator()
replicator.addTransforms(transforms)
}
return replicator
}
export function encode(value: any): string {
function getReplicatorWithPromises() {
if (!replicatorWithPromises) {
replicatorWithPromises = new Replicator()
replicatorWithPromises.addTransforms(
(transforms as any).concat(promiseTransform),
)
}
return replicatorWithPromises
}