@libs-for-dev/nestjs-ddd-library 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require(`class-validator`),t=require(`oxide.ts`),n=require(`fast-equals`),r=require(`ui7`),i=require(`@nestjs/cqrs`);var a=class extends Error{static name=`NotAMoneyError`;constructor(e,t){super(`Amount ${e} with currency ${t} is not valid money`)}},o=class extends Error{static name=`NotAPhoneNumberError`;constructor(e){super(`${e} is not a valid phone number`)}},s=class extends Error{static name=`NotAnEmailError`;constructor(e){super(`${e} is not a valid email`)}},c=class extends Error{static name=`NotAnUrlError`;constructor(e){super(`${e} is not a valid URL`)}},l=class extends Error{static name=`NotAnUuidError`;constructor(e){super(`${e} is not a valid UUID`)}},u=class{constructor(e){this.props=e}equals(e){return this.constructor.name===e.constructor.name?(0,n.deepEqual)(e.props,this.props):!1}},d=class n extends u{get value(){return this.props.value}static create(e){return this.isValid(e)?(0,t.Ok)(new n({value:e})):(0,t.Err)(new s(e))}static isValid(t){return(0,e.isEmail)(t)}},f=class e extends u{get amount(){return this.props.amount}get currency(){return this.props.currency}get value(){return{amount:this.amount,currency:this.currency}}static create(n,r){return this.isValid(n,r)?(0,t.Ok)(new e({amount:n,currency:r})):(0,t.Err)(new a(n,r))}static isValid(e,t){return!(e<0||!Number.isFinite(e)||!/^[A-Z]{3}$/u.test(t))}},p=class n extends u{get value(){return this.props.value}static create(e){return this.isValid(e)?(0,t.Ok)(new n({value:e})):(0,t.Err)(new o(e))}static isValid(t){return(0,e.
|
|
1
|
+
let e=require(`class-validator`),t=require(`oxide.ts`),n=require(`fast-equals`),r=require(`ui7`),i=require(`@nestjs/cqrs`);var a=class extends Error{static name=`NotAMoneyError`;constructor(e,t){super(`Amount ${e} with currency ${t} is not valid money`)}},o=class extends Error{static name=`NotAPhoneNumberError`;constructor(e){super(`${e} is not a valid phone number`)}},s=class extends Error{static name=`NotAnEmailError`;constructor(e){super(`${e} is not a valid email`)}},c=class extends Error{static name=`NotAnUrlError`;constructor(e){super(`${e} is not a valid URL`)}},l=class extends Error{static name=`NotAnUuidError`;constructor(e){super(`${e} is not a valid UUID`)}},u=class{constructor(e){this.props=e}equals(e){return this.constructor.name===e.constructor.name?(0,n.deepEqual)(e.props,this.props):!1}},d=class n extends u{get value(){return this.props.value}static create(e){return this.isValid(e)?(0,t.Ok)(new n({value:e})):(0,t.Err)(new s(e))}static isValid(t){return(0,e.isEmail)(t)}},f=class e extends u{get amount(){return this.props.amount}get currency(){return this.props.currency}get value(){return{amount:this.amount,currency:this.currency}}static create(n,r){return this.isValid(n,r)?(0,t.Ok)(new e({amount:n,currency:r})):(0,t.Err)(new a(n,r))}static isValid(e,t){return!(e<0||!Number.isFinite(e)||!/^[A-Z]{3}$/u.test(t))}},p=class n extends u{get value(){return this.props.value}static create(e){return this.isValid(e)?(0,t.Ok)(new n({value:e})):(0,t.Err)(new o(e))}static isValid(t){return(0,e.isPhoneNumber)(t)}},m=class n extends u{get value(){return this.props.value}static create(e){return this.isValid(e)?(0,t.Ok)(new n({value:e})):(0,t.Err)(new c(e))}static isValid(t){return(0,e.isURL)(t,{require_protocol:!0})}},h=class n extends u{get value(){return this.props.value}static create(r){return(0,e.isUUID)(r)?(0,t.Ok)(new n({value:r})):(0,t.Err)(new l(r))}static generate(){return new n({value:(0,r.v7)()})}};const g=e=>typeof e==`object`&&!!e&&typeof e!=`function`,_=e=>{let t=Object.getOwnPropertyNames(e);for(let n of t){let t=e[n];g(t)&&_(t)}return Object.freeze(e)};var v=class extends i.AggregateRoot{id;get props(){return _(this.propsData.props)}propsData;constructor(e,t){super(),this.id=e,this.propsData={props:t}}equals(e){return this.constructor.name===e.constructor.name?this.id===e.id:!1}};exports.AbstractEntity=v,exports.AbstractValueObject=u,exports.Email=d,exports.Money=f,exports.NotAMoneyError=a,exports.NotAPhoneNumberError=o,exports.NotAnEmailError=s,exports.NotAnUrlError=c,exports.NotAnUuidError=l,exports.PhoneNumber=p,exports.Url=m,exports.Uuid=h,exports.deepReadonly=_;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEmail as e,
|
|
1
|
+
import{isEmail as e,isPhoneNumber as t,isURL as n,isUUID as r}from"class-validator";import{Err as i,Ok as a}from"oxide.ts";import{deepEqual as o}from"fast-equals";import{v7 as s}from"ui7";import{AggregateRoot as c}from"@nestjs/cqrs";var l=class extends Error{static name=`NotAMoneyError`;constructor(e,t){super(`Amount ${e} with currency ${t} is not valid money`)}},u=class extends Error{static name=`NotAPhoneNumberError`;constructor(e){super(`${e} is not a valid phone number`)}},d=class extends Error{static name=`NotAnEmailError`;constructor(e){super(`${e} is not a valid email`)}},f=class extends Error{static name=`NotAnUrlError`;constructor(e){super(`${e} is not a valid URL`)}},p=class extends Error{static name=`NotAnUuidError`;constructor(e){super(`${e} is not a valid UUID`)}},m=class{constructor(e){this.props=e}equals(e){return this.constructor.name===e.constructor.name?o(e.props,this.props):!1}},h=class t extends m{get value(){return this.props.value}static create(e){return this.isValid(e)?a(new t({value:e})):i(new d(e))}static isValid(t){return e(t)}},g=class e extends m{get amount(){return this.props.amount}get currency(){return this.props.currency}get value(){return{amount:this.amount,currency:this.currency}}static create(t,n){return this.isValid(t,n)?a(new e({amount:t,currency:n})):i(new l(t,n))}static isValid(e,t){return!(e<0||!Number.isFinite(e)||!/^[A-Z]{3}$/u.test(t))}},_=class e extends m{get value(){return this.props.value}static create(t){return this.isValid(t)?a(new e({value:t})):i(new u(t))}static isValid(e){return t(e)}},v=class e extends m{get value(){return this.props.value}static create(t){return this.isValid(t)?a(new e({value:t})):i(new f(t))}static isValid(e){return n(e,{require_protocol:!0})}},y=class e extends m{get value(){return this.props.value}static create(t){return r(t)?a(new e({value:t})):i(new p(t))}static generate(){return new e({value:s()})}};const b=e=>typeof e==`object`&&!!e&&typeof e!=`function`,x=e=>{let t=Object.getOwnPropertyNames(e);for(let n of t){let t=e[n];b(t)&&x(t)}return Object.freeze(e)};var S=class extends c{id;get props(){return x(this.propsData.props)}propsData;constructor(e,t){super(),this.id=e,this.propsData={props:t}}equals(e){return this.constructor.name===e.constructor.name?this.id===e.id:!1}};export{S as AbstractEntity,m as AbstractValueObject,h as Email,g as Money,l as NotAMoneyError,u as NotAPhoneNumberError,d as NotAnEmailError,f as NotAnUrlError,p as NotAnUuidError,_ as PhoneNumber,v as Url,y as Uuid,x as deepReadonly};
|