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

@thisisagile/easy

Package Overview
Dependencies
Maintainers
2
Versions
1266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thisisagile/easy - npm Package Compare versions

Comparing version 1.8.6 to 1.8.7

20

dist/data/Gateway.d.ts

@@ -1,15 +0,11 @@

import { Id, Json, JsonValue } from "../types";
import { Query } from "./Query";
import { Id, Json, JsonValue } from '../types';
import { List } from '../types/List';
export interface Gateway {
all(): Promise<List<Json>>;
by(key: string, value: JsonValue): Promise<List<Json>>;
byId(id: Id): Promise<Json>;
find(query: Query): Promise<List<Json>>;
search(q: JsonValue): Promise<List<Json>>;
exists(id: Id): Promise<boolean>;
add(item: Json): Promise<Json>;
update(item: Json): Promise<Json>;
remove(id: Id): Promise<boolean>;
count(query?: Query): Promise<number>;
all: () => Promise<List<Json>>;
byId: (id: Id) => Promise<Json>;
search: (q: JsonValue) => Promise<List<Json>>;
exists: (id: Id) => Promise<boolean>;
add: (item: Json) => Promise<Json>;
update: (item: Json) => Promise<Json>;
remove: (id: Id) => Promise<boolean>;
}

3

dist/data/Query.js

@@ -12,3 +12,4 @@ "use strict";

exports.Query = Query;
exports.where = (key, value) => new Query(key, value);
const where = (key, value) => new Query(key, value);
exports.where = where;
//# sourceMappingURL=Query.js.map

@@ -26,3 +26,4 @@ "use strict";

exports.Entity = Entity;
exports.isEntity = (e) => e instanceof Entity;
const isEntity = (e) => e instanceof Entity;
exports.isEntity = isEntity;
//# sourceMappingURL=Entity.js.map

@@ -24,4 +24,5 @@ "use strict";

};
exports.isRestResult = (r) => types_1.isDefined(r) && (types_1.isDefined(r.data) || types_1.isDefined(r.error));
exports.toRestResult = (payload) => {
const isRestResult = (r) => types_1.isDefined(r) && (types_1.isDefined(r.data) || types_1.isDefined(r.error));
exports.isRestResult = isRestResult;
const toRestResult = (payload) => {
return utils_1.choose(payload)

@@ -33,2 +34,3 @@ .case(p => !p, () => data())

};
exports.toRestResult = toRestResult;
//# sourceMappingURL=RestResult.js.map

@@ -5,3 +5,4 @@ "use strict";

const types_1 = require("../types");
exports.route = (uri) => (subject) => { types_1.meta(subject).set('route', uri); };
const route = (uri) => (subject) => { types_1.meta(subject).set('route', uri); };
exports.route = route;
class Router {

@@ -17,3 +18,4 @@ constructor(resource) {

}
exports.router = (resource) => new Router(resource);
const router = (resource) => new Router(resource);
exports.router = router;
//# sourceMappingURL=Route.js.map

@@ -8,7 +8,12 @@ "use strict";

const verb = (v) => (subject, property) => { types_1.meta(subject).property(property).set('verb', v); };
exports.get = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.NotFound) => verb({ verb: HttpVerb_1.HttpVerb.Get, onOk, onError });
exports.put = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Put, onOk, onError });
exports.patch = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Patch, onOk, onError });
exports.post = (onOk = HttpStatus_1.HttpStatus.Created, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Post, onOk, onError });
exports.del = (onOk = HttpStatus_1.HttpStatus.NoContent, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Delete, onOk, onError });
const get = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.NotFound) => verb({ verb: HttpVerb_1.HttpVerb.Get, onOk, onError });
exports.get = get;
const put = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Put, onOk, onError });
exports.put = put;
const patch = (onOk = HttpStatus_1.HttpStatus.Ok, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Patch, onOk, onError });
exports.patch = patch;
const post = (onOk = HttpStatus_1.HttpStatus.Created, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Post, onOk, onError });
exports.post = post;
const del = (onOk = HttpStatus_1.HttpStatus.NoContent, onError = HttpStatus_1.HttpStatus.BadRequest) => verb({ verb: HttpVerb_1.HttpVerb.Delete, onOk, onError });
exports.del = del;
//# sourceMappingURL=Verb.js.map

@@ -5,3 +5,4 @@ "use strict";

const Is_1 = require("./Is");
exports.toArray = (...items) => (items.length > 1) ? items : Is_1.isArray(items[0]) ? items[0] : Is_1.isDefined(items[0]) ? [items[0]] : [];
const toArray = (...items) => (items.length > 1) ? items : Is_1.isArray(items[0]) ? items[0] : Is_1.isDefined(items[0]) ? [items[0]] : [];
exports.toArray = toArray;
//# sourceMappingURL=Array.js.map

@@ -5,4 +5,6 @@ "use strict";

const Is_1 = require("./Is");
exports.ofGet = (g, ...params) => Is_1.isFunction(g) ? g(...params) : g;
exports.ofProperty = (t, p) => Is_1.isFunction(p) ? p(t) : t[p];
const ofGet = (g, ...params) => Is_1.isFunction(g) ? g(...params) : g;
exports.ofGet = ofGet;
const ofProperty = (t, p) => Is_1.isFunction(p) ? p(t) : t[p];
exports.ofProperty = ofProperty;
//# sourceMappingURL=Constructor.js.map

@@ -23,3 +23,4 @@ "use strict";

exports.Enum = Enum;
exports.isEnum = (e) => Is_1.isDefined(e) && (e instanceof Enum) && IsA_1.isAn(e, 'name', 'id', 'code');
const isEnum = (e) => Is_1.isDefined(e) && (e instanceof Enum) && IsA_1.isAn(e, 'name', 'id', 'code');
exports.isEnum = isEnum;
//# sourceMappingURL=Enum.js.map

@@ -5,3 +5,4 @@ "use strict";

const uuid_1 = require("uuid");
exports.newId = () => uuid_1.v4();
const newId = () => uuid_1.v4();
exports.newId = newId;
//# sourceMappingURL=Id.js.map

@@ -7,3 +7,3 @@ import { Constructor } from './Constructor';

export declare const isObject: (o?: unknown) => o is Object;
export declare const isNotEmptyObject: (o?: unknown) => boolean;
export declare const isEmptyObject: (o?: unknown) => boolean;
export declare const isFunction: (o?: unknown) => o is (...params: unknown[]) => unknown;

@@ -10,0 +10,0 @@ export declare const isArray: <T = any>(o?: unknown) => o is T[];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPrimitive = exports.isIn = exports.isInstance = exports.isArray = exports.isFunction = exports.isNotEmptyObject = exports.isObject = exports.isString = exports.isNotEmpty = exports.isEmpty = exports.isDefined = void 0;
exports.isDefined = (o) => o !== undefined && o !== null;
exports.isEmpty = (o) => o === '' || o === null || o === undefined;
exports.isNotEmpty = (o) => o !== '' && o !== null && o !== undefined;
exports.isString = (o) => o instanceof String || typeof o === 'string';
exports.isObject = (o) => o != null && (typeof o === 'object' || typeof o === 'function') && !exports.isArray(o);
exports.isNotEmptyObject = (o) => exports.isObject(o) && Object.getOwnPropertyNames(o).length > 0;
exports.isFunction = (o) => exports.isDefined(o) && typeof o === 'function';
exports.isArray = (o) => exports.isDefined(o) && o instanceof Array;
exports.isInstance = (ctor, o) => exports.isFunction(ctor) && o instanceof ctor;
exports.isIn = (o, values) => exports.isArray(values) && values.some(v => v === o);
exports.isPrimitive = (o) => (o !== null) && !exports.isObject(o) && !exports.isFunction(o) && !exports.isArray(o);
exports.isPrimitive = exports.isIn = exports.isInstance = exports.isArray = exports.isFunction = exports.isEmptyObject = exports.isObject = exports.isString = exports.isNotEmpty = exports.isEmpty = exports.isDefined = void 0;
const isDefined = (o) => o !== undefined && o !== null;
exports.isDefined = isDefined;
const isEmpty = (o) => o === '' || o === null || o === undefined;
exports.isEmpty = isEmpty;
const isNotEmpty = (o) => o !== '' && o !== null && o !== undefined;
exports.isNotEmpty = isNotEmpty;
const isString = (o) => o instanceof String || typeof o === 'string';
exports.isString = isString;
const isObject = (o) => o != null && (typeof o === 'object' || typeof o === 'function') && !exports.isArray(o);
exports.isObject = isObject;
const isEmptyObject = (o) => exports.isObject(o) && Object.getOwnPropertyNames(o).length === 0;
exports.isEmptyObject = isEmptyObject;
const isFunction = (o) => exports.isDefined(o) && typeof o === 'function';
exports.isFunction = isFunction;
const isArray = (o) => exports.isDefined(o) && o instanceof Array;
exports.isArray = isArray;
const isInstance = (ctor, o) => exports.isFunction(ctor) && o instanceof ctor;
exports.isInstance = isInstance;
const isIn = (o, values) => exports.isArray(values) && values.some(v => v === o);
exports.isIn = isIn;
const isPrimitive = (o) => (o !== null) && !exports.isObject(o) && !exports.isFunction(o) && !exports.isArray(o);
exports.isPrimitive = isPrimitive;
//# sourceMappingURL=Is.js.map

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

const Is_1 = require("./Is");
exports.isA = (t, ...properties) => Is_1.isDefined(t) && properties.every(p => Is_1.isDefined(t[p]));
const isA = (t, ...properties) => Is_1.isDefined(t) && properties.every(p => Is_1.isDefined(t[p]));
exports.isA = isA;
exports.isAn = exports.isA;
exports.isError = (e) => exports.isAn(e, "name", "message");
const isError = (e) => exports.isAn(e, "name", "message");
exports.isError = isError;
//# sourceMappingURL=IsA.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonify = void 0;
exports.jsonify = (subject = {}, additional) => ({ ...(JSON.parse(JSON.stringify(subject))), ...additional });
const jsonify = (subject = {}, additional) => ({ ...(JSON.parse(JSON.stringify(subject))), ...additional });
exports.jsonify = jsonify;
//# sourceMappingURL=Json.js.map

@@ -25,5 +25,8 @@ "use strict";

exports.List = List;
exports.list = (...items) => new List(...Array_1.toArray(...items));
exports.toList = (...items) => (items.length > 1) ? exports.list(...items) : exports.list(items[0]);
exports.isList = (l) => Is_1.isDefined(l) && Is_1.isArray(l) && IsA_1.isA(l, 'first', 'last', 'asc', 'desc');
const list = (...items) => new List(...Array_1.toArray(...items));
exports.list = list;
const toList = (...items) => (items.length > 1) ? exports.list(...items) : exports.list(items[0]);
exports.toList = toList;
const isList = (l) => Is_1.isDefined(l) && Is_1.isArray(l) && IsA_1.isA(l, 'first', 'last', 'asc', 'desc');
exports.isList = isList;
//# sourceMappingURL=List.js.map

@@ -39,3 +39,4 @@ "use strict";

}
exports.meta = (subject) => new ClassMeta(subject !== null && subject !== void 0 ? subject : {});
const meta = (subject) => new ClassMeta(subject !== null && subject !== void 0 ? subject : {});
exports.meta = meta;
//# sourceMappingURL=Meta.js.map

@@ -5,4 +5,6 @@ "use strict";

const IsA_1 = require("./IsA");
exports.result = (message, domain, location) => ({ message, domain, location });
exports.isResult = (r) => IsA_1.isA(r, "message");
const result = (message, domain = "easy", location) => ({ message, domain, location });
exports.result = result;
const isResult = (r) => IsA_1.isA(r, "message");
exports.isResult = isResult;
//# sourceMappingURL=Result.js.map

@@ -15,3 +15,4 @@ "use strict";

exports.Results = Results;
exports.results = (...r) => new Results(...r);
const results = (...r) => new Results(...r);
exports.results = results;
//# sourceMappingURL=Results.js.map

@@ -5,3 +5,4 @@ "use strict";

const IsA_1 = require("./IsA");
exports.isText = (t) => IsA_1.isA(t, "toString");
const isText = (t) => IsA_1.isA(t, "toString");
exports.isText = isText;
//# sourceMappingURL=Text.js.map

@@ -5,3 +5,4 @@ "use strict";

const IsA_1 = require("./IsA");
exports.isValidatable = (v) => IsA_1.isA(v, "isValid");
const isValidatable = (v) => IsA_1.isA(v, "isValid");
exports.isValidatable = isValidatable;
//# sourceMappingURL=Validatable.js.map

@@ -25,3 +25,4 @@ "use strict";

exports.Found = Found;
exports.choose = (value) => new Case(value);
const choose = (value) => new Case(value);
exports.choose = choose;
//# sourceMappingURL=Case.js.map

@@ -5,4 +5,6 @@ "use strict";

const types_1 = require("../types");
exports.resolve = (subject) => Promise.resolve(subject);
exports.reject = (e) => Promise.reject(types_1.isError(e) ? e : types_1.isText(e) ? types_1.results(e) : e);
const resolve = (subject) => Promise.resolve(subject);
exports.resolve = resolve;
const reject = (e) => Promise.reject(types_1.isError(e) ? e : types_1.isText(e) ? types_1.results(e) : e);
exports.reject = reject;
//# sourceMappingURL=Promise.js.map

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

const types_1 = require("../types");
exports.constraint = (c, message) => (subject, property) => {
const constraint = (c, message) => (subject, property) => {
types_1.meta(subject).property(property).set('constraint', { property, constraint: c, message });
};
exports.defined = (message) => exports.constraint(v => types_1.isDefined(v), message !== null && message !== void 0 ? message : '$property must be defined.');
exports.required = (message) => exports.constraint(v => types_1.isDefined(v), message !== null && message !== void 0 ? message : '$property is required.');
exports.valid = (message) => exports.constraint(v => types_1.isValidatable(v) && v.isValid, message !== null && message !== void 0 ? message : '$property must be valid.');
exports.includes = (sub, message) => exports.constraint(s => types_1.isDefined(s) && types_1.isString(s) && s.includes(sub), message !== null && message !== void 0 ? message : `$value must include '${sub}'.`);
exports.inList = (values, message) => exports.constraint(v => types_1.isDefined(v) && types_1.isIn(v, values), message !== null && message !== void 0 ? message : '$value must appear in list.');
exports.gt = (limit, message) => exports.constraint(v => v > limit, message !== null && message !== void 0 ? message : 'Value for $property must be larger than $actual.');
exports.gte = (limit, message) => exports.constraint(v => v >= limit, message !== null && message !== void 0 ? message : 'Value for $property must be larger than or equal to $actual.');
exports.lt = (limit, message) => exports.constraint(v => v < limit, message !== null && message !== void 0 ? message : 'Value for $property must be smaller than $actual.');
exports.lte = (limit, message) => exports.constraint(v => v <= limit, message !== null && message !== void 0 ? message : 'Value for $property must be smaller than or equal to $actual.');
exports.constraint = constraint;
const defined = (message) => exports.constraint(v => types_1.isDefined(v), message !== null && message !== void 0 ? message : '$property must be defined.');
exports.defined = defined;
const required = (message) => exports.constraint(v => types_1.isDefined(v), message !== null && message !== void 0 ? message : '$property is required.');
exports.required = required;
const valid = (message) => exports.constraint(v => types_1.isValidatable(v) && v.isValid, message !== null && message !== void 0 ? message : '$property must be valid.');
exports.valid = valid;
const includes = (sub, message) => exports.constraint(s => types_1.isDefined(s) && types_1.isString(s) && s.includes(sub), message !== null && message !== void 0 ? message : `$value must include '${sub}'.`);
exports.includes = includes;
const inList = (values, message) => exports.constraint(v => types_1.isDefined(v) && types_1.isIn(v, values), message !== null && message !== void 0 ? message : '$value must appear in list.');
exports.inList = inList;
const gt = (limit, message) => exports.constraint(v => v > limit, message !== null && message !== void 0 ? message : 'Value for $property must be larger than $actual.');
exports.gt = gt;
const gte = (limit, message) => exports.constraint(v => v >= limit, message !== null && message !== void 0 ? message : 'Value for $property must be larger than or equal to $actual.');
exports.gte = gte;
const lt = (limit, message) => exports.constraint(v => v < limit, message !== null && message !== void 0 ? message : 'Value for $property must be smaller than $actual.');
exports.lt = lt;
const lte = (limit, message) => exports.constraint(v => v <= limit, message !== null && message !== void 0 ? message : 'Value for $property must be smaller than or equal to $actual.');
exports.lte = lte;
//# sourceMappingURL=Contraints.js.map

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

.replace('$actual', `'${subject[v.property]}'`), subject.constructor.name, v.property);
exports.validate = (subject) => {
const validate = (subject) => {
return (!types_1.isDefined(subject))

@@ -18,3 +18,5 @@ ? types_1.results('Object can not be validated')

};
exports.validateReject = (subject) => When_1.when(subject).not.isValid.reject();
exports.validate = validate;
const validateReject = (subject) => When_1.when(subject).not.isValid.reject();
exports.validateReject = validateReject;
//# sourceMappingURL=Validate.js.map

@@ -29,3 +29,4 @@ "use strict";

}
exports.when = (subject) => new When(subject);
const when = (subject) => new When(subject);
exports.when = when;
//# sourceMappingURL=When.js.map
{
"name": "@thisisagile/easy",
"version": "1.8.6",
"version": "1.8.7",
"description": "Straightforward library for building domain-driven microservice architectures",

@@ -34,17 +34,18 @@ "author": "Sander Hoogendoorn",

"devDependencies": {
"@thisisagile/easy-test": "^1.2.2",
"@thisisagile/easy-test": "^1.2.4",
"@types/jest": "^26.0.15",
"@types/uuid": "^8.3.0",
"jest": "^26.6.1",
"axios": "^0.21.0",
"jest": "^26.6.3",
"jest-junit": "^12.0.0",
"jest-sonar-reporter": "^2.0.0",
"prettier": "^2.1.2",
"semantic-release": "^17.2.2",
"uuid": "^8.3.1",
"ts-jest": "^26.4.3",
"typescript": "4.0.5"
"prettier": "^2.2.0",
"semantic-release": "^17.3.0",
"ts-jest": "^26.4.4",
"typescript": "4.1.2",
"uuid": "^8.3.1"
},
"dependencies": {
"reflect-metadata": "^0.1.13",
"tsyringe": "^4.3.0",
"tsyringe": "^4.4.0",
"uuid": "^8.3.1"

@@ -51,0 +52,0 @@ },

@@ -1,25 +0,13 @@

import { Id, Json, JsonValue } from "../types";
import { Query } from "./Query";
import { Id, Json, JsonValue } from '../types';
import { List } from '../types/List';
export interface Gateway {
all: () => Promise<List<Json>>;
byId: (id: Id) => Promise<Json>;
search: (q: JsonValue) => Promise<List<Json>>;
exists: (id: Id) => Promise<boolean>;
// Queries
all(): Promise<List<Json>>;
by(key: string, value: JsonValue): Promise<List<Json>>;
byId(id: Id): Promise<Json>;
find(query: Query): Promise<List<Json>>;
search(q: JsonValue): Promise<List<Json>>;
exists(id: Id): Promise<boolean>;
// Commands
add(item: Json): Promise<Json>;
update(item: Json): Promise<Json>;
remove(id: Id): Promise<boolean>;
// Meta
count(query?: Query): Promise<number>;
add: (item: Json) => Promise<Json>;
update: (item: Json) => Promise<Json>;
remove: (id: Id) => Promise<boolean>;
}

@@ -13,3 +13,3 @@ import { Constructor } from './Constructor';

export const isNotEmptyObject = (o?: unknown): boolean => isObject(o) && Object.getOwnPropertyNames(o).length > 0;
export const isEmptyObject = (o?: unknown): boolean => isObject(o) && Object.getOwnPropertyNames(o).length === 0;

@@ -16,0 +16,0 @@ export const isFunction = (o?: unknown): o is (...params: unknown[]) => unknown => isDefined(o) && typeof o === 'function';

@@ -6,4 +6,4 @@ import { isA } from "./IsA";

export const result = (message: Text, domain?: string, location?: string) => ({ message, domain, location });
export const result = (message: Text, domain: string = "easy", location?: string) => ({ message, domain, location });
export const isResult = (r?: unknown): r is Result => isA<Result>(r, "message");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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