plutin 1.0.0 → 1.1.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/{base-controller-cec5714c.d.ts → base-controller-68008870.d.ts} +1 -1
- package/dist/core/decorators/controller-http-decorator.cjs +2 -444
- package/dist/core/decorators/controller-http-decorator.cjs.map +1 -1
- package/dist/core/decorators/controller-http-decorator.d.cts +1 -1
- package/dist/core/decorators/controller-http-decorator.d.ts +1 -1
- package/dist/core/decorators/controller-http-decorator.js +2 -452
- package/dist/core/decorators/controller-http-decorator.js.map +1 -1
- package/dist/core/decorators/dependency-container.cjs +3 -2
- package/dist/core/decorators/dependency-container.cjs.map +1 -1
- package/dist/core/decorators/dependency-container.d.cts +1 -1
- package/dist/core/decorators/dependency-container.d.ts +1 -1
- package/dist/core/decorators/dependency-container.js +2 -2
- package/dist/core/decorators/dependency-container.js.map +1 -1
- package/dist/core/entities/aggregate-root.cjs.map +1 -1
- package/dist/core/entities/aggregate-root.d.cts +2 -2
- package/dist/core/entities/aggregate-root.d.ts +2 -2
- package/dist/core/entities/aggregate-root.js.map +1 -1
- package/dist/core/entities/common-dto.cjs.map +1 -1
- package/dist/core/entities/common-dto.d.cts +2 -2
- package/dist/core/entities/common-dto.d.ts +2 -2
- package/dist/core/entities/entity.cjs.map +1 -1
- package/dist/core/entities/entity.d.cts +4 -3
- package/dist/core/entities/entity.d.ts +4 -3
- package/dist/core/entities/entity.js.map +1 -1
- package/dist/core/http/base-controller.cjs +7 -445
- package/dist/core/http/base-controller.cjs.map +1 -1
- package/dist/core/http/base-controller.d.cts +1 -1
- package/dist/core/http/base-controller.d.ts +1 -1
- package/dist/core/http/base-controller.js +3 -453
- package/dist/core/http/base-controller.js.map +1 -1
- package/dist/core/http/error-notifier.d.cts +1 -1
- package/dist/core/http/error-notifier.d.ts +1 -1
- package/dist/core/http/http.cjs.map +1 -1
- package/dist/core/http/http.d.cts +1 -1
- package/dist/core/http/http.d.ts +1 -1
- package/dist/{core/index.cjs → index.cjs} +307 -39
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/{core/index.js → index.js} +287 -34
- package/dist/index.js.map +1 -0
- package/dist/infra/adapters/http/express-adapter.cjs +4 -446
- package/dist/infra/adapters/http/express-adapter.cjs.map +1 -1
- package/dist/infra/adapters/http/express-adapter.d.cts +3 -3
- package/dist/infra/adapters/http/express-adapter.d.ts +3 -3
- package/dist/infra/adapters/http/express-adapter.js +4 -454
- package/dist/infra/adapters/http/express-adapter.js.map +1 -1
- package/dist/infra/adapters/http/fastify-adapter.cjs +5 -447
- package/dist/infra/adapters/http/fastify-adapter.cjs.map +1 -1
- package/dist/infra/adapters/http/fastify-adapter.d.cts +3 -3
- package/dist/infra/adapters/http/fastify-adapter.d.ts +3 -3
- package/dist/infra/adapters/http/fastify-adapter.js +5 -455
- package/dist/infra/adapters/http/fastify-adapter.js.map +1 -1
- package/dist/infra/adapters/http/validate-controller-metadata.cjs.map +1 -1
- package/dist/infra/adapters/http/validate-controller-metadata.d.cts +1 -1
- package/dist/infra/adapters/http/validate-controller-metadata.d.ts +1 -1
- package/dist/infra/adapters/http/validate-controller-metadata.js.map +1 -1
- package/dist/infra/adapters/notifications/discord.cjs.map +1 -1
- package/dist/infra/adapters/notifications/discord.d.cts +1 -1
- package/dist/infra/adapters/notifications/discord.d.ts +1 -1
- package/dist/infra/adapters/notifications/discord.js.map +1 -1
- package/dist/infra/adapters/notifications/in-memory.d.cts +1 -1
- package/dist/infra/adapters/notifications/in-memory.d.ts +1 -1
- package/dist/infra/adapters/notifications/sentry.cjs.map +1 -1
- package/dist/infra/adapters/notifications/sentry.d.cts +1 -1
- package/dist/infra/adapters/notifications/sentry.d.ts +1 -1
- package/dist/infra/adapters/notifications/sentry.js.map +1 -1
- package/dist/infra/adapters/validators/zod/index.d.cts +1 -1
- package/dist/infra/adapters/validators/zod/index.d.ts +1 -1
- package/dist/infra/adapters/validators/zod/zod-validator.d.cts +1 -1
- package/dist/infra/adapters/validators/zod/zod-validator.d.ts +1 -1
- package/dist/infra/env/index.cjs +3 -9
- package/dist/infra/env/index.cjs.map +1 -1
- package/dist/infra/env/index.d.cts +21 -5
- package/dist/infra/env/index.d.ts +21 -5
- package/dist/infra/env/index.js +2 -8
- package/dist/infra/env/index.js.map +1 -1
- package/package.json +4 -4
- package/readme.md +3 -0
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -18
- package/dist/core/index.d.ts +0 -18
- package/dist/core/index.js.map +0 -1
- package/dist/infra/index.cjs +0 -781
- package/dist/infra/index.cjs.map +0 -1
- package/dist/infra/index.d.cts +0 -5
- package/dist/infra/index.d.ts +0 -5
- package/dist/infra/index.js +0 -752
- package/dist/infra/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/decorators/dependency-container.ts"],"sourcesContent":["import 'reflect-metadata'\n\ntype Class<T = any> = new (...args: any[]) => T\n\ntype Registration =\n | { type: 'class'; myClass: Class; singleton: boolean }\n | { type: 'value'; value: any }\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/core/decorators/dependency-container.ts"],"sourcesContent":["import 'reflect-metadata'\n\ntype Class<T = any> = new (...args: any[]) => T\n\ntype Registration =\n | { type: 'class'; myClass: Class; singleton: boolean }\n | { type: 'value'; value: any }\n\nexport class DependencyContainer {\n static registry = new Map<string, Registration>()\n static singletons = new Map<string, any>()\n\n static register<T>(\n token: string,\n myClass: Class<T>,\n options: { singleton: boolean }\n ) {\n this.registry.set(token, {\n type: 'class',\n myClass,\n singleton: options.singleton,\n })\n }\n\n static registerValue<T>(token: string, value: T) {\n this.registry.set(token, { type: 'value', value })\n }\n\n static resolve<T>(target: Class<T>): T {\n const paramTypes = Reflect.getMetadata('design:paramtypes', target) || []\n\n const injectMetadata: Record<number, string> =\n Reflect.getOwnMetadata('inject:params', target) || {}\n\n const params = paramTypes.map((_: any, index: number) => {\n const token = injectMetadata[index]\n\n if (!token) {\n throw new Error(\n `Missing @Inject token for parameter index ${index} in ${target.name}`\n )\n }\n\n return this.resolveToken(token)\n })\n\n return new target(...params)\n }\n\n static resolveToken(token: string): any {\n const registration = this.registry.get(token)\n\n if (!registration) {\n throw new Error(\n `\"${token}\" not registered. Please register it in the container.`\n )\n }\n\n if (registration.type === 'value') {\n return registration.value\n }\n\n const { myClass, singleton } = registration\n\n if (singleton) {\n if (!this.singletons.has(token)) {\n const instance = this.resolve(myClass)\n this.singletons.set(token, instance)\n }\n return this.singletons.get(token)\n }\n\n return this.resolve(myClass)\n }\n}\n\nexport function Inject(token: string): ParameterDecorator {\n return (\n target: object,\n _propertyKey: string | symbol | undefined,\n parameterIndex: number\n ): void => {\n const constructor =\n typeof target === 'function' ? target : target.constructor\n\n const existingInjectedParams: Record<number, string> =\n Reflect.getOwnMetadata('inject:params', constructor) || {}\n\n existingInjectedParams[parameterIndex] = token\n\n Reflect.defineMetadata('inject:params', existingInjectedParams, constructor)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;8BAAO;AAQA,IAAMA,sBAAN,MAAMA;EARb,OAQaA;;;EACX,OAAOC,WAAW,oBAAIC,IAAAA;EACtB,OAAOC,aAAa,oBAAID,IAAAA;EAExB,OAAOE,SACLC,OACAC,SACAC,SACA;AACA,SAAKN,SAASO,IAAIH,OAAO;MACvBI,MAAM;MACNH;MACAI,WAAWH,QAAQG;IACrB,CAAA;EACF;EAEA,OAAOC,cAAiBN,OAAeO,OAAU;AAC/C,SAAKX,SAASO,IAAIH,OAAO;MAAEI,MAAM;MAASG;IAAM,CAAA;EAClD;EAEA,OAAOC,QAAWC,QAAqB;AACrC,UAAMC,aAAaC,QAAQC,YAAY,qBAAqBH,MAAAA,KAAW,CAAA;AAEvE,UAAMI,iBACJF,QAAQG,eAAe,iBAAiBL,MAAAA,KAAW,CAAC;AAEtD,UAAMM,SAASL,WAAWM,IAAI,CAACC,GAAQC,UAAAA;AACrC,YAAMlB,QAAQa,eAAeK,KAAAA;AAE7B,UAAI,CAAClB,OAAO;AACV,cAAM,IAAImB,MACR,6CAA6CD,KAAAA,OAAYT,OAAOW,IAAI,EAAE;MAE1E;AAEA,aAAO,KAAKC,aAAarB,KAAAA;IAC3B,CAAA;AAEA,WAAO,IAAIS,OAAAA,GAAUM,MAAAA;EACvB;EAEA,OAAOM,aAAarB,OAAoB;AACtC,UAAMsB,eAAe,KAAK1B,SAAS2B,IAAIvB,KAAAA;AAEvC,QAAI,CAACsB,cAAc;AACjB,YAAM,IAAIH,MACR,IAAInB,KAAAA,wDAA6D;IAErE;AAEA,QAAIsB,aAAalB,SAAS,SAAS;AACjC,aAAOkB,aAAaf;IACtB;AAEA,UAAM,EAAEN,SAASI,UAAS,IAAKiB;AAE/B,QAAIjB,WAAW;AACb,UAAI,CAAC,KAAKP,WAAW0B,IAAIxB,KAAAA,GAAQ;AAC/B,cAAMyB,WAAW,KAAKjB,QAAQP,OAAAA;AAC9B,aAAKH,WAAWK,IAAIH,OAAOyB,QAAAA;MAC7B;AACA,aAAO,KAAK3B,WAAWyB,IAAIvB,KAAAA;IAC7B;AAEA,WAAO,KAAKQ,QAAQP,OAAAA;EACtB;AACF;AAEO,SAASyB,OAAO1B,OAAa;AAClC,SAAO,CACLS,QACAkB,cACAC,mBAAAA;AAEA,UAAMC,cACJ,OAAOpB,WAAW,aAAaA,SAASA,OAAOoB;AAEjD,UAAMC,yBACJnB,QAAQG,eAAe,iBAAiBe,WAAAA,KAAgB,CAAC;AAE3DC,2BAAuBF,cAAAA,IAAkB5B;AAEzCW,YAAQoB,eAAe,iBAAiBD,wBAAwBD,WAAAA;EAClE;AACF;AAhBgBH;","names":["DependencyContainer","registry","Map","singletons","register","token","myClass","options","set","type","singleton","registerValue","value","resolve","target","paramTypes","Reflect","getMetadata","injectMetadata","getOwnMetadata","params","map","_","index","Error","name","resolveToken","registration","get","has","instance","Inject","_propertyKey","parameterIndex","constructor","existingInjectedParams","defineMetadata"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/decorators/dependency-container.ts"],"sourcesContent":["import 'reflect-metadata'\n\ntype Class<T = any> = new (...args: any[]) => T\n\ntype Registration =\n | { type: 'class'; myClass: Class; singleton: boolean }\n | { type: 'value'; value: any }\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/core/decorators/dependency-container.ts"],"sourcesContent":["import 'reflect-metadata'\n\ntype Class<T = any> = new (...args: any[]) => T\n\ntype Registration =\n | { type: 'class'; myClass: Class; singleton: boolean }\n | { type: 'value'; value: any }\n\nexport class DependencyContainer {\n static registry = new Map<string, Registration>()\n static singletons = new Map<string, any>()\n\n static register<T>(\n token: string,\n myClass: Class<T>,\n options: { singleton: boolean }\n ) {\n this.registry.set(token, {\n type: 'class',\n myClass,\n singleton: options.singleton,\n })\n }\n\n static registerValue<T>(token: string, value: T) {\n this.registry.set(token, { type: 'value', value })\n }\n\n static resolve<T>(target: Class<T>): T {\n const paramTypes = Reflect.getMetadata('design:paramtypes', target) || []\n\n const injectMetadata: Record<number, string> =\n Reflect.getOwnMetadata('inject:params', target) || {}\n\n const params = paramTypes.map((_: any, index: number) => {\n const token = injectMetadata[index]\n\n if (!token) {\n throw new Error(\n `Missing @Inject token for parameter index ${index} in ${target.name}`\n )\n }\n\n return this.resolveToken(token)\n })\n\n return new target(...params)\n }\n\n static resolveToken(token: string): any {\n const registration = this.registry.get(token)\n\n if (!registration) {\n throw new Error(\n `\"${token}\" not registered. Please register it in the container.`\n )\n }\n\n if (registration.type === 'value') {\n return registration.value\n }\n\n const { myClass, singleton } = registration\n\n if (singleton) {\n if (!this.singletons.has(token)) {\n const instance = this.resolve(myClass)\n this.singletons.set(token, instance)\n }\n return this.singletons.get(token)\n }\n\n return this.resolve(myClass)\n }\n}\n\nexport function Inject(token: string): ParameterDecorator {\n return (\n target: object,\n _propertyKey: string | symbol | undefined,\n parameterIndex: number\n ): void => {\n const constructor =\n typeof target === 'function' ? target : target.constructor\n\n const existingInjectedParams: Record<number, string> =\n Reflect.getOwnMetadata('inject:params', constructor) || {}\n\n existingInjectedParams[parameterIndex] = token\n\n Reflect.defineMetadata('inject:params', existingInjectedParams, constructor)\n }\n}\n"],"mappings":";;;;AAAA,OAAO;AAQA,IAAMA,sBAAN,MAAMA;EARb,OAQaA;;;EACX,OAAOC,WAAW,oBAAIC,IAAAA;EACtB,OAAOC,aAAa,oBAAID,IAAAA;EAExB,OAAOE,SACLC,OACAC,SACAC,SACA;AACA,SAAKN,SAASO,IAAIH,OAAO;MACvBI,MAAM;MACNH;MACAI,WAAWH,QAAQG;IACrB,CAAA;EACF;EAEA,OAAOC,cAAiBN,OAAeO,OAAU;AAC/C,SAAKX,SAASO,IAAIH,OAAO;MAAEI,MAAM;MAASG;IAAM,CAAA;EAClD;EAEA,OAAOC,QAAWC,QAAqB;AACrC,UAAMC,aAAaC,QAAQC,YAAY,qBAAqBH,MAAAA,KAAW,CAAA;AAEvE,UAAMI,iBACJF,QAAQG,eAAe,iBAAiBL,MAAAA,KAAW,CAAC;AAEtD,UAAMM,SAASL,WAAWM,IAAI,CAACC,GAAQC,UAAAA;AACrC,YAAMlB,QAAQa,eAAeK,KAAAA;AAE7B,UAAI,CAAClB,OAAO;AACV,cAAM,IAAImB,MACR,6CAA6CD,KAAAA,OAAYT,OAAOW,IAAI,EAAE;MAE1E;AAEA,aAAO,KAAKC,aAAarB,KAAAA;IAC3B,CAAA;AAEA,WAAO,IAAIS,OAAAA,GAAUM,MAAAA;EACvB;EAEA,OAAOM,aAAarB,OAAoB;AACtC,UAAMsB,eAAe,KAAK1B,SAAS2B,IAAIvB,KAAAA;AAEvC,QAAI,CAACsB,cAAc;AACjB,YAAM,IAAIH,MACR,IAAInB,KAAAA,wDAA6D;IAErE;AAEA,QAAIsB,aAAalB,SAAS,SAAS;AACjC,aAAOkB,aAAaf;IACtB;AAEA,UAAM,EAAEN,SAASI,UAAS,IAAKiB;AAE/B,QAAIjB,WAAW;AACb,UAAI,CAAC,KAAKP,WAAW0B,IAAIxB,KAAAA,GAAQ;AAC/B,cAAMyB,WAAW,KAAKjB,QAAQP,OAAAA;AAC9B,aAAKH,WAAWK,IAAIH,OAAOyB,QAAAA;MAC7B;AACA,aAAO,KAAK3B,WAAWyB,IAAIvB,KAAAA;IAC7B;AAEA,WAAO,KAAKQ,QAAQP,OAAAA;EACtB;AACF;AAEO,SAASyB,OAAO1B,OAAa;AAClC,SAAO,CACLS,QACAkB,cACAC,mBAAAA;AAEA,UAAMC,cACJ,OAAOpB,WAAW,aAAaA,SAASA,OAAOoB;AAEjD,UAAMC,yBACJnB,QAAQG,eAAe,iBAAiBe,WAAAA,KAAgB,CAAC;AAE3DC,2BAAuBF,cAAAA,IAAkB5B;AAEzCW,YAAQoB,eAAe,iBAAiBD,wBAAwBD,WAAAA;EAClE;AACF;AAhBgBH;","names":["DependencyContainer","registry","Map","singletons","register","token","myClass","options","set","type","singleton","registerValue","value","resolve","target","paramTypes","Reflect","getMetadata","injectMetadata","getOwnMetadata","params","map","_","index","Error","name","resolveToken","registration","get","has","instance","Inject","_propertyKey","parameterIndex","constructor","existingInjectedParams","defineMetadata"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/aggregate-root.ts","../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/aggregate-root.ts","../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts"],"sourcesContent":["import { Entity } from './entity'\n\nexport abstract class AggregateRoot<Props> extends Entity<Props> {}\n","import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\ntype PropsWithCommonDTO<Props> = Props & CommonDTO\n\nexport abstract class Entity<Props> {\n private _id: UniqueEntityId\n protected props: PropsWithCommonDTO<Props>\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: PropsWithCommonDTO<Props>, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,yBAA2B;AAEpB,IAAMA,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,aAASE,+BAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;;;ACfO,IAAeG,SAAf,MAAeA;EAJtB,OAIsBA;;;EACZC;EACEC;EAEV,IAAIC,KAAK;AACP,WAAO,KAAKF;EACd;EAEA,IAAIE,GAAGA,IAAoB;AACzB,SAAKF,MAAME;EACb;EAEA,IAAIC,YAAY;AACd,WAAO,KAAKF,MAAME;EACpB;EAEA,IAAIA,UAAUC,MAAY;AACxB,SAAKH,MAAME,YAAYC;EACzB;EAEA,IAAIC,YAAqC;AACvC,WAAO,KAAKJ,MAAMI;EACpB;EAEOC,QAAQ;AACb,SAAKL,MAAMI,YAAY,oBAAIE,KAAAA;EAC7B;EAEA,YAAsBN,OAAkCC,IAAqB;AAC3E,SAAKF,MAAME,MAAM,IAAIM,eAAeN,EAAAA;AACpC,SAAKD,QAAQA;EACf;EAEOQ,OAAOC,QAAqB;AACjC,QAAIA,WAAW,MAAM;AACnB,aAAO;IACT;AAEA,QAAIA,OAAOR,OAAO,KAAKF,KAAK;AAC1B,aAAO;IACT;AAEA,WAAO;EACT;AACF;;;AF/CO,IAAeW,gBAAf,cAA4CC,OAAAA;EAFnD,OAEmDA;;;AAAe;","names":["UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity","AggregateRoot","Entity"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CommonDTO } from './common-dto.cjs';
|
|
2
1
|
import { Entity } from './entity.cjs';
|
|
2
|
+
import './common-dto.cjs';
|
|
3
3
|
import './unique-entity-id.cjs';
|
|
4
4
|
|
|
5
|
-
declare abstract class AggregateRoot<Props
|
|
5
|
+
declare abstract class AggregateRoot<Props> extends Entity<Props> {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { AggregateRoot };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CommonDTO } from './common-dto.js';
|
|
2
1
|
import { Entity } from './entity.js';
|
|
2
|
+
import './common-dto.js';
|
|
3
3
|
import './unique-entity-id.js';
|
|
4
4
|
|
|
5
|
-
declare abstract class AggregateRoot<Props
|
|
5
|
+
declare abstract class AggregateRoot<Props> extends Entity<Props> {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export { AggregateRoot };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts","../../../src/core/entities/aggregate-root.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\nexport abstract class Entity<Props
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts","../../../src/core/entities/aggregate-root.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\ntype PropsWithCommonDTO<Props> = Props & CommonDTO\n\nexport abstract class Entity<Props> {\n private _id: UniqueEntityId\n protected props: PropsWithCommonDTO<Props>\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: PropsWithCommonDTO<Props>, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n","import { Entity } from './entity'\n\nexport abstract class AggregateRoot<Props> extends Entity<Props> {}\n"],"mappings":";;;;AAAA,SAASA,kBAAkB;AAEpB,IAAMC,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,SAASE,WAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;;;ACfO,IAAeG,SAAf,MAAeA;EAJtB,OAIsBA;;;EACZC;EACEC;EAEV,IAAIC,KAAK;AACP,WAAO,KAAKF;EACd;EAEA,IAAIE,GAAGA,IAAoB;AACzB,SAAKF,MAAME;EACb;EAEA,IAAIC,YAAY;AACd,WAAO,KAAKF,MAAME;EACpB;EAEA,IAAIA,UAAUC,MAAY;AACxB,SAAKH,MAAME,YAAYC;EACzB;EAEA,IAAIC,YAAqC;AACvC,WAAO,KAAKJ,MAAMI;EACpB;EAEOC,QAAQ;AACb,SAAKL,MAAMI,YAAY,oBAAIE,KAAAA;EAC7B;EAEA,YAAsBN,OAAkCC,IAAqB;AAC3E,SAAKF,MAAME,MAAM,IAAIM,eAAeN,EAAAA;AACpC,SAAKD,QAAQA;EACf;EAEOQ,OAAOC,QAAqB;AACjC,QAAIA,WAAW,MAAM;AACnB,aAAO;IACT;AAEA,QAAIA,OAAOR,OAAO,KAAKF,KAAK;AAC1B,aAAO;IACT;AAEA,WAAO;EACT;AACF;;;AC/CO,IAAeW,gBAAf,cAA4CC,OAAAA;EAFnD,OAEmDA;;;AAAe;","names":["randomUUID","UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity","AggregateRoot","Entity"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/common-dto.ts"],"sourcesContent":["export type CommonDTO = {\n createdAt: Date\n updatedAt
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/common-dto.ts"],"sourcesContent":["export type CommonDTO = {\n createdAt: Date\n updatedAt: Date | null\n}\n\nexport type CreateCommonDTO = {\n createdAt?: Date\n updatedAt?: Date | null\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAKA;;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/entity.ts","../../../src/core/entities/unique-entity-id.ts"],"sourcesContent":["import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\nexport abstract class Entity<Props
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/entity.ts","../../../src/core/entities/unique-entity-id.ts"],"sourcesContent":["import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\ntype PropsWithCommonDTO<Props> = Props & CommonDTO\n\nexport abstract class Entity<Props> {\n private _id: UniqueEntityId\n protected props: PropsWithCommonDTO<Props>\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: PropsWithCommonDTO<Props>, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n","import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;ACDA,yBAA2B;AAEpB,IAAMA,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,aAASE,+BAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;;;ADfO,IAAeG,SAAf,MAAeA;EAJtB,OAIsBA;;;EACZC;EACEC;EAEV,IAAIC,KAAK;AACP,WAAO,KAAKF;EACd;EAEA,IAAIE,GAAGA,IAAoB;AACzB,SAAKF,MAAME;EACb;EAEA,IAAIC,YAAY;AACd,WAAO,KAAKF,MAAME;EACpB;EAEA,IAAIA,UAAUC,MAAY;AACxB,SAAKH,MAAME,YAAYC;EACzB;EAEA,IAAIC,YAAqC;AACvC,WAAO,KAAKJ,MAAMI;EACpB;EAEOC,QAAQ;AACb,SAAKL,MAAMI,YAAY,oBAAIE,KAAAA;EAC7B;EAEA,YAAsBN,OAAkCC,IAAqB;AAC3E,SAAKF,MAAME,MAAM,IAAIM,eAAeN,EAAAA;AACpC,SAAKD,QAAQA;EACf;EAEOQ,OAAOC,QAAqB;AACjC,QAAIA,WAAW,MAAM;AACnB,aAAO;IACT;AAEA,QAAIA,OAAOR,OAAO,KAAKF,KAAK;AAC1B,aAAO;IACT;AAEA,WAAO;EACT;AACF;","names":["UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity"]}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { CommonDTO } from './common-dto.cjs';
|
|
2
2
|
import { UniqueEntityId } from './unique-entity-id.cjs';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type PropsWithCommonDTO<Props> = Props & CommonDTO;
|
|
5
|
+
declare abstract class Entity<Props> {
|
|
5
6
|
private _id;
|
|
6
|
-
protected props: Props
|
|
7
|
+
protected props: PropsWithCommonDTO<Props>;
|
|
7
8
|
get id(): UniqueEntityId;
|
|
8
9
|
set id(id: UniqueEntityId);
|
|
9
10
|
get createdAt(): Date;
|
|
10
11
|
set createdAt(date: Date);
|
|
11
12
|
get updatedAt(): Date | undefined | null;
|
|
12
13
|
touch(): void;
|
|
13
|
-
protected constructor(props: Props
|
|
14
|
+
protected constructor(props: PropsWithCommonDTO<Props>, id?: UniqueEntityId);
|
|
14
15
|
equals(entity: Entity<any>): boolean;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { CommonDTO } from './common-dto.js';
|
|
2
2
|
import { UniqueEntityId } from './unique-entity-id.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type PropsWithCommonDTO<Props> = Props & CommonDTO;
|
|
5
|
+
declare abstract class Entity<Props> {
|
|
5
6
|
private _id;
|
|
6
|
-
protected props: Props
|
|
7
|
+
protected props: PropsWithCommonDTO<Props>;
|
|
7
8
|
get id(): UniqueEntityId;
|
|
8
9
|
set id(id: UniqueEntityId);
|
|
9
10
|
get createdAt(): Date;
|
|
10
11
|
set createdAt(date: Date);
|
|
11
12
|
get updatedAt(): Date | undefined | null;
|
|
12
13
|
touch(): void;
|
|
13
|
-
protected constructor(props: Props
|
|
14
|
+
protected constructor(props: PropsWithCommonDTO<Props>, id?: UniqueEntityId);
|
|
14
15
|
equals(entity: Entity<any>): boolean;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\nexport abstract class Entity<Props
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/unique-entity-id.ts","../../../src/core/entities/entity.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\n\nexport class UniqueEntityId {\n private value: string\n\n constructor(value?: string) {\n this.value = value ?? randomUUID()\n }\n\n toString() {\n return this.value\n }\n\n toValue() {\n return this.value\n }\n\n public equals(id: UniqueEntityId) {\n return id.toValue() === this.toValue()\n }\n}\n","import { CommonDTO } from './common-dto'\nimport { UniqueEntityId } from './unique-entity-id'\n\ntype PropsWithCommonDTO<Props> = Props & CommonDTO\n\nexport abstract class Entity<Props> {\n private _id: UniqueEntityId\n protected props: PropsWithCommonDTO<Props>\n\n get id() {\n return this._id\n }\n\n set id(id: UniqueEntityId) {\n this._id = id\n }\n\n get createdAt() {\n return this.props.createdAt\n }\n\n set createdAt(date: Date) {\n this.props.createdAt = date\n }\n\n get updatedAt(): Date | undefined | null {\n return this.props.updatedAt\n }\n\n public touch() {\n this.props.updatedAt = new Date()\n }\n\n protected constructor(props: PropsWithCommonDTO<Props>, id?: UniqueEntityId) {\n this._id = id ?? new UniqueEntityId(id)\n this.props = props\n }\n\n public equals(entity: Entity<any>) {\n if (entity === this) {\n return true\n }\n\n if (entity.id === this._id) {\n return true\n }\n\n return false\n }\n}\n"],"mappings":";;;;AAAA,SAASA,kBAAkB;AAEpB,IAAMC,iBAAN,MAAMA;EAFb,OAEaA;;;EACHC;EAERC,YAAYD,OAAgB;AAC1B,SAAKA,QAAQA,SAASE,WAAAA;EACxB;EAEAC,WAAW;AACT,WAAO,KAAKH;EACd;EAEAI,UAAU;AACR,WAAO,KAAKJ;EACd;EAEOK,OAAOC,IAAoB;AAChC,WAAOA,GAAGF,QAAO,MAAO,KAAKA,QAAO;EACtC;AACF;;;ACfO,IAAeG,SAAf,MAAeA;EAJtB,OAIsBA;;;EACZC;EACEC;EAEV,IAAIC,KAAK;AACP,WAAO,KAAKF;EACd;EAEA,IAAIE,GAAGA,IAAoB;AACzB,SAAKF,MAAME;EACb;EAEA,IAAIC,YAAY;AACd,WAAO,KAAKF,MAAME;EACpB;EAEA,IAAIA,UAAUC,MAAY;AACxB,SAAKH,MAAME,YAAYC;EACzB;EAEA,IAAIC,YAAqC;AACvC,WAAO,KAAKJ,MAAMI;EACpB;EAEOC,QAAQ;AACb,SAAKL,MAAMI,YAAY,oBAAIE,KAAAA;EAC7B;EAEA,YAAsBN,OAAkCC,IAAqB;AAC3E,SAAKF,MAAME,MAAM,IAAIM,eAAeN,EAAAA;AACpC,SAAKD,QAAQA;EACf;EAEOQ,OAAOC,QAAqB;AACjC,QAAIA,WAAW,MAAM;AACnB,aAAO;IACT;AAEA,QAAIA,OAAOR,OAAO,KAAKF,KAAK;AAC1B,aAAO;IACT;AAEA,WAAO;EACT;AACF;","names":["randomUUID","UniqueEntityId","value","constructor","randomUUID","toString","toValue","equals","id","Entity","_id","props","id","createdAt","date","updatedAt","touch","Date","UniqueEntityId","equals","entity"]}
|