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.4.3 to 1.4.4

10

dist/data/Gateway.d.ts
import { Id, Json, JsonValue } from "../types";
import { Query } from "./Query";
import { List } from '../utils';
export interface Gateway {
all(): Promise<Json[]>;
by(key: string, value: JsonValue): Promise<Json[]>;
all(): Promise<List<Json>>;
by(key: string, value: JsonValue): Promise<List<Json>>;
byId(id: Id): Promise<Json>;
find(query: Query): Promise<Json[]>;
search(q: JsonValue): Promise<Json[]>;
find(query: Query): Promise<List<Json>>;
search(q: JsonValue): Promise<List<Json>>;
exists(id: Id): Promise<boolean>;

@@ -14,3 +15,2 @@ add(item: Json): Promise<Json>;

count(query?: Query): Promise<number>;
groupBy(...queries: Query[]): Promise<Json[]>;
}
export declare type Constructor<T> = {
new (...args: any[]): T;
};
export declare type Get<P, T> = T | ((...params: P[]) => T);
export declare type Predicate<P> = Get<P, boolean>;
export declare const ofGet: <P, T>(g: Get<P, T>, ...params: P[]) => T;
export declare type Get<T, Param = unknown> = T | ((...params: Param[]) => T);
export declare type Predicate<Param> = Get<boolean, Param>;
export declare const ofGet: <T, Param>(g: Get<T, Param>, ...params: Param[]) => T;
export declare type GetProperty<T, U> = keyof T | ((t: T) => U);
export declare const ofProperty: <T, U>(t: T, p: GetProperty<T, U>) => U;
import { Get, Predicate } from '../types';
export declare class Case<V, Out> {
declare class Case<T, V = unknown> {
protected value: V;
protected outcome?: Out;
constructor(value: V, outcome?: Out);
case(pred: Predicate<V>, out: Get<V, Out>): Case<V, Out>;
else(alt?: Get<V, Out>): Out;
protected outcome?: T;
constructor(value: V, outcome?: T);
case(pred: Predicate<V>, out: Get<T, V>): Case<T, V>;
else(alt?: Get<T, V>): T;
}
export declare class Found<V, Out> extends Case<V, Out> {
case(pred: Predicate<V>, out: Get<V, Out>): this;
else(alt?: Get<V, Out>): Out;
export declare class Found<T, V = unknown> extends Case<T, V> {
case(pred: Predicate<V>, out: Get<T, V>): this;
else(alt?: Get<T, V>): T;
}
export declare const choose: <V, Out>(value: V) => Case<V, Out>;
export declare const choose: <T, V = unknown>(value: V) => Case<T, V>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.choose = exports.Found = exports.Case = void 0;
exports.choose = exports.Found = void 0;
const types_1 = require("../types");

@@ -20,3 +20,2 @@ class Case {

}
exports.Case = Case;
class Found extends Case {

@@ -23,0 +22,0 @@ case(pred, out) { return this; }

{
"name": "@thisisagile/easy",
"version": "1.4.3",
"version": "1.4.4",
"description": "Straightforward library for building domain-driven microservice architectures",

@@ -43,3 +43,2 @@ "author": "Sander Hoogendoorn",

"dependencies": {
"class-validator": "^0.12.2",
"reflect-metadata": "^0.1.13",

@@ -46,0 +45,0 @@ "tsyringe": "^4.3.0",

import { Id, Json, JsonValue } from "../types";
import { Query } from "./Query";
import { List } from '../utils';

@@ -8,7 +9,7 @@ export interface Gateway {

all(): Promise<Json[]>;
by(key: string, value: JsonValue): Promise<Json[]>;
all(): Promise<List<Json>>;
by(key: string, value: JsonValue): Promise<List<Json>>;
byId(id: Id): Promise<Json>;
find(query: Query): Promise<Json[]>;
search(q: JsonValue): Promise<Json[]>;
find(query: Query): Promise<List<Json>>;
search(q: JsonValue): Promise<List<Json>>;
exists(id: Id): Promise<boolean>;

@@ -25,3 +26,2 @@

count(query?: Query): Promise<number>;
groupBy(...queries: Query[]): Promise<Json[]>;
}

@@ -5,7 +5,7 @@ import { isFunction } from './Is';

export type Get<P, T> = T | ((...params: P[]) => T);
export type Predicate<P> = Get<P, boolean>;
export const ofGet = <P, T>(g: Get<P, T>, ...params: P[]): T => isFunction(g) ? g(...params) : g;
export type Get<T, Param = unknown> = T | ((...params: Param[]) => T);
export type Predicate<Param> = Get<boolean, Param>;
export const ofGet = <T, Param>(g: Get<T, Param>, ...params: Param[]): T => isFunction(g) ? g(...params) : g;
export type GetProperty<T, U> = keyof T | ((t: T) => U);
export const ofProperty = <T, U>(t: T, p: GetProperty<T, U>): U => isFunction(p) ? p(t) : t[p] as unknown as U;
import { Get, ofGet, Predicate } from '../types';
export class Case<V, Out> {
constructor(protected value: V, protected outcome?: Out) {}
class Case<T, V = unknown> {
constructor(protected value: V, protected outcome?: T) {}
case(pred: Predicate<V>, out: Get<V, Out>): Case<V, Out> {
case(pred: Predicate<V>, out: Get<T, V>): Case<T, V> {
try {

@@ -14,11 +14,11 @@ return ofGet(pred, this.value) ? new Found(this.value, ofGet(out, this.value)) : this;

else(alt?: Get<V, Out>): Out { return ofGet(alt, this.value); }
else(alt?: Get<T, V>): T { return ofGet(alt, this.value); }
}
export class Found<V, Out> extends Case<V, Out> {
case(pred: Predicate<V>, out: Get<V, Out>): this { return this; }
export class Found<T, V = unknown> extends Case<T, V> {
case(pred: Predicate<V>, out: Get<T, V>): this { return this; }
else(alt?: Get<V, Out>): Out { return this.outcome; }
else(alt?: Get<T, V>): T { return this.outcome; }
}
export const choose = <V, Out>(value: V): Case<V, Out> => new Case(value);
export const choose = <T, V = unknown>(value: V): Case<T, V> => new Case(value);

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