@libs-for-dev/nestjs-ddd-library 1.3.1 → 1.4.0

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 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.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=_;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`fast-equals`),t=require(`class-validator`),n=require(`oxide.ts`),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(t){return this.constructor.name===t.constructor.name?(0,e.deepEqual)(t.props,this.props):!1}},d=class extends u{get value(){return this.props.value}static isValid(e){return this.Values.includes(e)}},f=class e extends u{get value(){return this.props.value}static create(t){return this.isValid(t)?(0,n.Ok)(new e({value:t})):(0,n.Err)(new s(t))}static isValid(e){return(0,t.isEmail)(e)}},p=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(t,r){return this.isValid(t,r)?(0,n.Ok)(new e({amount:t,currency:r})):(0,n.Err)(new a(t,r))}static isValid(e,t){return!(e<0||!Number.isFinite(e)||!/^[A-Z]{3}$/u.test(t))}},m=class e extends u{get value(){return this.props.value}static create(t){return this.isValid(t)?(0,n.Ok)(new e({value:t})):(0,n.Err)(new o(t))}static isValid(e){return(0,t.isPhoneNumber)(e)}},h=class e extends u{get value(){return this.props.value}static create(t){return this.isValid(t)?(0,n.Ok)(new e({value:t})):(0,n.Err)(new c(t))}static isValid(e){return(0,t.isURL)(e,{require_protocol:!0})}},g=class e extends u{get value(){return this.props.value}static create(r){return(0,t.isUUID)(r)?(0,n.Ok)(new e({value:r})):(0,n.Err)(new l(r))}static generate(){return new e({value:(0,r.v7)()})}};const _=e=>typeof e==`object`&&!!e&&typeof e!=`function`,v=e=>{let t=Object.getOwnPropertyNames(e);for(let n of t){let t=e[n];_(t)&&v(t)}return Object.freeze(e)};var y=class extends i.AggregateRoot{id;get props(){return v(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=y,exports.AbstractOption=d,exports.AbstractValueObject=u,exports.Email=f,exports.Money=p,exports.NotAMoneyError=a,exports.NotAPhoneNumberError=o,exports.NotAnEmailError=s,exports.NotAnUrlError=c,exports.NotAnUuidError=l,exports.PhoneNumber=m,exports.Url=h,exports.Uuid=g,exports.deepReadonly=v;
package/dist/index.d.cts CHANGED
@@ -43,6 +43,14 @@ declare abstract class AbstractValueObject<T> {
43
43
  equals(valueObject: AbstractValueObject<T>): boolean;
44
44
  }
45
45
  //#endregion
46
+ //#region src/value-objects/abstract-option.d.ts
47
+ declare abstract class AbstractOption<TValues extends string> extends AbstractValueObject<TValues> {
48
+ get value(): TValues[number];
49
+ static isValid<T extends {
50
+ Values: readonly string[];
51
+ }>(this: T, value: string): value is T['Values'][number];
52
+ }
53
+ //#endregion
46
54
  //#region src/value-objects/email.d.ts
47
55
  declare class Email extends AbstractValueObject<string> {
48
56
  get value(): string;
@@ -100,4 +108,4 @@ declare abstract class AbstractEntity<Id, Props, Event extends IEvent = IEvent>
100
108
  equals(object: AbstractEntity<Id, Props>): boolean;
101
109
  }
102
110
  //#endregion
103
- export { AbstractEntity, AbstractValueObject, DeepReadonly, Email, EntityPropsInterface, Money, MoneyPropsInterface, NotAMoneyError, NotAPhoneNumberError, NotAnEmailError, NotAnUrlError, NotAnUuidError, PhoneNumber, PrimitiveInterface, Primitives, Url, Uuid, deepReadonly };
111
+ export { AbstractEntity, AbstractOption, AbstractValueObject, DeepReadonly, Email, EntityPropsInterface, Money, MoneyPropsInterface, NotAMoneyError, NotAPhoneNumberError, NotAnEmailError, NotAnUrlError, NotAnUuidError, PhoneNumber, PrimitiveInterface, Primitives, Url, Uuid, deepReadonly };
package/dist/index.d.mts CHANGED
@@ -43,6 +43,14 @@ declare abstract class AbstractValueObject<T> {
43
43
  equals(valueObject: AbstractValueObject<T>): boolean;
44
44
  }
45
45
  //#endregion
46
+ //#region src/value-objects/abstract-option.d.ts
47
+ declare abstract class AbstractOption<TValues extends string> extends AbstractValueObject<TValues> {
48
+ get value(): TValues[number];
49
+ static isValid<T extends {
50
+ Values: readonly string[];
51
+ }>(this: T, value: string): value is T['Values'][number];
52
+ }
53
+ //#endregion
46
54
  //#region src/value-objects/email.d.ts
47
55
  declare class Email extends AbstractValueObject<string> {
48
56
  get value(): string;
@@ -100,4 +108,4 @@ declare abstract class AbstractEntity<Id, Props, Event extends IEvent = IEvent>
100
108
  equals(object: AbstractEntity<Id, Props>): boolean;
101
109
  }
102
110
  //#endregion
103
- export { AbstractEntity, AbstractValueObject, DeepReadonly, Email, EntityPropsInterface, Money, MoneyPropsInterface, NotAMoneyError, NotAPhoneNumberError, NotAnEmailError, NotAnUrlError, NotAnUuidError, PhoneNumber, PrimitiveInterface, Primitives, Url, Uuid, deepReadonly };
111
+ export { AbstractEntity, AbstractOption, AbstractValueObject, DeepReadonly, Email, EntityPropsInterface, Money, MoneyPropsInterface, NotAMoneyError, NotAPhoneNumberError, NotAnEmailError, NotAnUrlError, NotAnUuidError, PhoneNumber, PrimitiveInterface, Primitives, Url, Uuid, deepReadonly };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
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};
1
+ import{deepEqual as e}from"fast-equals";import{isEmail as t,isPhoneNumber as n,isURL as r,isUUID as i}from"class-validator";import{Err as a,Ok as o}from"oxide.ts";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(t){return this.constructor.name===t.constructor.name?e(t.props,this.props):!1}},h=class extends m{get value(){return this.props.value}static isValid(e){return this.Values.includes(e)}},g=class e extends m{get value(){return this.props.value}static create(t){return this.isValid(t)?o(new e({value:t})):a(new d(t))}static isValid(e){return t(e)}},_=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)?o(new e({amount:t,currency:n})):a(new l(t,n))}static isValid(e,t){return!(e<0||!Number.isFinite(e)||!/^[A-Z]{3}$/u.test(t))}},v=class e extends m{get value(){return this.props.value}static create(t){return this.isValid(t)?o(new e({value:t})):a(new u(t))}static isValid(e){return n(e)}},y=class e extends m{get value(){return this.props.value}static create(t){return this.isValid(t)?o(new e({value:t})):a(new f(t))}static isValid(e){return r(e,{require_protocol:!0})}},b=class e extends m{get value(){return this.props.value}static create(t){return i(t)?o(new e({value:t})):a(new p(t))}static generate(){return new e({value:s()})}};const x=e=>typeof e==`object`&&!!e&&typeof e!=`function`,S=e=>{let t=Object.getOwnPropertyNames(e);for(let n of t){let t=e[n];x(t)&&S(t)}return Object.freeze(e)};var C=class extends c{id;get props(){return S(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{C as AbstractEntity,h as AbstractOption,m as AbstractValueObject,g as Email,_ as Money,l as NotAMoneyError,u as NotAPhoneNumberError,d as NotAnEmailError,f as NotAnUrlError,p as NotAnUuidError,v as PhoneNumber,y as Url,b as Uuid,S as deepReadonly};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libs-for-dev/nestjs-ddd-library",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "NestJS DDD library",
5
5
  "keywords": [
6
6
  "ddd-library",
@@ -12,6 +12,10 @@
12
12
  "type": "git",
13
13
  "url": "https://gitlab.com/libs-for-dev/nestjs/nestjs-ddd-library.git"
14
14
  },
15
+ "funding": {
16
+ "type": "usdt_trc20",
17
+ "url": "https://tronscan.org/#/address/TACUoDtnpkgbdBsNQuqQA1Zpn59VzqexwB"
18
+ },
15
19
  "license": "MIT",
16
20
  "author": {
17
21
  "name": "libs-for-dev"
@@ -25,7 +29,12 @@
25
29
  }
26
30
  },
27
31
  "main": "dist/index.mjs",
32
+ "module": "dist/index.mjs",
28
33
  "types": "dist/index.d.mts",
34
+ "bin": "./dist/index.js",
35
+ "directories": {
36
+ "lib": "dist"
37
+ },
29
38
  "files": [
30
39
  "dist"
31
40
  ],
@@ -44,40 +53,60 @@
44
53
  "test:unit": "vitest run"
45
54
  },
46
55
  "devDependencies": {
47
- "@libs-for-dev/eslint-rules": "2.5.0",
48
- "@nestjs/common": "^11.1.11",
49
- "@nestjs/core": "^11.1.11",
56
+ "@libs-for-dev/eslint-rules": "2.7.0",
57
+ "@nestjs/common": "^11.1.17",
58
+ "@nestjs/core": "^11.1.17",
50
59
  "@nestjs/cqrs": "^11.0.3",
51
- "@stryker-mutator/core": "^9.4.0",
52
- "@stryker-mutator/vitest-runner": "^9.4.0",
53
- "@types/node": "^25.0.3",
54
- "@vitest/coverage-v8": "^4.0.16",
55
- "class-validator": "^0.14.3",
60
+ "@stryker-mutator/core": "^9.6.0",
61
+ "@stryker-mutator/vitest-runner": "^9.6.0",
62
+ "@types/node": "^25.5.0",
63
+ "@vitest/coverage-v8": "^4.1.0",
64
+ "class-validator": "^0.15.1",
56
65
  "concurrently": "^9.2.1",
57
66
  "create-ts-index": "^1.14.0",
58
- "eslint": "9.39.2",
67
+ "eslint": "10.1.0",
59
68
  "fast-equals": "^6.0.0",
60
69
  "jiti": "^2.6.1",
61
- "knip": "^5.79.0",
70
+ "knip": "^6.0.1",
62
71
  "oxide.ts": "^1.1.0",
63
72
  "reflect-metadata": "^0.2.2",
64
73
  "scriptlint": "^3.0.0",
65
- "tsdown": "0.19.0-beta.2",
74
+ "tsdown": "0.21.4",
66
75
  "typescript": "^5.9.3",
67
76
  "ui7": "^0.2.3",
68
- "vitest": "^4.0.16",
77
+ "vitest": "^4.1.0",
69
78
  "yarn-audit-fix": "^10.1.1"
70
79
  },
71
80
  "peerDependencies": {
72
81
  "@nestjs/cqrs": ">=9.0.0 <12.0.0",
73
82
  "class-validator": ">=0.12.0 <0.15.0",
74
- "fast-equals": ">=5.0.0 <6.0.0",
83
+ "fast-equals": ">=5.0.0 <7.0.0",
75
84
  "oxide.ts": ">=1.0.0 <2.0.0",
76
85
  "ui7": ">=0.2.0 <0.3.0"
77
86
  },
78
87
  "bundleDependencies": false,
79
- "packageManager": "yarn@4.9.4",
88
+ "packageManager": "yarn@4.13.0",
80
89
  "engines": {
81
- "node": "^23.11.0"
90
+ "node": "^25.8.1",
91
+ "yarn": "^4.13.0"
92
+ },
93
+ "os": [
94
+ "darwin",
95
+ "linux",
96
+ "win32"
97
+ ],
98
+ "cpu": [
99
+ "arm64",
100
+ "x64"
101
+ ],
102
+ "publishConfig": {
103
+ "access": "public"
104
+ },
105
+ "devEngines": {
106
+ "runtime": {
107
+ "name": "node",
108
+ "version": "^25.8.1",
109
+ "onFail": "error"
110
+ }
82
111
  }
83
112
  }