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

@entity-factory/core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entity-factory/core - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

6

adapters/object/ObjectAdapter.js

@@ -14,6 +14,7 @@ "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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -50,2 +51,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectAdapter = void 0;
var uuid = require("uuid/v4");

@@ -79,3 +81,3 @@ var utils_1 = require("../../utils");

var created;
if (utils_1.isFunction(type)) {
if ((0, utils_1.isFunction)(type)) {
created = new type();

@@ -82,0 +84,0 @@ }

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -17,2 +19,3 @@ function __() { this.constructor = d; }

Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectBlueprint = void 0;
var Blueprint_1 = require("../../blueprint/Blueprint");

@@ -19,0 +22,0 @@ var ObjectBlueprint = (function (_super) {

@@ -14,6 +14,7 @@ "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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -50,2 +51,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.Blueprint = void 0;
var utils_1 = require("../utils");

@@ -67,6 +69,6 @@ var Blueprint = (function () {

Blueprint.prototype.options = function (context) {
this.blueprintOptions = __assign({}, this.blueprintOptions, context);
this.blueprintOptions = __assign(__assign({}, this.blueprintOptions), context);
};
Blueprint.prototype.getOptions = function () {
var options = __assign({}, this.blueprintOptions, { __type: this.entityType });
var options = __assign(__assign({}, this.blueprintOptions), { __type: this.entityType });
return options;

@@ -81,3 +83,3 @@ };

var factoryMethod;
if (!utils_1.isFunction(factory)) {
if (!(0, utils_1.isFunction)(factory)) {
factoryMethod = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {

@@ -114,3 +116,3 @@ return [2, factory];

if (!method) {
throw new Error("Factory method not defined for entity " + utils_1.getName(this.getOptions().__type) + " " + (state ? 'with state ' + state : ''));
throw new Error("Factory method not defined for entity " + (0, utils_1.getName)(this.getOptions().__type) + " " + (state ? 'with state ' + state : ''));
}

@@ -117,0 +119,0 @@ return method;

@@ -14,6 +14,7 @@ "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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -50,2 +51,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.BlueprintBuilder = void 0;
var faker = require("faker");

@@ -73,3 +75,3 @@ var BlueprintBuilder = (function () {

BlueprintBuilder.prototype.with = function (partial) {
this.partial = __assign({}, this.partial, partial);
this.partial = __assign(__assign({}, this.partial), partial);
return this;

@@ -85,3 +87,3 @@ };

if (partial) {
this.partial = __assign({}, this.partial, partial);
this.partial = __assign(__assign({}, this.partial), partial);
}

@@ -187,3 +189,3 @@ objects = [];

factory = _a[_i];
_b = [{}, builtObject];
_b = [__assign({}, builtObject)];
return [4, this.resolveStateFactory(factory.stateFactory)];

@@ -209,3 +211,3 @@ case 2:

derived = _a.sent();
return [2, __assign({}, derived, this.partial)];
return [2, __assign(__assign({}, derived), this.partial)];
}

@@ -212,0 +214,0 @@ });

"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlueprintLoader = void 0;
var Blueprint_1 = require("./Blueprint");

@@ -9,3 +19,3 @@ var BlueprintLoader = (function () {

BlueprintLoader.prototype.getProfiles = function () {
return this.resolveClasses(this.fixtureProfiles).slice();
return __spreadArray([], this.resolveClasses(this.fixtureProfiles), true);
};

@@ -12,0 +22,0 @@ BlueprintLoader.prototype.resolveClasses = function (cls) {

"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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -38,2 +39,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.EntityFactory = void 0;
var faker = require("faker");

@@ -63,3 +65,3 @@ var ObjectAdapter_1 = require("./adapters/object/ObjectAdapter");

if (!blueprint) {
throw new Error("No blueprint exists for entity " + utils_1.getName(entity));
throw new Error("No blueprint exists for entity " + (0, utils_1.getName)(entity));
}

@@ -74,3 +76,3 @@ return new BlueprintBuilder_1.BlueprintBuilder(blueprint, this, this.adapter);

case 0:
if (utils_1.isFunction(count)) {
if ((0, utils_1.isFunction)(count)) {
factoryMethod = count;

@@ -111,3 +113,3 @@ count = 1;

}
else if (utils_1.isFunction(fixture)) {
else if ((0, utils_1.isFunction)(fixture)) {
profile = new Blueprint_1.Blueprint();

@@ -114,0 +116,0 @@ fixture(profile);

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./adapters/object/ObjectAdapter"));
__export(require("./adapters/object/ObjectBlueprint"));
__export(require("./blueprint/Blueprint"));
__export(require("./blueprint/BlueprintBuilder"));
__export(require("./blueprint/BlueprintLoader"));
__export(require("./EntityFactory"));
__exportStar(require("./adapters/Adapter"), exports);
__exportStar(require("./adapters/AdapterBlueprintOptions"), exports);
__exportStar(require("./adapters/object/ObjectAdapter"), exports);
__exportStar(require("./adapters/object/ObjectAdapterOptions"), exports);
__exportStar(require("./adapters/object/ObjectBlueprint"), exports);
__exportStar(require("./adapters/object/ObjectBlueprintOptions"), exports);
__exportStar(require("./blueprint/Blueprint"), exports);
__exportStar(require("./blueprint/BlueprintBuilder"), exports);
__exportStar(require("./blueprint/BlueprintDefinitionAfterMethod"), exports);
__exportStar(require("./blueprint/BlueprintDefinitionAfterMethodContext"), exports);
__exportStar(require("./blueprint/BlueprintDefinitionMethod"), exports);
__exportStar(require("./blueprint/BlueprintLoader"), exports);
__exportStar(require("./blueprint/BlueprintOptions"), exports);
__exportStar(require("./common/DeepEntityPartial"), exports);
__exportStar(require("./common/EntityObjectType"), exports);
__exportStar(require("./EntityFactory"), exports);
__exportStar(require("./EntityFactoryExecutor"), exports);
__exportStar(require("./EntityFactoryOptions"), exports);
__exportStar(require("./EntityFactoryRegisterCallback"), exports);
{
"name": "@entity-factory/core",
"version": "0.2.1",
"version": "0.2.2",
"description": "Create entities on the fly for mocking and testing",

@@ -14,8 +14,10 @@ "author": "Jeremy Cloutier",

"dependencies": {
"@types/faker": "^4.1.5",
"@types/uuid": "^3.4.4",
"faker": "^4.1.0",
"uuid": "^3.3.2"
"faker": "^5.5.3",
"uuid": "^8.3.2"
},
"gitHead": "f7bc2fc3c59e588824c0c408cbc5a16b96aa57d6",
"devDependencies": {
"@types/faker": "^5.5.9",
"@types/uuid": "^8.3.1"
},
"gitHead": "9206088ed6330cf16903b2015af451d910b3ac53",
"keywords": [

@@ -22,0 +24,0 @@ "test",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getName = function (entity) {
exports.isFunction = exports.getName = void 0;
var getName = function (entity) {
return typeof entity === 'string' ? entity : entity.name;
};
exports.isFunction = function (functionToCheck) {
exports.getName = getName;
var isFunction = function (functionToCheck) {
return (functionToCheck &&

@@ -11,1 +13,2 @@ ({}.toString.call(functionToCheck) === '[object Function]' ||

};
exports.isFunction = isFunction;
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