New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@piggly/ddd-toolkit

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@piggly/ddd-toolkit - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

25

dist/cjs/core/ResultChain.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResultChain = void 0;
const Result_1 = require("./Result.js");
/**

@@ -41,4 +42,14 @@ * @file Base result chainclass.

*/
_last;
_last = Result_1.Result.ok(false);
/**
* Check if the chain has been executed.
*
* @protected
* @readonly
* @memberof ResultChain
* @since 3.2.0
* @author Caique Araujo <caique@piggly.com.br>
*/
_executed = false;
/**
* Check if the chain is initialized.

@@ -65,3 +76,3 @@ *

hasFinished() {
return this._last !== undefined;
return this._executed;
}

@@ -80,3 +91,4 @@ /**

this._chain = new Map();
this._last = undefined;
this._last = Result_1.Result.ok(false);
this._executed = false;
return this;

@@ -116,3 +128,7 @@ }

resultFor(key) {
return this._results?.get(key);
if (!this._results || !this._results.has(key)) {
throw new Error(`Result for key "${key}" is not available. Did you forget to run the chain?`);
}
/* eslint-disable @typescript-eslint/no-non-null-assertion */
return this._results.get(key);
}

@@ -135,3 +151,2 @@ /**

}
this._last = undefined;
/* eslint-disable no-restricted-syntax */

@@ -138,0 +153,0 @@ for (const [key, fn] of this._chain?.entries() ?? []) {

@@ -0,1 +1,2 @@

import { Result } from './Result.js';
/**

@@ -38,4 +39,14 @@ * @file Base result chainclass.

*/
_last;
_last = Result.ok(false);
/**
* Check if the chain has been executed.
*
* @protected
* @readonly
* @memberof ResultChain
* @since 3.2.0
* @author Caique Araujo <caique@piggly.com.br>
*/
_executed = false;
/**
* Check if the chain is initialized.

@@ -62,3 +73,3 @@ *

hasFinished() {
return this._last !== undefined;
return this._executed;
}

@@ -77,3 +88,4 @@ /**

this._chain = new Map();
this._last = undefined;
this._last = Result.ok(false);
this._executed = false;
return this;

@@ -113,3 +125,7 @@ }

resultFor(key) {
return this._results?.get(key);
if (!this._results || !this._results.has(key)) {
throw new Error(`Result for key "${key}" is not available. Did you forget to run the chain?`);
}
/* eslint-disable @typescript-eslint/no-non-null-assertion */
return this._results.get(key);
}

@@ -132,3 +148,2 @@ /**

}
this._last = undefined;
/* eslint-disable no-restricted-syntax */

@@ -135,0 +150,0 @@ for (const [key, fn] of this._chain?.entries() ?? []) {

19

dist/types/core/ResultChain.d.ts

@@ -1,2 +0,1 @@

import { TOrUndefined } from '../types';
import { DomainError } from './errors/DomainError';

@@ -42,4 +41,14 @@ import { Result } from './Result';

*/
protected _last?: Result<any, DomainError>;
protected _last: Result<any, DomainError>;
/**
* Check if the chain has been executed.
*
* @protected
* @readonly
* @memberof ResultChain
* @since 3.2.0
* @author Caique Araujo <caique@piggly.com.br>
*/
protected _executed: boolean;
/**
* Check if the chain is initialized.

@@ -85,3 +94,3 @@ *

*/
chain<Data = any, Last = any, Error extends DomainError = DomainError>(key: string, fn: ResultFn<Data, Last, Error>): this;
chain<PrevData, NextData, NextError extends DomainError = DomainError>(key: string, fn: ResultFn<PrevData, NextData, NextError>): this;
/**

@@ -97,3 +106,3 @@ * Get a result from the chain.

*/
resultFor<Data, Error extends DomainError = DomainError>(key: string): TOrUndefined<Result<Data, Error>>;
resultFor<ResponseData, ResponseError extends DomainError = DomainError>(key: string): Result<ResponseData, ResponseError>;
/**

@@ -108,3 +117,3 @@ * Run the chain.

*/
run<Data, Error extends DomainError = DomainError>(): Promise<Result<Data, Error>>;
run<ResponseData, ResponseError extends DomainError = DomainError>(): Promise<Result<ResponseData, ResponseError>>;
}

@@ -18,2 +18,3 @@ import type { TOrAnother } from '../../types';

export type EventListener = (...args: Array<any>) => void;
export type ResultFn<Data = any, Last = any, Error extends DomainError = DomainError> = (last?: Result<Last, Error>) => TOrAnother<Result<Data, Error>, Promise<Result<Data, Error>>>;
export type ResultFn<PrevData = any, NextData = any, NextError extends DomainError = DomainError> = (last: Result<PrevData, DomainError>) => ResultReturnType<NextData, NextError>;
export type ResultReturnType<NextData = any, NextError extends DomainError = DomainError> = TOrAnother<Result<NextData, NextError>, Promise<Result<NextData, NextError>>>;
{
"name": "@piggly/ddd-toolkit",
"version": "3.2.0",
"version": "3.2.1",
"description": "A bunch of tools to use Model-Driven Design and Domain-Driven Design architecture in a back-end application.",

@@ -5,0 +5,0 @@ "scripts": {

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