@imolko/ultra-ddd 1.0.34-beta → 1.0.35
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-browser/event/domain-event/domain-event-base.class.d.ts +22 -22
- package/dist-browser/event/domain-event/domain-event-base.class.d.ts.map +1 -1
- package/dist-browser/event/domain-event/domain-event-base.class.js +43 -34
- package/dist-browser/event/domain-event/domain-event-base.class.js.map +1 -1
- package/dist-browser/event/use-samples/nested-event/definition.d.ts +6 -0
- package/dist-browser/event/use-samples/nested-event/definition.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/definition.js +27 -0
- package/dist-browser/event/use-samples/nested-event/definition.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/event.d.ts +11 -0
- package/dist-browser/event/use-samples/nested-event/event.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/event.js +23 -0
- package/dist-browser/event/use-samples/nested-event/event.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/helpers/event-definition.type.d.ts +13 -0
- package/dist-browser/event/use-samples/nested-event/helpers/event-definition.type.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/helpers/event-definition.type.js +2 -0
- package/dist-browser/event/use-samples/nested-event/helpers/event-definition.type.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/helpers/payload.d.ts +13 -0
- package/dist-browser/event/use-samples/nested-event/helpers/payload.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/helpers/payload.js +2 -0
- package/dist-browser/event/use-samples/nested-event/helpers/payload.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/helpers/shape-evolution-map.type.d.ts +22 -0
- package/dist-browser/event/use-samples/nested-event/helpers/shape-evolution-map.type.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/helpers/shape-evolution-map.type.js +2 -0
- package/dist-browser/event/use-samples/nested-event/helpers/shape-evolution-map.type.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/index.d.ts +6 -0
- package/dist-browser/event/use-samples/nested-event/index.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/index.js +2 -0
- package/dist-browser/event/use-samples/nested-event/index.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/security-token.d.ts +8 -0
- package/dist-browser/event/use-samples/nested-event/security-token.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/security-token.js +8 -0
- package/dist-browser/event/use-samples/nested-event/security-token.js.map +1 -0
- package/dist-browser/event/use-samples/nested-event/shape-evolution.d.ts +275 -0
- package/dist-browser/event/use-samples/nested-event/shape-evolution.d.ts.map +1 -0
- package/dist-browser/event/use-samples/nested-event/shape-evolution.js +74 -0
- package/dist-browser/event/use-samples/nested-event/shape-evolution.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/aggregate.d.ts +390 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/aggregate.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/aggregate.js +91 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/aggregate.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/entity.d.ts +313 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/entity.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/entity.js +90 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/entity.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/index.d.ts +4 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/index.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/index.js +4 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/index.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/value-object.d.ts +141 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/value-object.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/value-object.js +76 -0
- package/dist-browser/event/use-samples/validated-artifact/artifacts/value-object.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/definition.d.ts +6 -0
- package/dist-browser/event/use-samples/validated-artifact/definition.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/definition.js +27 -0
- package/dist-browser/event/use-samples/validated-artifact/definition.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/event.d.ts +11 -0
- package/dist-browser/event/use-samples/validated-artifact/event.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/event.js +23 -0
- package/dist-browser/event/use-samples/validated-artifact/event.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/event-definition.type.d.ts +13 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/event-definition.type.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/event-definition.type.js +2 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/event-definition.type.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/payload.d.ts +13 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/payload.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/payload.js +2 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/payload.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.d.ts +22 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.js +2 -0
- package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/index.d.ts +6 -0
- package/dist-browser/event/use-samples/validated-artifact/index.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/index.js +2 -0
- package/dist-browser/event/use-samples/validated-artifact/index.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/security-token.d.ts +8 -0
- package/dist-browser/event/use-samples/validated-artifact/security-token.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/security-token.js +9 -0
- package/dist-browser/event/use-samples/validated-artifact/security-token.js.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/shape-evolution.d.ts +148 -0
- package/dist-browser/event/use-samples/validated-artifact/shape-evolution.d.ts.map +1 -0
- package/dist-browser/event/use-samples/validated-artifact/shape-evolution.js +63 -0
- package/dist-browser/event/use-samples/validated-artifact/shape-evolution.js.map +1 -0
- package/dist-node/event/domain-event/domain-event-base.class.d.ts +22 -22
- package/dist-node/event/domain-event/domain-event-base.class.d.ts.map +1 -1
- package/dist-node/event/domain-event/domain-event-base.class.js +35 -26
- package/dist-node/event/domain-event/domain-event-base.class.js.map +1 -1
- package/dist-node/event/use-samples/nested-event/definition.d.ts +6 -0
- package/dist-node/event/use-samples/nested-event/definition.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/definition.js +30 -0
- package/dist-node/event/use-samples/nested-event/definition.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/event.d.ts +11 -0
- package/dist-node/event/use-samples/nested-event/event.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/event.js +26 -0
- package/dist-node/event/use-samples/nested-event/event.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/helpers/event-definition.type.d.ts +13 -0
- package/dist-node/event/use-samples/nested-event/helpers/event-definition.type.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/helpers/event-definition.type.js +3 -0
- package/dist-node/event/use-samples/nested-event/helpers/event-definition.type.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/helpers/payload.d.ts +13 -0
- package/dist-node/event/use-samples/nested-event/helpers/payload.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/helpers/payload.js +3 -0
- package/dist-node/event/use-samples/nested-event/helpers/payload.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/helpers/shape-evolution-map.type.d.ts +22 -0
- package/dist-node/event/use-samples/nested-event/helpers/shape-evolution-map.type.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/helpers/shape-evolution-map.type.js +3 -0
- package/dist-node/event/use-samples/nested-event/helpers/shape-evolution-map.type.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/index.d.ts +6 -0
- package/dist-node/event/use-samples/nested-event/index.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/index.js +6 -0
- package/dist-node/event/use-samples/nested-event/index.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/security-token.d.ts +8 -0
- package/dist-node/event/use-samples/nested-event/security-token.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/security-token.js +11 -0
- package/dist-node/event/use-samples/nested-event/security-token.js.map +1 -0
- package/dist-node/event/use-samples/nested-event/shape-evolution.d.ts +275 -0
- package/dist-node/event/use-samples/nested-event/shape-evolution.d.ts.map +1 -0
- package/dist-node/event/use-samples/nested-event/shape-evolution.js +77 -0
- package/dist-node/event/use-samples/nested-event/shape-evolution.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/aggregate.d.ts +390 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/aggregate.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/aggregate.js +92 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/aggregate.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/entity.d.ts +313 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/entity.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/entity.js +91 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/entity.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/index.d.ts +4 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/index.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/index.js +20 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/index.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/value-object.d.ts +141 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/value-object.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/value-object.js +77 -0
- package/dist-node/event/use-samples/validated-artifact/artifacts/value-object.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/definition.d.ts +6 -0
- package/dist-node/event/use-samples/validated-artifact/definition.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/definition.js +30 -0
- package/dist-node/event/use-samples/validated-artifact/definition.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/event.d.ts +11 -0
- package/dist-node/event/use-samples/validated-artifact/event.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/event.js +26 -0
- package/dist-node/event/use-samples/validated-artifact/event.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/event-definition.type.d.ts +13 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/event-definition.type.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/event-definition.type.js +3 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/event-definition.type.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/payload.d.ts +13 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/payload.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/payload.js +3 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/payload.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.d.ts +22 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.js +3 -0
- package/dist-node/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/index.d.ts +6 -0
- package/dist-node/event/use-samples/validated-artifact/index.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/index.js +6 -0
- package/dist-node/event/use-samples/validated-artifact/index.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/security-token.d.ts +8 -0
- package/dist-node/event/use-samples/validated-artifact/security-token.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/security-token.js +12 -0
- package/dist-node/event/use-samples/validated-artifact/security-token.js.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/shape-evolution.d.ts +148 -0
- package/dist-node/event/use-samples/validated-artifact/shape-evolution.d.ts.map +1 -0
- package/dist-node/event/use-samples/validated-artifact/shape-evolution.js +66 -0
- package/dist-node/event/use-samples/validated-artifact/shape-evolution.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EventScope } from '../../domain-event';
|
|
2
|
+
import { SECURITY_TOKEN } from './security-token';
|
|
3
|
+
import { shapeEvolution } from './shape-evolution';
|
|
4
|
+
/**
|
|
5
|
+
* Parámetros para la definición del Evento.
|
|
6
|
+
*/
|
|
7
|
+
export const definition = {
|
|
8
|
+
/** Ambito del evento. Puede ser local o global */
|
|
9
|
+
scope: EventScope.GLOBAL,
|
|
10
|
+
/** Token para firmar los eventos serializados */
|
|
11
|
+
securityToken: SECURITY_TOKEN,
|
|
12
|
+
/** Título descriptivo del evento */
|
|
13
|
+
title: 'Valida un artefacto del dominio',
|
|
14
|
+
/** Id del evento */
|
|
15
|
+
eventName: 'validated-artifact',
|
|
16
|
+
/** Aplicación que emite el evento */
|
|
17
|
+
emitterApp: 'landlord',
|
|
18
|
+
/** Nombre del agregado que emite el evento */
|
|
19
|
+
aggregateName: 'artifact',
|
|
20
|
+
/** Tipo de la información en el campo data */
|
|
21
|
+
dataContentType: 'application/json',
|
|
22
|
+
/** Owner del evento */
|
|
23
|
+
eventOwner: 'com.imolko',
|
|
24
|
+
/** Historia de los formatos utilizados en la data */
|
|
25
|
+
shapeHistory: shapeEvolution
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAoB;IACzC,mDAAmD;IACnD,KAAK,EAAE,UAAU,CAAC,MAAM;IACxB,iDAAiD;IACjD,aAAa,EAAE,cAAc;IAC7B,oCAAoC;IACpC,KAAK,EAAE,iCAAiC;IACxC,oBAAoB;IACpB,SAAS,EAAE,oBAAoB;IAC/B,qCAAqC;IACrC,UAAU,EAAE,UAAU;IACtB,8CAA8C;IAC9C,aAAa,EAAE,UAAU;IACzB,8CAA8C;IAC9C,eAAe,EAAE,kBAAkB;IACnC,uBAAuB;IACvB,UAAU,EAAE,YAAY;IACxB,qDAAqD;IACrD,YAAY,EAAE,cAAc;CAC7B,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const ValidatedArtifact_base: typeof import("../../domain-event/domain-event-base.class").DomainEventBase;
|
|
2
|
+
/**
|
|
3
|
+
* Clase del evento.
|
|
4
|
+
*
|
|
5
|
+
* Ofrece los métodos para producir e hidratar eventos serializados.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ValidatedArtifact extends ValidatedArtifact_base {
|
|
8
|
+
static NAME: string;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/event.ts"],"names":[],"mappings":";AAIA;;;;GAIG;AACH,qBAGa,iBAAkB,SAAQ,sBAA8B;IACnE,MAAM,CAAC,IAAI,SAAmB;CAC/B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { DomainEventFactory, RegisterEvent } from '../../domain-event';
|
|
8
|
+
import { definition } from './definition';
|
|
9
|
+
/**
|
|
10
|
+
* Clase del evento.
|
|
11
|
+
*
|
|
12
|
+
* Ofrece los métodos para producir e hidratar eventos serializados.
|
|
13
|
+
*/
|
|
14
|
+
let ValidatedArtifact = class ValidatedArtifact extends DomainEventFactory(definition) {
|
|
15
|
+
};
|
|
16
|
+
ValidatedArtifact.NAME = 'valid-artifact';
|
|
17
|
+
ValidatedArtifact = __decorate([
|
|
18
|
+
RegisterEvent({
|
|
19
|
+
description: 'Valida artefactos'
|
|
20
|
+
})
|
|
21
|
+
], ValidatedArtifact);
|
|
22
|
+
export { ValidatedArtifact };
|
|
23
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/event.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;GAIG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,kBAAkB,CAAC,UAAU,CAAC;;AAC5D,sBAAI,GAAG,gBAAgB,AAAnB,CAAmB;AADnB,iBAAiB;IAH7B,aAAa,CAAC;QACb,WAAW,EAAE,mBAAmB;KACjC,CAAC;GACW,iBAAiB,CAE7B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EventDefinitionPayload } from '../../../domain-event';
|
|
2
|
+
import { shapeEvolution } from '../shape-evolution';
|
|
3
|
+
/**
|
|
4
|
+
* Definición del evento con los tipos específicos
|
|
5
|
+
* para la evolución de los Shapes.
|
|
6
|
+
*
|
|
7
|
+
* Al utilizar este tipo se cuenta con tipeado
|
|
8
|
+
* específico para cada versión de Shapes.
|
|
9
|
+
*/
|
|
10
|
+
export type EventDefinition = Omit<EventDefinitionPayload, 'shapeHistory'> & {
|
|
11
|
+
shapeHistory: typeof shapeEvolution;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=event-definition.type.d.ts.map
|
package/dist-browser/event/use-samples/validated-artifact/helpers/event-definition.type.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-definition.type.d.ts","sourceRoot":"","sources":["../../../../../src/event/use-samples/validated-artifact/helpers/event-definition.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,GAAG;IAC3E,YAAY,EAAE,OAAO,cAAc,CAAA;CACpC,CAAA"}
|
package/dist-browser/event/use-samples/validated-artifact/helpers/event-definition.type.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-definition.type.js","sourceRoot":"","sources":["../../../../../src/event/use-samples/validated-artifact/helpers/event-definition.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OcurrencePayload } from '../../../domain-event';
|
|
2
|
+
import { LastShapeVersion } from '../shape-evolution';
|
|
3
|
+
import { ShapeMap } from './shape-evolution-map.type';
|
|
4
|
+
/**
|
|
5
|
+
* Con el mapa de versiones soportadas se construye un tipo para las ocurrencias
|
|
6
|
+
* que recibe como parámetro la versión requerida de las versiones disponibles
|
|
7
|
+
*
|
|
8
|
+
* Esto permite que se pueda usar Payload<version> para seleccionar una versión específica.
|
|
9
|
+
*
|
|
10
|
+
* Si se omite, el payload utilizado corresponde con el LastShapeVersion definido
|
|
11
|
+
*/
|
|
12
|
+
export type Payload<Version extends keyof ShapeMap = LastShapeVersion> = OcurrencePayload<ShapeMap, Version>;
|
|
13
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../../../src/event/use-samples/validated-artifact/helpers/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,CACjB,OAAO,SAAS,MAAM,QAAQ,GAAG,gBAAgB,IAC/C,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../../../src/event/use-samples/validated-artifact/helpers/payload.ts"],"names":[],"mappings":""}
|
package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ShapeVersionMap, ShapeVersionMapProps } from '../../../domain-event';
|
|
2
|
+
import { definition } from '../definition';
|
|
3
|
+
/**
|
|
4
|
+
* Dado una versión específica de un ShapeEvolution,
|
|
5
|
+
* se construye un mapa con todas las versiones soportadas y sus condiciones.
|
|
6
|
+
*
|
|
7
|
+
* Este mapa contiene los payloads de cada version.
|
|
8
|
+
*
|
|
9
|
+
* Se incluye la versión inicial y todas las que se encuentren en evolution
|
|
10
|
+
*/
|
|
11
|
+
export type ShapeMap = ShapeVersionMap<typeof definition.shapeHistory>;
|
|
12
|
+
/**
|
|
13
|
+
* Dado una versión específica de un ShapeEvolution,
|
|
14
|
+
* se construye un mapa con todas las versiones soportadas y sus condiciones.
|
|
15
|
+
*
|
|
16
|
+
* Este mapa contiene los props de cada version.
|
|
17
|
+
* Se utiliza para tipear el contenido del campo data específico de cada version.
|
|
18
|
+
*
|
|
19
|
+
* Se incluye la versión inicial y todas las que se encuentren en evolution
|
|
20
|
+
*/
|
|
21
|
+
export type ShapeMapProps = ShapeVersionMapProps<typeof definition.shapeHistory>;
|
|
22
|
+
//# sourceMappingURL=shape-evolution-map.type.d.ts.map
|
package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-evolution-map.type.d.ts","sourceRoot":"","sources":["../../../../../src/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC"}
|
package/dist-browser/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-evolution-map.type.js","sourceRoot":"","sources":["../../../../../src/event/use-samples/validated-artifact/helpers/shape-evolution-map.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ValidatedArtifact } from './event';
|
|
2
|
+
export { Payload as ValidatedArtifactPayload } from './helpers/payload';
|
|
3
|
+
export { ShapeMap as ValidatedArtifactShapeMap } from './helpers/shape-evolution-map.type';
|
|
4
|
+
export { ShapeMapProps as ValidatedArtifactShapeMapProps } from './helpers/shape-evolution-map.type';
|
|
5
|
+
export { EventDefinition as ValidatedArtifactDefinition } from './helpers/event-definition.type';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,QAAQ,IAAI,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,aAAa,IAAI,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACrG,OAAO,EAAE,eAAe,IAAI,2BAA2B,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token de seguridad utilizdo para firmar eventos serializados.
|
|
3
|
+
*
|
|
4
|
+
* Debe mantenerse constante para el evento,
|
|
5
|
+
* ya que los eventos serializados serán verificados con esta firma.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SECURITY_TOKEN = "3dc4be1b-f9d2-4a2b-bb0b-f15fe61c16d7";
|
|
8
|
+
//# sourceMappingURL=security-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-token.d.ts","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/security-token.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token de seguridad utilizdo para firmar eventos serializados.
|
|
3
|
+
*
|
|
4
|
+
* Debe mantenerse constante para el evento,
|
|
5
|
+
* ya que los eventos serializados serán verificados con esta firma.
|
|
6
|
+
*/
|
|
7
|
+
export const SECURITY_TOKEN = '3dc4be1b-f9d2-4a2b-bb0b-f15fe61c16d7';
|
|
8
|
+
;
|
|
9
|
+
//# sourceMappingURL=security-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-token.js","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/security-token.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { z } from "@imolko/ultra-v8n";
|
|
2
|
+
import { Invoice, InvoiceName } from "./artifacts";
|
|
3
|
+
/**
|
|
4
|
+
* Definición de los shapes que definen la data del evento.
|
|
5
|
+
*
|
|
6
|
+
* Este es el único sitio dónde se almacena la definición
|
|
7
|
+
* de la data de los eventos, por tanto, no se deben
|
|
8
|
+
* eliminar versiones ya publicadas.
|
|
9
|
+
*
|
|
10
|
+
* Sólo se deben agregar nuevas versiones.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Primer shape utilizado para la data
|
|
14
|
+
* Se debe utilizar la versión con la clausula "as const"
|
|
15
|
+
* para que Typescript entienda que son tipos específicos inmutables.
|
|
16
|
+
*/
|
|
17
|
+
export declare const shape_1: {
|
|
18
|
+
version: "1.0.0";
|
|
19
|
+
conditions: z.ZodObject<{
|
|
20
|
+
invoice: z.ZodType<Invoice, z.ZodTypeDef, {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
age: number;
|
|
24
|
+
}>;
|
|
25
|
+
name: z.ZodType<InvoiceName, z.ZodTypeDef, string>;
|
|
26
|
+
user: z.ZodObject<{
|
|
27
|
+
name: z.ZodType<InvoiceName, z.ZodTypeDef, string>;
|
|
28
|
+
age: z.ZodNumber;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
name: InvoiceName;
|
|
31
|
+
age: number;
|
|
32
|
+
}, {
|
|
33
|
+
name: string;
|
|
34
|
+
age: number;
|
|
35
|
+
}>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
name: InvoiceName;
|
|
38
|
+
user: {
|
|
39
|
+
name: InvoiceName;
|
|
40
|
+
age: number;
|
|
41
|
+
};
|
|
42
|
+
invoice: Invoice;
|
|
43
|
+
}, {
|
|
44
|
+
name: string;
|
|
45
|
+
user: {
|
|
46
|
+
name: string;
|
|
47
|
+
age: number;
|
|
48
|
+
};
|
|
49
|
+
invoice: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
age: number;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
sampleData: {
|
|
56
|
+
invoice: {
|
|
57
|
+
name: string;
|
|
58
|
+
age: number;
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
name: string;
|
|
62
|
+
user: {
|
|
63
|
+
name: string;
|
|
64
|
+
age: number;
|
|
65
|
+
};
|
|
66
|
+
}[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Evolución de los shapes.
|
|
70
|
+
*
|
|
71
|
+
* Se coloca el shape inicial y luego se colocan los nuevos shapes
|
|
72
|
+
* en el campo evolución.
|
|
73
|
+
*
|
|
74
|
+
* Cuándo se cargan en el evento
|
|
75
|
+
* se ordenan de acuerdo a la versión semántica utilizada.
|
|
76
|
+
*
|
|
77
|
+
* Nota sobre el tipeado: esta variable no se debe tipear,
|
|
78
|
+
* ya que al colocar un tipo se pierde la información sobre los
|
|
79
|
+
* tipos específicos de las versiones.
|
|
80
|
+
*
|
|
81
|
+
* Las versiones se deben declarar "as const"
|
|
82
|
+
* para que Typescript entienda que son tipos específicos (non widened to string)
|
|
83
|
+
* y puedan ser utilizados como tipos.
|
|
84
|
+
*/
|
|
85
|
+
export declare const shapeEvolution: {
|
|
86
|
+
evolution: never[];
|
|
87
|
+
initial: {
|
|
88
|
+
version: "1.0.0";
|
|
89
|
+
conditions: z.ZodObject<{
|
|
90
|
+
invoice: z.ZodType<Invoice, z.ZodTypeDef, {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
age: number;
|
|
94
|
+
}>;
|
|
95
|
+
name: z.ZodType<InvoiceName, z.ZodTypeDef, string>;
|
|
96
|
+
user: z.ZodObject<{
|
|
97
|
+
name: z.ZodType<InvoiceName, z.ZodTypeDef, string>;
|
|
98
|
+
age: z.ZodNumber;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
name: InvoiceName;
|
|
101
|
+
age: number;
|
|
102
|
+
}, {
|
|
103
|
+
name: string;
|
|
104
|
+
age: number;
|
|
105
|
+
}>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
name: InvoiceName;
|
|
108
|
+
user: {
|
|
109
|
+
name: InvoiceName;
|
|
110
|
+
age: number;
|
|
111
|
+
};
|
|
112
|
+
invoice: Invoice;
|
|
113
|
+
}, {
|
|
114
|
+
name: string;
|
|
115
|
+
user: {
|
|
116
|
+
name: string;
|
|
117
|
+
age: number;
|
|
118
|
+
};
|
|
119
|
+
invoice: {
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
age: number;
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
sampleData: {
|
|
126
|
+
invoice: {
|
|
127
|
+
name: string;
|
|
128
|
+
age: number;
|
|
129
|
+
id: string;
|
|
130
|
+
};
|
|
131
|
+
name: string;
|
|
132
|
+
user: {
|
|
133
|
+
name: string;
|
|
134
|
+
age: number;
|
|
135
|
+
};
|
|
136
|
+
}[];
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Valor de la última versión utilizada para el evento específico.
|
|
141
|
+
* Debe existir en las versiones disponibles en la evolución de shapes
|
|
142
|
+
*
|
|
143
|
+
* Cada vez que se agregan shapes, se debe actualizar este valor.
|
|
144
|
+
*
|
|
145
|
+
* Esta es la versión por defecto que se utiliza al producir Ocurrencias.
|
|
146
|
+
*/
|
|
147
|
+
export type LastShapeVersion = "1.0.0";
|
|
148
|
+
//# sourceMappingURL=shape-evolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-evolution.d.ts","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/shape-evolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGnD;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBnB,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG1B,CAAC;AACF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "@imolko/ultra-v8n";
|
|
2
|
+
import { Invoice, InvoiceName } from "./artifacts";
|
|
3
|
+
/**
|
|
4
|
+
* Definición de los shapes que definen la data del evento.
|
|
5
|
+
*
|
|
6
|
+
* Este es el único sitio dónde se almacena la definición
|
|
7
|
+
* de la data de los eventos, por tanto, no se deben
|
|
8
|
+
* eliminar versiones ya publicadas.
|
|
9
|
+
*
|
|
10
|
+
* Sólo se deben agregar nuevas versiones.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Primer shape utilizado para la data
|
|
14
|
+
* Se debe utilizar la versión con la clausula "as const"
|
|
15
|
+
* para que Typescript entienda que son tipos específicos inmutables.
|
|
16
|
+
*/
|
|
17
|
+
export const shape_1 = {
|
|
18
|
+
version: "1.0.0",
|
|
19
|
+
conditions: z.object({
|
|
20
|
+
invoice: Invoice.rules(),
|
|
21
|
+
name: InvoiceName.rules(),
|
|
22
|
+
user: z.object({
|
|
23
|
+
name: InvoiceName.rules(),
|
|
24
|
+
age: z.number(),
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
sampleData: [
|
|
28
|
+
{
|
|
29
|
+
invoice: {
|
|
30
|
+
name: "hola mundo",
|
|
31
|
+
age: 20,
|
|
32
|
+
id: "e5105127-3eda-4a67-8edb-e04d2ec97bb5",
|
|
33
|
+
},
|
|
34
|
+
name: 'nombre de pila',
|
|
35
|
+
user: {
|
|
36
|
+
name: 'jack sparrow',
|
|
37
|
+
age: 43,
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Evolución de los shapes.
|
|
44
|
+
*
|
|
45
|
+
* Se coloca el shape inicial y luego se colocan los nuevos shapes
|
|
46
|
+
* en el campo evolución.
|
|
47
|
+
*
|
|
48
|
+
* Cuándo se cargan en el evento
|
|
49
|
+
* se ordenan de acuerdo a la versión semántica utilizada.
|
|
50
|
+
*
|
|
51
|
+
* Nota sobre el tipeado: esta variable no se debe tipear,
|
|
52
|
+
* ya que al colocar un tipo se pierde la información sobre los
|
|
53
|
+
* tipos específicos de las versiones.
|
|
54
|
+
*
|
|
55
|
+
* Las versiones se deben declarar "as const"
|
|
56
|
+
* para que Typescript entienda que son tipos específicos (non widened to string)
|
|
57
|
+
* y puedan ser utilizados como tipos.
|
|
58
|
+
*/
|
|
59
|
+
export const shapeEvolution = {
|
|
60
|
+
evolution: [],
|
|
61
|
+
initial: shape_1,
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=shape-evolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-evolution.js","sourceRoot":"","sources":["../../../../src/event/use-samples/validated-artifact/shape-evolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGnD;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE,OAAgB;IACzB,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE;QACxB,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE;QACzB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;YACb,IAAI,EAAE,WAAW,CAAC,KAAK,EAAE;YACzB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;SAChB,CAAC;KACH,CAAC;IACF,UAAU,EAAE;QACV;YACE,OAAO,EAAE;gBACP,IAAI,EAAE,YAAY;gBAClB,GAAG,EAAE,EAAE;gBACP,EAAE,EAAE,sCAAsC;aAC3C;YACD,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE;gBACJ,IAAI,EAAE,cAAc;gBACpB,GAAG,EAAE,EAAE;aACR;SACF;KACF;CACF,CAAC;AACF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,OAAO;CACjB,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Validation } from
|
|
2
|
-
import { CloudEventDdd, CloudEventDddErrors, CloudEventDddPrimitiveSigned, JsonSchemaForCloudEvent } from
|
|
3
|
-
import { SemVer } from
|
|
4
|
-
import { EventType } from
|
|
5
|
-
import { SchemaLocation } from
|
|
6
|
-
import { EventName } from
|
|
7
|
-
import { EmitterApp } from
|
|
8
|
-
import { EventScope } from
|
|
9
|
-
import { AggregateName } from
|
|
10
|
-
import { EventDataContentType } from
|
|
11
|
-
import { EventTypeOwner } from
|
|
12
|
-
import { EventSubject } from
|
|
13
|
-
import { ShapeEvolution } from
|
|
14
|
-
import { EventConditions } from
|
|
15
|
-
import { DomainEventInterface } from
|
|
16
|
-
import { Payload } from
|
|
17
|
-
import { Primitive } from
|
|
18
|
-
import { Props } from
|
|
19
|
-
import { Errors } from
|
|
1
|
+
import { Validation } from "@imolko/ultra-result";
|
|
2
|
+
import { CloudEventDdd, CloudEventDddErrors, CloudEventDddPrimitiveSigned, JsonSchemaForCloudEvent } from "../cloud-event-ddd";
|
|
3
|
+
import { SemVer } from "../sem-ver";
|
|
4
|
+
import { EventType } from "../event-type";
|
|
5
|
+
import { SchemaLocation } from "../schema-location";
|
|
6
|
+
import { EventName } from "../event-name";
|
|
7
|
+
import { EmitterApp } from "../emitter-app";
|
|
8
|
+
import { EventScope } from "./event-scope.enum";
|
|
9
|
+
import { AggregateName } from "../aggregate-name";
|
|
10
|
+
import { EventDataContentType } from "../event-data-content-type";
|
|
11
|
+
import { EventTypeOwner } from "../event-type-owner";
|
|
12
|
+
import { EventSubject } from "../event-subject";
|
|
13
|
+
import { ShapeEvolution } from "../shape-evolution";
|
|
14
|
+
import { EventConditions } from "./conditions";
|
|
15
|
+
import { DomainEventInterface } from "./domain-event.interface";
|
|
16
|
+
import { Payload } from "./payload";
|
|
17
|
+
import { Primitive } from "./primitive";
|
|
18
|
+
import { Props } from "./props";
|
|
19
|
+
import { Errors } from "./errors";
|
|
20
20
|
/**
|
|
21
21
|
* Clase base utilizada para definir los Eventos.
|
|
22
22
|
*
|
|
@@ -47,9 +47,9 @@ export declare abstract class DomainEventBase implements DomainEventInterface {
|
|
|
47
47
|
static readonly shapeHistory: ShapeEvolution;
|
|
48
48
|
/**
|
|
49
49
|
* Propiedades de la ocurrencia de un evento
|
|
50
|
-
|
|
51
|
-
readonly ocurrence: Readonly<Props[
|
|
52
|
-
readonly context: Readonly<Props[
|
|
50
|
+
*/
|
|
51
|
+
readonly ocurrence: Readonly<Props["ocurrence"]>;
|
|
52
|
+
readonly context: Readonly<Props["context"]>;
|
|
53
53
|
/**
|
|
54
54
|
* Devuelve la versión mayor definida en
|
|
55
55
|
* la historia de shapes usados para la data del evento
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-event-base.class.d.ts","sourceRoot":"","sources":["../../../src/event/domain-event/domain-event-base.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"domain-event-base.class.d.ts","sourceRoot":"","sources":["../../../src/event/domain-event/domain-event-base.class.ts"],"names":[],"mappings":"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"}
|
|
@@ -66,7 +66,7 @@ class DomainEventBase {
|
|
|
66
66
|
registryDomain,
|
|
67
67
|
emitterApp,
|
|
68
68
|
eventName,
|
|
69
|
-
version
|
|
69
|
+
version,
|
|
70
70
|
});
|
|
71
71
|
/**
|
|
72
72
|
* Este error no debería suceder
|
|
@@ -147,13 +147,13 @@ class DomainEventBase {
|
|
|
147
147
|
*/
|
|
148
148
|
static rules() {
|
|
149
149
|
/** Creamos el objeto validando el shape */
|
|
150
|
-
return conditions_1.conditions
|
|
150
|
+
return (conditions_1.conditions
|
|
151
151
|
/** Validamos data de ocurrencia con dataSchemaVersion */
|
|
152
152
|
.superRefine((x, y) => (0, conditions_1.checkOcurrenceData)(this.shapeHistory)(x, y))
|
|
153
153
|
/** Transformamos la data según el shape del dataSchemaVersion */
|
|
154
154
|
.transform((x, y) => (0, conditions_1.applyShape)(this.shapeHistory)(x, y))
|
|
155
155
|
/** Creamos el eventDomian */
|
|
156
|
-
.transform(this.createInstanceForZod());
|
|
156
|
+
.transform(this.createInstanceForZod()));
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Rules para hidratar una ocurrencia del Evento,
|
|
@@ -239,12 +239,19 @@ class DomainEventBase {
|
|
|
239
239
|
static getJsonSchemasForEvolution() {
|
|
240
240
|
const shapes = this.shapeHistory.getSequenceOfShapes();
|
|
241
241
|
const eventType = this.eventType;
|
|
242
|
-
const schemasExe = shapes.map(shape => ({
|
|
242
|
+
const schemasExe = shapes.map((shape) => ({
|
|
243
243
|
version: shape.version.getPayload(),
|
|
244
|
-
schemaExe: cloud_event_ddd_1.CloudEventDdd.getJsonSchema(eventType, shape.conditions)
|
|
244
|
+
schemaExe: cloud_event_ddd_1.CloudEventDdd.getJsonSchema(eventType, shape.conditions),
|
|
245
|
+
}));
|
|
246
|
+
const schemas = schemasExe
|
|
247
|
+
.filter((res) => res.schemaExe.isValid())
|
|
248
|
+
.map((res) => ({
|
|
249
|
+
version: res.version,
|
|
250
|
+
schema: res.schemaExe.getValue(),
|
|
245
251
|
}));
|
|
246
|
-
const
|
|
247
|
-
|
|
252
|
+
const errorSchemas = schemasExe
|
|
253
|
+
.filter((res) => res.schemaExe.isInvalid())
|
|
254
|
+
.map((res) => res.schemaExe.getErrors());
|
|
248
255
|
if (errorSchemas.length > 0) {
|
|
249
256
|
const flatten = errorSchemas.flat();
|
|
250
257
|
return (0, ultra_result_1.invalid)(flatten);
|
|
@@ -284,19 +291,21 @@ class DomainEventBase {
|
|
|
284
291
|
* @returns
|
|
285
292
|
*/
|
|
286
293
|
serializeDataPayload(data) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
294
|
+
const process = (value) => {
|
|
295
|
+
if (typeof value === "object" &&
|
|
296
|
+
value !== null &&
|
|
297
|
+
typeof value.getPayload === "function") {
|
|
298
|
+
return process(value.getPayload());
|
|
299
|
+
}
|
|
300
|
+
if (Array.isArray(value)) {
|
|
301
|
+
return value.map((item) => process(item));
|
|
302
|
+
}
|
|
303
|
+
if (typeof value === "object" && value !== null) {
|
|
304
|
+
return Object.fromEntries(Object.entries(value).map(([key, val]) => [key, process(val)]));
|
|
305
|
+
}
|
|
306
|
+
return value;
|
|
307
|
+
};
|
|
308
|
+
return process(data);
|
|
300
309
|
}
|
|
301
310
|
/**
|
|
302
311
|
* Crea una instancia de CloudEvent a partir de la data de la ocurrencia.
|
|
@@ -341,7 +350,7 @@ class DomainEventBase {
|
|
|
341
350
|
instance: context.instance.getPayload(),
|
|
342
351
|
tenantId: context.tenantId.getPayload(),
|
|
343
352
|
schemaRegistryUrl: context.schemaRegistryUrl.getPayload(),
|
|
344
|
-
emitterDomain: context.emitterDomain.getPayload()
|
|
353
|
+
emitterDomain: context.emitterDomain.getPayload(),
|
|
345
354
|
},
|
|
346
355
|
ocurrence: {
|
|
347
356
|
id: ocurrence.id.getPayload(),
|
|
@@ -349,8 +358,8 @@ class DomainEventBase {
|
|
|
349
358
|
publishedAt: ocurrence.publishedAt.getPayload(),
|
|
350
359
|
aggregateId: ocurrence.aggregateId.getPayload(),
|
|
351
360
|
dataSchemaVersion: ocurrence.dataSchemaVersion.getPayload(),
|
|
352
|
-
data: this.serializeDataPayload(ocurrence.data)
|
|
353
|
-
}
|
|
361
|
+
data: this.serializeDataPayload(ocurrence.data),
|
|
362
|
+
},
|
|
354
363
|
};
|
|
355
364
|
return result;
|
|
356
365
|
}
|
|
@@ -371,7 +380,7 @@ class DomainEventBase {
|
|
|
371
380
|
instance: context.instance.getPrimitive(),
|
|
372
381
|
tenantId: context.tenantId.getPrimitive(),
|
|
373
382
|
schemaRegistryUrl: context.schemaRegistryUrl.getPrimitive(),
|
|
374
|
-
emitterDomain: context.emitterDomain.getPrimitive()
|
|
383
|
+
emitterDomain: context.emitterDomain.getPrimitive(),
|
|
375
384
|
},
|
|
376
385
|
ocurrence: {
|
|
377
386
|
id: ocurrence.id.getPrimitive(),
|
|
@@ -379,8 +388,8 @@ class DomainEventBase {
|
|
|
379
388
|
publishedAt: ocurrence.publishedAt.getPrimitive(),
|
|
380
389
|
aggregateId: ocurrence.aggregateId.getPrimitive(),
|
|
381
390
|
dataSchemaVersion: ocurrence.dataSchemaVersion.getPrimitive(),
|
|
382
|
-
data: this.serializeDataPayload(ocurrence.data)
|
|
383
|
-
}
|
|
391
|
+
data: this.serializeDataPayload(ocurrence.data),
|
|
392
|
+
},
|
|
384
393
|
};
|
|
385
394
|
return result;
|
|
386
395
|
}
|