@imolko/ultra-ddd 2.1.7 → 3.0.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.
Files changed (239) hide show
  1. package/dist-browser/aggregate-root/event-sourced/production/errors/domain-event-production.error.d.ts +10 -1
  2. package/dist-browser/aggregate-root/event-sourced/production/errors/domain-event-production.error.d.ts.map +1 -1
  3. package/dist-browser/aggregate-root/event-sourced/production/errors/domain-event-production.error.js +6 -1
  4. package/dist-browser/aggregate-root/event-sourced/production/errors/domain-event-production.error.js.map +1 -1
  5. package/dist-browser/aggregate-root/event-sourced/production/production.d.ts +5 -3
  6. package/dist-browser/aggregate-root/event-sourced/production/production.d.ts.map +1 -1
  7. package/dist-browser/aggregate-root/event-sourced/production/production.js +11 -5
  8. package/dist-browser/aggregate-root/event-sourced/production/production.js.map +1 -1
  9. package/dist-browser/event/cloud-event-ddd/definition.d.ts +15 -10
  10. package/dist-browser/event/cloud-event-ddd/definition.d.ts.map +1 -1
  11. package/dist-browser/event/cloud-event-ddd/definition.js +16 -20
  12. package/dist-browser/event/cloud-event-ddd/definition.js.map +1 -1
  13. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.d.ts +33 -0
  14. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.d.ts.map +1 -0
  15. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.js +30 -0
  16. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.js.map +1 -0
  17. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature.error.d.ts +28 -0
  18. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature.error.d.ts.map +1 -0
  19. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature.error.js +25 -0
  20. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-signature.error.js.map +1 -0
  21. package/dist-browser/event/cloud-event-ddd/errors/index.d.ts +5 -2
  22. package/dist-browser/event/cloud-event-ddd/errors/index.d.ts.map +1 -1
  23. package/dist-browser/event/cloud-event-ddd/errors/index.js +5 -1
  24. package/dist-browser/event/cloud-event-ddd/errors/index.js.map +1 -1
  25. package/dist-browser/event/cloud-event-ddd/index.d.ts +11 -7
  26. package/dist-browser/event/cloud-event-ddd/index.d.ts.map +1 -1
  27. package/dist-browser/event/cloud-event-ddd/index.js +5 -2
  28. package/dist-browser/event/cloud-event-ddd/index.js.map +1 -1
  29. package/dist-browser/event/cloud-event-ddd/primitive.d.ts +11 -1
  30. package/dist-browser/event/cloud-event-ddd/primitive.d.ts.map +1 -1
  31. package/dist-browser/event/cloud-event-ddd/sign.d.ts +18 -0
  32. package/dist-browser/event/cloud-event-ddd/sign.d.ts.map +1 -0
  33. package/dist-browser/event/cloud-event-ddd/sign.js +25 -0
  34. package/dist-browser/event/cloud-event-ddd/sign.js.map +1 -0
  35. package/dist-browser/event/cloud-event-ddd/validations.d.ts +44 -16
  36. package/dist-browser/event/cloud-event-ddd/validations.d.ts.map +1 -1
  37. package/dist-browser/event/cloud-event-ddd/validations.js +74 -16
  38. package/dist-browser/event/cloud-event-ddd/validations.js.map +1 -1
  39. package/dist-browser/event/cloud-event-ddd/verify.d.ts +32 -0
  40. package/dist-browser/event/cloud-event-ddd/verify.d.ts.map +1 -0
  41. package/dist-browser/event/cloud-event-ddd/verify.js +28 -0
  42. package/dist-browser/event/cloud-event-ddd/verify.js.map +1 -0
  43. package/dist-browser/event/domain-event/domain-event-base.class.d.ts +16 -9
  44. package/dist-browser/event/domain-event/domain-event-base.class.d.ts.map +1 -1
  45. package/dist-browser/event/domain-event/domain-event-base.class.js +11 -8
  46. package/dist-browser/event/domain-event/domain-event-base.class.js.map +1 -1
  47. package/dist-browser/event/domain-event/domain-event-factory.mixin.d.ts.map +1 -1
  48. package/dist-browser/event/domain-event/domain-event-factory.mixin.js +0 -1
  49. package/dist-browser/event/domain-event/domain-event-factory.mixin.js.map +1 -1
  50. package/dist-browser/event/domain-event/domain-event.interface.d.ts +4 -1
  51. package/dist-browser/event/domain-event/domain-event.interface.d.ts.map +1 -1
  52. package/dist-browser/event/domain-event/event-definition-payload.d.ts +0 -1
  53. package/dist-browser/event/domain-event/event-definition-payload.d.ts.map +1 -1
  54. package/dist-browser/event/domain-event/event-definition-payload.js +0 -1
  55. package/dist-browser/event/domain-event/event-definition-payload.js.map +1 -1
  56. package/dist-browser/event/domain-event/event-public-api.type.d.ts +3 -2
  57. package/dist-browser/event/domain-event/event-public-api.type.d.ts.map +1 -1
  58. package/dist-browser/event/use-samples/file-uploaded/cloud-event.schema.d.ts +9 -5
  59. package/dist-browser/event/use-samples/file-uploaded/cloud-event.schema.d.ts.map +1 -1
  60. package/dist-browser/event/use-samples/file-uploaded/cloud-event.schema.js +4 -2
  61. package/dist-browser/event/use-samples/file-uploaded/cloud-event.schema.js.map +1 -1
  62. package/dist-browser/event/use-samples/file-uploaded/definition.d.ts +0 -2
  63. package/dist-browser/event/use-samples/file-uploaded/definition.d.ts.map +1 -1
  64. package/dist-browser/event/use-samples/file-uploaded/definition.js +0 -3
  65. package/dist-browser/event/use-samples/file-uploaded/definition.js.map +1 -1
  66. package/dist-browser/event/use-samples/file-uploaded/event.d.ts +0 -1
  67. package/dist-browser/event/use-samples/file-uploaded/event.d.ts.map +1 -1
  68. package/dist-browser/event/use-samples/nested-event/cloud-event.schema.d.ts +9 -5
  69. package/dist-browser/event/use-samples/nested-event/cloud-event.schema.d.ts.map +1 -1
  70. package/dist-browser/event/use-samples/nested-event/cloud-event.schema.js +4 -2
  71. package/dist-browser/event/use-samples/nested-event/cloud-event.schema.js.map +1 -1
  72. package/dist-browser/event/use-samples/nested-event/definition.d.ts +0 -2
  73. package/dist-browser/event/use-samples/nested-event/definition.d.ts.map +1 -1
  74. package/dist-browser/event/use-samples/nested-event/definition.js +0 -3
  75. package/dist-browser/event/use-samples/nested-event/definition.js.map +1 -1
  76. package/dist-browser/event/use-samples/nested-event/event.d.ts +0 -1
  77. package/dist-browser/event/use-samples/nested-event/event.d.ts.map +1 -1
  78. package/dist-browser/event/use-samples/validated-artifact/cloud-event.schema.d.ts +9 -5
  79. package/dist-browser/event/use-samples/validated-artifact/cloud-event.schema.d.ts.map +1 -1
  80. package/dist-browser/event/use-samples/validated-artifact/cloud-event.schema.js +4 -2
  81. package/dist-browser/event/use-samples/validated-artifact/cloud-event.schema.js.map +1 -1
  82. package/dist-browser/event/use-samples/validated-artifact/definition.d.ts +0 -2
  83. package/dist-browser/event/use-samples/validated-artifact/definition.d.ts.map +1 -1
  84. package/dist-browser/event/use-samples/validated-artifact/definition.js +0 -3
  85. package/dist-browser/event/use-samples/validated-artifact/definition.js.map +1 -1
  86. package/dist-browser/event/use-samples/validated-artifact/event.d.ts +0 -1
  87. package/dist-browser/event/use-samples/validated-artifact/event.d.ts.map +1 -1
  88. package/dist-node/aggregate-root/event-sourced/production/errors/domain-event-production.error.d.ts +10 -1
  89. package/dist-node/aggregate-root/event-sourced/production/errors/domain-event-production.error.d.ts.map +1 -1
  90. package/dist-node/aggregate-root/event-sourced/production/errors/domain-event-production.error.js +6 -1
  91. package/dist-node/aggregate-root/event-sourced/production/errors/domain-event-production.error.js.map +1 -1
  92. package/dist-node/aggregate-root/event-sourced/production/production.d.ts +5 -3
  93. package/dist-node/aggregate-root/event-sourced/production/production.d.ts.map +1 -1
  94. package/dist-node/aggregate-root/event-sourced/production/production.js +11 -5
  95. package/dist-node/aggregate-root/event-sourced/production/production.js.map +1 -1
  96. package/dist-node/event/cloud-event-ddd/definition.d.ts +15 -10
  97. package/dist-node/event/cloud-event-ddd/definition.d.ts.map +1 -1
  98. package/dist-node/event/cloud-event-ddd/definition.js +16 -20
  99. package/dist-node/event/cloud-event-ddd/definition.js.map +1 -1
  100. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.d.ts +33 -0
  101. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.d.ts.map +1 -0
  102. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.js +33 -0
  103. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.js.map +1 -0
  104. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature.error.d.ts +28 -0
  105. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature.error.d.ts.map +1 -0
  106. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature.error.js +28 -0
  107. package/dist-node/event/cloud-event-ddd/errors/cloud-event-signature.error.js.map +1 -0
  108. package/dist-node/event/cloud-event-ddd/errors/index.d.ts +5 -2
  109. package/dist-node/event/cloud-event-ddd/errors/index.d.ts.map +1 -1
  110. package/dist-node/event/cloud-event-ddd/errors/index.js +7 -0
  111. package/dist-node/event/cloud-event-ddd/errors/index.js.map +1 -1
  112. package/dist-node/event/cloud-event-ddd/index.d.ts +11 -7
  113. package/dist-node/event/cloud-event-ddd/index.d.ts.map +1 -1
  114. package/dist-node/event/cloud-event-ddd/index.js +9 -2
  115. package/dist-node/event/cloud-event-ddd/index.js.map +1 -1
  116. package/dist-node/event/cloud-event-ddd/primitive.d.ts +11 -1
  117. package/dist-node/event/cloud-event-ddd/primitive.d.ts.map +1 -1
  118. package/dist-node/event/cloud-event-ddd/sign.d.ts +18 -0
  119. package/dist-node/event/cloud-event-ddd/sign.d.ts.map +1 -0
  120. package/dist-node/event/cloud-event-ddd/sign.js +29 -0
  121. package/dist-node/event/cloud-event-ddd/sign.js.map +1 -0
  122. package/dist-node/event/cloud-event-ddd/validations.d.ts +44 -16
  123. package/dist-node/event/cloud-event-ddd/validations.d.ts.map +1 -1
  124. package/dist-node/event/cloud-event-ddd/validations.js +75 -17
  125. package/dist-node/event/cloud-event-ddd/validations.js.map +1 -1
  126. package/dist-node/event/cloud-event-ddd/verify.d.ts +32 -0
  127. package/dist-node/event/cloud-event-ddd/verify.d.ts.map +1 -0
  128. package/dist-node/event/cloud-event-ddd/verify.js +32 -0
  129. package/dist-node/event/cloud-event-ddd/verify.js.map +1 -0
  130. package/dist-node/event/domain-event/domain-event-base.class.d.ts +16 -9
  131. package/dist-node/event/domain-event/domain-event-base.class.d.ts.map +1 -1
  132. package/dist-node/event/domain-event/domain-event-base.class.js +11 -8
  133. package/dist-node/event/domain-event/domain-event-base.class.js.map +1 -1
  134. package/dist-node/event/domain-event/domain-event-factory.mixin.d.ts.map +1 -1
  135. package/dist-node/event/domain-event/domain-event-factory.mixin.js +0 -1
  136. package/dist-node/event/domain-event/domain-event-factory.mixin.js.map +1 -1
  137. package/dist-node/event/domain-event/domain-event.interface.d.ts +4 -1
  138. package/dist-node/event/domain-event/domain-event.interface.d.ts.map +1 -1
  139. package/dist-node/event/domain-event/event-definition-payload.d.ts +0 -1
  140. package/dist-node/event/domain-event/event-definition-payload.d.ts.map +1 -1
  141. package/dist-node/event/domain-event/event-definition-payload.js +0 -1
  142. package/dist-node/event/domain-event/event-definition-payload.js.map +1 -1
  143. package/dist-node/event/domain-event/event-public-api.type.d.ts +3 -2
  144. package/dist-node/event/domain-event/event-public-api.type.d.ts.map +1 -1
  145. package/dist-node/event/use-samples/file-uploaded/cloud-event.schema.d.ts +9 -5
  146. package/dist-node/event/use-samples/file-uploaded/cloud-event.schema.d.ts.map +1 -1
  147. package/dist-node/event/use-samples/file-uploaded/cloud-event.schema.js +4 -2
  148. package/dist-node/event/use-samples/file-uploaded/cloud-event.schema.js.map +1 -1
  149. package/dist-node/event/use-samples/file-uploaded/definition.d.ts +0 -2
  150. package/dist-node/event/use-samples/file-uploaded/definition.d.ts.map +1 -1
  151. package/dist-node/event/use-samples/file-uploaded/definition.js +0 -3
  152. package/dist-node/event/use-samples/file-uploaded/definition.js.map +1 -1
  153. package/dist-node/event/use-samples/file-uploaded/event.d.ts +0 -1
  154. package/dist-node/event/use-samples/file-uploaded/event.d.ts.map +1 -1
  155. package/dist-node/event/use-samples/nested-event/cloud-event.schema.d.ts +9 -5
  156. package/dist-node/event/use-samples/nested-event/cloud-event.schema.d.ts.map +1 -1
  157. package/dist-node/event/use-samples/nested-event/cloud-event.schema.js +4 -2
  158. package/dist-node/event/use-samples/nested-event/cloud-event.schema.js.map +1 -1
  159. package/dist-node/event/use-samples/nested-event/definition.d.ts +0 -2
  160. package/dist-node/event/use-samples/nested-event/definition.d.ts.map +1 -1
  161. package/dist-node/event/use-samples/nested-event/definition.js +0 -3
  162. package/dist-node/event/use-samples/nested-event/definition.js.map +1 -1
  163. package/dist-node/event/use-samples/nested-event/event.d.ts +0 -1
  164. package/dist-node/event/use-samples/nested-event/event.d.ts.map +1 -1
  165. package/dist-node/event/use-samples/validated-artifact/cloud-event.schema.d.ts +9 -5
  166. package/dist-node/event/use-samples/validated-artifact/cloud-event.schema.d.ts.map +1 -1
  167. package/dist-node/event/use-samples/validated-artifact/cloud-event.schema.js +4 -2
  168. package/dist-node/event/use-samples/validated-artifact/cloud-event.schema.js.map +1 -1
  169. package/dist-node/event/use-samples/validated-artifact/definition.d.ts +0 -2
  170. package/dist-node/event/use-samples/validated-artifact/definition.d.ts.map +1 -1
  171. package/dist-node/event/use-samples/validated-artifact/definition.js +0 -3
  172. package/dist-node/event/use-samples/validated-artifact/definition.js.map +1 -1
  173. package/dist-node/event/use-samples/validated-artifact/event.d.ts +0 -1
  174. package/dist-node/event/use-samples/validated-artifact/event.d.ts.map +1 -1
  175. package/package.json +2 -1
  176. package/dist-browser/aggregate-root/event-sourced/event-sourced.fixtures.d.ts +0 -616
  177. package/dist-browser/aggregate-root/event-sourced/event-sourced.fixtures.d.ts.map +0 -1
  178. package/dist-browser/aggregate-root/event-sourced/event-sourced.fixtures.js +0 -139
  179. package/dist-browser/aggregate-root/event-sourced/event-sourced.fixtures.js.map +0 -1
  180. package/dist-browser/authorization/secured-use-case/secured-use-case.fixtures.d.ts +0 -55
  181. package/dist-browser/authorization/secured-use-case/secured-use-case.fixtures.d.ts.map +0 -1
  182. package/dist-browser/authorization/secured-use-case/secured-use-case.fixtures.js +0 -76
  183. package/dist-browser/authorization/secured-use-case/secured-use-case.fixtures.js.map +0 -1
  184. package/dist-browser/event/cloud-event-ddd/calculate-hash.d.ts +0 -11
  185. package/dist-browser/event/cloud-event-ddd/calculate-hash.d.ts.map +0 -1
  186. package/dist-browser/event/cloud-event-ddd/calculate-hash.js +0 -23
  187. package/dist-browser/event/cloud-event-ddd/calculate-hash.js.map +0 -1
  188. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-tampered.error.d.ts +0 -17
  189. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-tampered.error.d.ts.map +0 -1
  190. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-tampered.error.js +0 -15
  191. package/dist-browser/event/cloud-event-ddd/errors/cloud-event-tampered.error.js.map +0 -1
  192. package/dist-browser/event/cloud-event-ddd/is-event-signed-with.d.ts +0 -3
  193. package/dist-browser/event/cloud-event-ddd/is-event-signed-with.d.ts.map +0 -1
  194. package/dist-browser/event/cloud-event-ddd/is-event-signed-with.js +0 -10
  195. package/dist-browser/event/cloud-event-ddd/is-event-signed-with.js.map +0 -1
  196. package/dist-browser/event/use-samples/file-uploaded/security-token.d.ts +0 -8
  197. package/dist-browser/event/use-samples/file-uploaded/security-token.d.ts.map +0 -1
  198. package/dist-browser/event/use-samples/file-uploaded/security-token.js +0 -8
  199. package/dist-browser/event/use-samples/file-uploaded/security-token.js.map +0 -1
  200. package/dist-browser/event/use-samples/nested-event/security-token.d.ts +0 -8
  201. package/dist-browser/event/use-samples/nested-event/security-token.d.ts.map +0 -1
  202. package/dist-browser/event/use-samples/nested-event/security-token.js +0 -8
  203. package/dist-browser/event/use-samples/nested-event/security-token.js.map +0 -1
  204. package/dist-browser/event/use-samples/validated-artifact/security-token.d.ts +0 -8
  205. package/dist-browser/event/use-samples/validated-artifact/security-token.d.ts.map +0 -1
  206. package/dist-browser/event/use-samples/validated-artifact/security-token.js +0 -9
  207. package/dist-browser/event/use-samples/validated-artifact/security-token.js.map +0 -1
  208. package/dist-node/aggregate-root/event-sourced/event-sourced.fixtures.d.ts +0 -616
  209. package/dist-node/aggregate-root/event-sourced/event-sourced.fixtures.d.ts.map +0 -1
  210. package/dist-node/aggregate-root/event-sourced/event-sourced.fixtures.js +0 -149
  211. package/dist-node/aggregate-root/event-sourced/event-sourced.fixtures.js.map +0 -1
  212. package/dist-node/authorization/secured-use-case/secured-use-case.fixtures.d.ts +0 -55
  213. package/dist-node/authorization/secured-use-case/secured-use-case.fixtures.d.ts.map +0 -1
  214. package/dist-node/authorization/secured-use-case/secured-use-case.fixtures.js +0 -89
  215. package/dist-node/authorization/secured-use-case/secured-use-case.fixtures.js.map +0 -1
  216. package/dist-node/event/cloud-event-ddd/calculate-hash.d.ts +0 -11
  217. package/dist-node/event/cloud-event-ddd/calculate-hash.d.ts.map +0 -1
  218. package/dist-node/event/cloud-event-ddd/calculate-hash.js +0 -60
  219. package/dist-node/event/cloud-event-ddd/calculate-hash.js.map +0 -1
  220. package/dist-node/event/cloud-event-ddd/errors/cloud-event-tampered.error.d.ts +0 -17
  221. package/dist-node/event/cloud-event-ddd/errors/cloud-event-tampered.error.d.ts.map +0 -1
  222. package/dist-node/event/cloud-event-ddd/errors/cloud-event-tampered.error.js +0 -18
  223. package/dist-node/event/cloud-event-ddd/errors/cloud-event-tampered.error.js.map +0 -1
  224. package/dist-node/event/cloud-event-ddd/is-event-signed-with.d.ts +0 -3
  225. package/dist-node/event/cloud-event-ddd/is-event-signed-with.d.ts.map +0 -1
  226. package/dist-node/event/cloud-event-ddd/is-event-signed-with.js +0 -14
  227. package/dist-node/event/cloud-event-ddd/is-event-signed-with.js.map +0 -1
  228. package/dist-node/event/use-samples/file-uploaded/security-token.d.ts +0 -8
  229. package/dist-node/event/use-samples/file-uploaded/security-token.d.ts.map +0 -1
  230. package/dist-node/event/use-samples/file-uploaded/security-token.js +0 -11
  231. package/dist-node/event/use-samples/file-uploaded/security-token.js.map +0 -1
  232. package/dist-node/event/use-samples/nested-event/security-token.d.ts +0 -8
  233. package/dist-node/event/use-samples/nested-event/security-token.d.ts.map +0 -1
  234. package/dist-node/event/use-samples/nested-event/security-token.js +0 -11
  235. package/dist-node/event/use-samples/nested-event/security-token.js.map +0 -1
  236. package/dist-node/event/use-samples/validated-artifact/security-token.d.ts +0 -8
  237. package/dist-node/event/use-samples/validated-artifact/security-token.d.ts.map +0 -1
  238. package/dist-node/event/use-samples/validated-artifact/security-token.js +0 -12
  239. package/dist-node/event/use-samples/validated-artifact/security-token.js.map +0 -1
@@ -4,10 +4,13 @@ import { Props } from './props';
4
4
  import { Primitive, PrimitiveSigned } from './primitive';
5
5
  import { Payload } from './payload';
6
6
  import { ValidationsPayload } from './validations';
7
+ import { CloudEventVerification } from './verify';
7
8
  import { EventType } from '../event-type';
8
9
  import { Validation } from '@imolko/ultra-result';
9
10
  import { Errors } from './errors';
11
+ import { CloudEventSignatureRejectedError } from './errors/cloud-event-signature-rejected.error';
10
12
  import { JsonSchemaForCloudEvent } from './json-schema-for-cloud-event.type';
13
+ import type { SignOptions, VerifyOptions } from '@imolko/ultra-event-signature';
11
14
  export declare class Definition extends ValueObjectBase<Props, Primitive, Payload> {
12
15
  /**
13
16
  * Miembros estáticos
@@ -20,7 +23,7 @@ export declare class Definition extends ValueObjectBase<Props, Primitive, Payloa
20
23
  /**
21
24
  * Validaciones para reconstruir un cloud-event-ddd
22
25
  */
23
- static validations: (securityToken: string) => ZodType;
26
+ static validations: (options: VerifyOptions) => ZodType;
24
27
  /**
25
28
  * Reload del cloud event.
26
29
  *
@@ -29,10 +32,10 @@ export declare class Definition extends ValueObjectBase<Props, Primitive, Payloa
29
32
  * Es una función que toma el this para determinar como construir el objeto CloudEvent.
30
33
  *
31
34
  * @param this Debe corresponder a la clase CloudEvent con el api completa para el value object
32
- * @param certificado con que se firmó el cloud event
35
+ * @param options key set, política y claves revocadas ya parseados
33
36
  * @returns
34
37
  */
35
- static reload<Implemented extends typeof Definition>(this: Implemented, certificate: string): ZodType<InstanceType<Implemented>, ValidationsPayload>;
38
+ static reload<Implemented extends typeof Definition>(this: Implemented, options: VerifyOptions): ZodType<InstanceType<Implemented>, ValidationsPayload>;
36
39
  /**
37
40
  * Devuelve las propiedades serializadas para exponer en la aplicacion
38
41
  * @returns {Primitive}
@@ -44,18 +47,20 @@ export declare class Definition extends ValueObjectBase<Props, Primitive, Payloa
44
47
  */
45
48
  getPayload(): Payload;
46
49
  /**
50
+ * Firma el evento con las opciones del primitivo.
47
51
  *
48
- * @param {string} securityToken
49
- * @returns {PrimitiveSigned}
52
+ * @param options `kid` y clave privada Ed25519
53
+ * @returns validación con el sobre firmado o el error con los issues del primitivo
50
54
  */
51
- getEventSigned(securityToken: string): PrimitiveSigned;
55
+ getEventSigned(options: SignOptions): Validation<Errors, PrimitiveSigned>;
52
56
  /**
57
+ * Verifica un sobre de CloudEvent contra el material de confianza.
53
58
  *
54
- * @param {ValidationsPayload} event
55
- * @param {string} certificate
56
- * @returns {boolean}
59
+ * @param event sobre firmado que se quiere verificar
60
+ * @param options key set, política y claves revocadas ya parseados
61
+ * @returns validación con `keyId` y `source`, o el motivo y los issues del rechazo
57
62
  */
58
- static isSignedWith(event: ValidationsPayload, certificate: string): boolean;
63
+ static verify(event: unknown, options: VerifyOptions): Validation<CloudEventSignatureRejectedError, CloudEventVerification>;
59
64
  /**
60
65
  * Obtiene el json schema
61
66
  * @param {EventType} eventType
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAgB,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAmC,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGpF,OA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;;;;OAMG;WACW,MAAM,CAClB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,aAAa,GACrB,UAAU,CAAC,gCAAgC,EAAE,sBAAsB,CAAC;IAGvE;;;;OAIG;WACW,aAAa,CACzB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,SAAS,GACpB,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAAC;CAkB/C"}
@@ -12,8 +12,8 @@ const ultra_v8n_1 = require("@imolko/ultra-v8n");
12
12
  const value_object_1 = require("../../value-object");
13
13
  const conditions_1 = require("./conditions");
14
14
  const validations_1 = require("./validations");
15
- const is_event_signed_with_1 = require("./is-event-signed-with");
16
- const calculate_hash_1 = require("./calculate-hash");
15
+ const sign_1 = require("./sign");
16
+ const verify_1 = require("./verify");
17
17
  const ultra_result_1 = require("@imolko/ultra-result");
18
18
  const cloud_event_unable_to_generate_json_schema_1 = require("./errors/cloud-event-unable-to-generate-json-schema");
19
19
  let Definition = Definition_1 = class Definition extends value_object_1.ValueObjectBase {
@@ -25,10 +25,10 @@ let Definition = Definition_1 = class Definition extends value_object_1.ValueObj
25
25
  * Es una función que toma el this para determinar como construir el objeto CloudEvent.
26
26
  *
27
27
  * @param this Debe corresponder a la clase CloudEvent con el api completa para el value object
28
- * @param certificado con que se firmó el cloud event
28
+ * @param options key set, política y claves revocadas ya parseados
29
29
  * @returns
30
30
  */
31
- static reload(certificate) {
31
+ static reload(options) {
32
32
  const builder = (payload) => {
33
33
  /**
34
34
  * Verificamos existencia del método estático of
@@ -47,7 +47,7 @@ let Definition = Definition_1 = class Definition extends value_object_1.ValueObj
47
47
  throw new Error('validate must be call in a ValueObject with of method');
48
48
  };
49
49
  /** Concatenamos las validaciones con el builder */
50
- return (0, validations_1.validations)(certificate).transform(builder.bind(this));
50
+ return (0, validations_1.validations)(options).transform(builder.bind(this));
51
51
  }
52
52
  /**
53
53
  * Devuelve las propiedades serializadas para exponer en la aplicacion
@@ -92,27 +92,23 @@ let Definition = Definition_1 = class Definition extends value_object_1.ValueObj
92
92
  return result;
93
93
  }
94
94
  /**
95
+ * Firma el evento con las opciones del primitivo.
95
96
  *
96
- * @param {string} securityToken
97
- * @returns {PrimitiveSigned}
97
+ * @param options `kid` y clave privada Ed25519
98
+ * @returns validación con el sobre firmado o el error con los issues del primitivo
98
99
  */
99
- getEventSigned(securityToken) {
100
- // TODO: Implementar firma del evento
101
- const primitive = this.getPrimitive();
102
- const result = {
103
- ...primitive,
104
- comimolkohash: (0, calculate_hash_1.calculateHash)(primitive, securityToken)
105
- };
106
- return result;
100
+ getEventSigned(options) {
101
+ return (0, sign_1.signCloudEvent)(this.getPrimitive(), options);
107
102
  }
108
103
  /**
104
+ * Verifica un sobre de CloudEvent contra el material de confianza.
109
105
  *
110
- * @param {ValidationsPayload} event
111
- * @param {string} certificate
112
- * @returns {boolean}
106
+ * @param event sobre firmado que se quiere verificar
107
+ * @param options key set, política y claves revocadas ya parseados
108
+ * @returns validación con `keyId` y `source`, o el motivo y los issues del rechazo
113
109
  */
114
- static isSignedWith(event, certificate) {
115
- return (0, is_event_signed_with_1.isEventSignedWith)(event, certificate);
110
+ static verify(event, options) {
111
+ return (0, verify_1.verifyCloudEvent)(event, options);
116
112
  }
117
113
  /**
118
114
  * Obtiene el json schema
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/definition.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,iDAA0D;AAC1D,qDAAmE;AAInE,6CAA0C;AAE1C,+CAAoF;AACpF,iEAA2D;AAC3D,qDAAiD;AAEjD,uDAAkE;AAElE,oHAA2G;AAKpG,IAAM,UAAU,kBAAhB,MAAM,UAAW,SAAQ,8BAA0C;IAcxE;;;;;;;;;;OAUG;IACI,MAAM,CAAC,MAAM,CAElB,WAAmB;QAEnB,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,EAAE;YACnC;;;;eAIG;YACH,8DAA8D;YAC9D,IAAI,CAAC,OAAO,IAAI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C,KAAyB,EAAE,WAAmB;QACvE,OAAO,IAAA,wCAAiB,EAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC/C,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,aAAa,CACzB,SAAoB,EACpB,UAAqB;QAErB,MAAM,WAAW,GAAG,gCAAkB,CAAC;QACvC,2BAA2B;QAC3B,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC;YAC/B,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,aAAC,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;SACxC,CAAC,CAAA;QACF,IAAI,CAAC;YACH,MAAM,MAAM,GAA4B,aAAC,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YACnG,OAAO,IAAA,oBAAK,EAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC;gBAC3C,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,MAAM,WAAW,GAAG,IAAI,iFAAoC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;YACxF,OAAO,IAAA,sBAAO,EAAC,WAAW,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;;AA3IU,gCAAU;AACrB;;GAEG;AACoB,eAAI,GAAG,iBAAiB,AAApB,CAAqB;AAChD;;GAEG;AACa,qBAAU,GACxB,uBAAU,AADc,CACb;AACb;;GAEG;AACW,sBAAW,GAAuC,yBAAW,AAAlD,CAAmD;qBAbjE,UAAU;IADtB,IAAA,2BAAY,GAAE;GACF,UAAU,CA4ItB"}
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/definition.ts"],"names":[],"mappings":";;;;;;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ACxB,uBAAU,AADc,CACb;AACb;;GAEG;AACW,sBAAW,GAAwC,yBAAW,AAAnD,CAAoD;qBAblE,UAAU;IADtB,IAAA,2BAAY,GAAE;GACF,UAAU,CA6ItB"}
@@ -0,0 +1,33 @@
1
+ import type { CloudEventSignatureRejectionReason } from '../verify';
2
+ export declare const CLOUD_EVENT_SIGNATURE_REJECTED_ERROR_CODE = "custom_event_signature_rejected";
3
+ type ExtendedData = {
4
+ reason: CloudEventSignatureRejectionReason;
5
+ issues: string[];
6
+ };
7
+ declare const CloudEventSignatureRejectedError_base: (abstract new (issue: import("@imolko/ultra-v8n").V8nIssueParams<ExtendedData>) => {
8
+ readonly type: string;
9
+ readonly title: string;
10
+ readonly detail: string;
11
+ readonly path: (string | number)[];
12
+ readonly stack: string;
13
+ readonly extended: ExtendedData;
14
+ addSteps(steps: string[]): any;
15
+ captureStack(): string;
16
+ }) & {
17
+ v8n(message?: string | import("@imolko/ultra-v8n").V8nIssueIntegration<ExtendedData> | undefined): string;
18
+ };
19
+ /**
20
+ * Error de verificación de un CloudEvent.
21
+ *
22
+ * El motivo es cerrado (`missing`, `unknown-key`, `signature` o `policy`) y
23
+ * los issues son los del primitivo. Un hecho manipulado, una clave
24
+ * desconocida y un rechazo de política no comparten motivo.
25
+ */
26
+ export declare class CloudEventSignatureRejectedError extends CloudEventSignatureRejectedError_base {
27
+ /** Motivo cerrado del rechazo. */
28
+ get reason(): CloudEventSignatureRejectionReason;
29
+ /** Issues estables devueltos por el primitivo. */
30
+ get issues(): string[];
31
+ }
32
+ export {};
33
+ //# sourceMappingURL=cloud-event-signature-rejected.error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-event-signature-rejected.error.d.ts","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,WAAW,CAAC;AAEpE,eAAO,MAAM,yCAAyC,oCACnB,CAAC;AAEpC,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,kCAAkC,CAAC;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;;;;;;;;;;;;;AAEF;;;;;;GAMG;AACH,qBACa,gCAAiC,SAAQ,qCAIrD;IACC,kCAAkC;IAClC,IAAI,MAAM,IAAI,kCAAkC,CAE/C;IAED,kDAAkD;IAClD,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;CACF"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CloudEventSignatureRejectedError = exports.CLOUD_EVENT_SIGNATURE_REJECTED_ERROR_CODE = void 0;
10
+ const ultra_v8n_1 = require("@imolko/ultra-v8n");
11
+ exports.CLOUD_EVENT_SIGNATURE_REJECTED_ERROR_CODE = 'custom_event_signature_rejected';
12
+ /**
13
+ * Error de verificación de un CloudEvent.
14
+ *
15
+ * El motivo es cerrado (`missing`, `unknown-key`, `signature` o `policy`) y
16
+ * los issues son los del primitivo. Un hecho manipulado, una clave
17
+ * desconocida y un rechazo de política no comparten motivo.
18
+ */
19
+ let CloudEventSignatureRejectedError = class CloudEventSignatureRejectedError extends (0, ultra_v8n_1.V8nCustomParseErrorClassFactory)(exports.CLOUD_EVENT_SIGNATURE_REJECTED_ERROR_CODE, 'Cloud event signature rejected', 'The cloud event signature was rejected') {
20
+ /** Motivo cerrado del rechazo. */
21
+ get reason() {
22
+ return this.extended.reason;
23
+ }
24
+ /** Issues estables devueltos por el primitivo. */
25
+ get issues() {
26
+ return this.extended.issues;
27
+ }
28
+ };
29
+ exports.CloudEventSignatureRejectedError = CloudEventSignatureRejectedError;
30
+ exports.CloudEventSignatureRejectedError = CloudEventSignatureRejectedError = __decorate([
31
+ (0, ultra_v8n_1.V8nCustomParseError)(exports.CLOUD_EVENT_SIGNATURE_REJECTED_ERROR_CODE)
32
+ ], CloudEventSignatureRejectedError);
33
+ //# sourceMappingURL=cloud-event-signature-rejected.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-event-signature-rejected.error.js","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/cloud-event-signature-rejected.error.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iDAAyF;AAI5E,QAAA,yCAAyC,GACpD,iCAAiC,CAAC;AAOpC;;;;;;GAMG;AAEI,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,IAAA,2CAA+B,EACnF,iDAAyC,EACzC,gCAAgC,EAChC,wCAAwC,CACzC;IACC,kCAAkC;IAClC,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;CACF,CAAA;AAdY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,+BAAmB,EAAC,iDAAyC,CAAC;GAClD,gCAAgC,CAc5C"}
@@ -0,0 +1,28 @@
1
+ export declare const CLOUD_EVENT_SIGNATURE_ERROR_CODE = "custom_event_signature";
2
+ type ExtendedData = {
3
+ issues: string[];
4
+ };
5
+ declare const CloudEventSignatureError_base: (abstract new (issue: import("@imolko/ultra-v8n").V8nIssueParams<ExtendedData>) => {
6
+ readonly type: string;
7
+ readonly title: string;
8
+ readonly detail: string;
9
+ readonly path: (string | number)[];
10
+ readonly stack: string;
11
+ readonly extended: ExtendedData;
12
+ addSteps(steps: string[]): any;
13
+ captureStack(): string;
14
+ }) & {
15
+ v8n(message?: string | import("@imolko/ultra-v8n").V8nIssueIntegration<ExtendedData> | undefined): string;
16
+ };
17
+ /**
18
+ * Error de firma de un CloudEvent.
19
+ *
20
+ * Conserva los issues estables que devolvió el primitivo para que el
21
+ * llamador pueda diagnosticar por qué el sobre no se pudo firmar.
22
+ */
23
+ export declare class CloudEventSignatureError extends CloudEventSignatureError_base {
24
+ /** Issues estables devueltos por el primitivo. */
25
+ get issues(): string[];
26
+ }
27
+ export {};
28
+ //# sourceMappingURL=cloud-event-signature.error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-event-signature.error.d.ts","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/cloud-event-signature.error.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AAEzE,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;;;;;;;;;;;;;AAEF;;;;;GAKG;AACH,qBACa,wBAAyB,SAAQ,6BAI7C;IACC,kDAAkD;IAClD,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;CACF"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CloudEventSignatureError = exports.CLOUD_EVENT_SIGNATURE_ERROR_CODE = void 0;
10
+ const ultra_v8n_1 = require("@imolko/ultra-v8n");
11
+ exports.CLOUD_EVENT_SIGNATURE_ERROR_CODE = 'custom_event_signature';
12
+ /**
13
+ * Error de firma de un CloudEvent.
14
+ *
15
+ * Conserva los issues estables que devolvió el primitivo para que el
16
+ * llamador pueda diagnosticar por qué el sobre no se pudo firmar.
17
+ */
18
+ let CloudEventSignatureError = class CloudEventSignatureError extends (0, ultra_v8n_1.V8nCustomParseErrorClassFactory)(exports.CLOUD_EVENT_SIGNATURE_ERROR_CODE, 'Cloud event signature error', 'Unable to sign the cloud event') {
19
+ /** Issues estables devueltos por el primitivo. */
20
+ get issues() {
21
+ return this.extended.issues;
22
+ }
23
+ };
24
+ exports.CloudEventSignatureError = CloudEventSignatureError;
25
+ exports.CloudEventSignatureError = CloudEventSignatureError = __decorate([
26
+ (0, ultra_v8n_1.V8nCustomParseError)(exports.CLOUD_EVENT_SIGNATURE_ERROR_CODE)
27
+ ], CloudEventSignatureError);
28
+ //# sourceMappingURL=cloud-event-signature.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-event-signature.error.js","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/cloud-event-signature.error.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iDAAyF;AAE5E,QAAA,gCAAgC,GAAG,wBAAwB,CAAC;AAMzE;;;;;GAKG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,IAAA,2CAA+B,EAC3E,wCAAgC,EAChC,6BAA6B,EAC7B,gCAAgC,CACjC;IACC,kDAAkD;IAClD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;CACF,CAAA;AATY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,+BAAmB,EAAC,wCAAgC,CAAC;GACzC,wBAAwB,CASpC"}
@@ -1,5 +1,8 @@
1
1
  import { InvalidTypeError } from '@imolko/ultra-v8n';
2
- import { CloudEventTamperedError } from './cloud-event-tampered.error';
2
+ import { CloudEventSignatureRejectedError } from './cloud-event-signature-rejected.error';
3
+ import { CloudEventSignatureError } from './cloud-event-signature.error';
3
4
  import { CloudEventUnableToGenerateJsonSchema } from './cloud-event-unable-to-generate-json-schema';
4
- export type Errors = InvalidTypeError | CloudEventTamperedError | CloudEventUnableToGenerateJsonSchema;
5
+ export { CloudEventSignatureError, CloudEventSignatureRejectedError };
6
+ export { CloudEventUnableToGenerateJsonSchema };
7
+ export type Errors = InvalidTypeError | CloudEventSignatureError | CloudEventSignatureRejectedError | CloudEventUnableToGenerateJsonSchema;
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AAEpG,MAAM,MAAM,MAAM,GAAG,gBAAgB,GACb,uBAAuB,GACvB,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,8CAA8C,CAAC;AAEpG,OAAO,EAAE,wBAAwB,EAAE,gCAAgC,EAAE,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,CAAC;AAEhD,MAAM,MAAM,MAAM,GACd,gBAAgB,GAChB,wBAAwB,GACxB,gCAAgC,GAChC,oCAAoC,CAAC"}
@@ -1,3 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudEventUnableToGenerateJsonSchema = exports.CloudEventSignatureRejectedError = exports.CloudEventSignatureError = void 0;
4
+ const cloud_event_signature_rejected_error_1 = require("./cloud-event-signature-rejected.error");
5
+ Object.defineProperty(exports, "CloudEventSignatureRejectedError", { enumerable: true, get: function () { return cloud_event_signature_rejected_error_1.CloudEventSignatureRejectedError; } });
6
+ const cloud_event_signature_error_1 = require("./cloud-event-signature.error");
7
+ Object.defineProperty(exports, "CloudEventSignatureError", { enumerable: true, get: function () { return cloud_event_signature_error_1.CloudEventSignatureError; } });
8
+ const cloud_event_unable_to_generate_json_schema_1 = require("./cloud-event-unable-to-generate-json-schema");
9
+ Object.defineProperty(exports, "CloudEventUnableToGenerateJsonSchema", { enumerable: true, get: function () { return cloud_event_unable_to_generate_json_schema_1.CloudEventUnableToGenerateJsonSchema; } });
3
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/event/cloud-event-ddd/errors/index.ts"],"names":[],"mappings":";;;AACA,iGAA0F;AAIvD,iHAJ1B,uEAAgC,OAI0B;AAHnE,+EAAyE;AAGhE,yGAHA,sDAAwB,OAGA;AAFjC,6GAAoG;AAG3F,qHAHA,iFAAoC,OAGA"}
@@ -1,8 +1,12 @@
1
- export * from "./value-object";
2
- export { Errors as CloudEventDddErrors } from "./errors";
3
- export { Payload as CloudEventDddPayload } from "./payload";
4
- export { Primitive as CloudEventDddPrimitive } from "./primitive";
5
- export { PrimitiveSigned as CloudEventDddPrimitiveSigned } from "./primitive";
6
- export { JsonSchemaForCloudEvent, JsonSchemaProperties, EventsJsonSchema, JsonSchemaMap, } from "./json-schema-for-cloud-event.type";
7
- export { validationsRaw as CloudEventSignedSchema, validationsPayload as CloudEventPayloadSchema, ValidationsPayload as CloudEventPayload, validationsRawWithoutToken as CloudEventRawSchema, } from "./validations";
1
+ export * from './value-object';
2
+ export { Errors as CloudEventDddErrors } from './errors';
3
+ export { CloudEventSignatureError, CloudEventSignatureRejectedError, } from './errors';
4
+ export { Payload as CloudEventDddPayload } from './payload';
5
+ export { Primitive as CloudEventDddPrimitive } from './primitive';
6
+ export { PrimitiveSigned as CloudEventDddPrimitiveSigned } from './primitive';
7
+ export { JsonSchemaForCloudEvent, JsonSchemaProperties, EventsJsonSchema, JsonSchemaMap, } from './json-schema-for-cloud-event.type';
8
+ export { signCloudEvent } from './sign';
9
+ export { verifyCloudEvent } from './verify';
10
+ export type { CloudEventVerification, CloudEventSignatureRejectionReason, } from './verify';
11
+ export { validationsRaw as CloudEventSignedSchema, validationsPayload as CloudEventPayloadSchema, ValidationsPayload as CloudEventPayload, validationsRawWithoutSignature as CloudEventRawSchema, } from './validations';
8
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,IAAI,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,GACd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,kBAAkB,IAAI,uBAAuB,EAC7C,kBAAkB,IAAI,iBAAiB,EACvC,0BAA0B,IAAI,mBAAmB,GAClD,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,SAAS,IAAI,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,IAAI,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,GACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EACV,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,cAAc,IAAI,sBAAsB,EACxC,kBAAkB,IAAI,uBAAuB,EAC7C,kBAAkB,IAAI,iBAAiB,EACvC,8BAA8B,IAAI,mBAAmB,GACtD,MAAM,eAAe,CAAC"}
@@ -14,10 +14,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.CloudEventRawSchema = exports.CloudEventPayloadSchema = exports.CloudEventSignedSchema = void 0;
17
+ exports.CloudEventRawSchema = exports.CloudEventPayloadSchema = exports.CloudEventSignedSchema = exports.verifyCloudEvent = exports.signCloudEvent = exports.CloudEventSignatureRejectedError = exports.CloudEventSignatureError = void 0;
18
18
  __exportStar(require("./value-object"), exports);
19
+ var errors_1 = require("./errors");
20
+ Object.defineProperty(exports, "CloudEventSignatureError", { enumerable: true, get: function () { return errors_1.CloudEventSignatureError; } });
21
+ Object.defineProperty(exports, "CloudEventSignatureRejectedError", { enumerable: true, get: function () { return errors_1.CloudEventSignatureRejectedError; } });
22
+ var sign_1 = require("./sign");
23
+ Object.defineProperty(exports, "signCloudEvent", { enumerable: true, get: function () { return sign_1.signCloudEvent; } });
24
+ var verify_1 = require("./verify");
25
+ Object.defineProperty(exports, "verifyCloudEvent", { enumerable: true, get: function () { return verify_1.verifyCloudEvent; } });
19
26
  var validations_1 = require("./validations");
20
27
  Object.defineProperty(exports, "CloudEventSignedSchema", { enumerable: true, get: function () { return validations_1.validationsRaw; } });
21
28
  Object.defineProperty(exports, "CloudEventPayloadSchema", { enumerable: true, get: function () { return validations_1.validationsPayload; } });
22
- Object.defineProperty(exports, "CloudEventRawSchema", { enumerable: true, get: function () { return validations_1.validationsRawWithoutToken; } });
29
+ Object.defineProperty(exports, "CloudEventRawSchema", { enumerable: true, get: function () { return validations_1.validationsRawWithoutSignature; } });
23
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAY/B,6CAKuB;AAJrB,qHAAA,cAAc,OAA0B;AACxC,sHAAA,kBAAkB,OAA2B;AAE7C,kHAAA,0BAA0B,OAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAE/B,mCAGkB;AAFhB,kHAAA,wBAAwB,OAAA;AACxB,0HAAA,gCAAgC,OAAA;AAWlC,+BAAwC;AAA/B,sGAAA,cAAc,OAAA;AACvB,mCAA4C;AAAnC,0GAAA,gBAAgB,OAAA;AAMzB,6CAKuB;AAJrB,qHAAA,cAAc,OAA0B;AACxC,sHAAA,kBAAkB,OAA2B;AAE7C,kHAAA,8BAA8B,OAAuB"}
@@ -66,8 +66,18 @@ export interface Primitive {
66
66
  }
67
67
  export interface PrimitiveSigned extends Primitive {
68
68
  /**
69
- * hash de firma calculado por el value object
69
+ * Identificador de la clave con la que se firmó el hecho
70
+ */
71
+ securityKeyId: string;
72
+ /**
73
+ * Digest SHA-256 (64 hex) del contenido canónico firmado
70
74
  */
71
75
  comimolkohash: string;
76
+ /**
77
+ * Firma Ed25519 (128 hex) del contenido canónico.
78
+ *
79
+ * Conserva el nombre legado del wire format; no es una credencial bearer.
80
+ */
81
+ securityToken: string;
72
82
  }
73
83
  //# sourceMappingURL=primitive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"primitive.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/primitive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,EAAE,EAAE,aAAa,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,sBAAsB,CAAC;IAC/B;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC;IAC7B;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB;;;MAGE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AAC;IACzB;;;MAGE;IACF,eAAe,EAAE,6BAA6B,CAAC;IAC/C;;;OAGG;IACH,UAAU,EAAE,uBAAuB,CAAC;IACpC;;;OAGG;IACH,OAAO,EAAE,qBAAqB,CAAC;IAC/B;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB;;OAEG;IACH,YAAY,EAAE,kBAAkB,CAAC;IACjC;;OAEG;IACH,eAAe,EAAE,aAAa,CAAC;IAC/B;;;OAGG;IACH,iBAAiB,EAAE,iBAAiB,CAAC;IACrC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAGD,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,18 @@
1
+ import { Validation } from '@imolko/ultra-result';
2
+ import { SignOptions } from '@imolko/ultra-event-signature';
3
+ import { CloudEventSignatureError } from './errors/cloud-event-signature.error';
4
+ import { Primitive, PrimitiveSigned } from './primitive';
5
+ /**
6
+ * Firma un sobre de CloudEvent delegando en el formato v1 del primitivo.
7
+ *
8
+ * El adaptador es quien añade `securityKeyId` al sobre: el `kid` es una
9
+ * declaración del emisor y `signFact` exige que viaje en el contenido
10
+ * cubierto. El resultado conserva el nombre legado `securityToken` para la
11
+ * firma Ed25519, pero ya no es una credencial compartida.
12
+ *
13
+ * @param envelope Sobre sin firmar
14
+ * @param options `kid` y clave privada Ed25519 ya preparados por el llamador
15
+ * @returns validación con el sobre firmado o el error con los issues del primitivo
16
+ */
17
+ export declare const signCloudEvent: (envelope: Primitive | Record<string, unknown>, options: SignOptions) => Validation<CloudEventSignatureError, PrimitiveSigned>;
18
+ //# sourceMappingURL=sign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAY,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7C,SAAS,WAAW,KACnB,UAAU,CAAC,wBAAwB,EAAE,eAAe,CAatD,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signCloudEvent = void 0;
4
+ const ultra_result_1 = require("@imolko/ultra-result");
5
+ const ultra_event_signature_1 = require("@imolko/ultra-event-signature");
6
+ const cloud_event_signature_error_1 = require("./errors/cloud-event-signature.error");
7
+ /**
8
+ * Firma un sobre de CloudEvent delegando en el formato v1 del primitivo.
9
+ *
10
+ * El adaptador es quien añade `securityKeyId` al sobre: el `kid` es una
11
+ * declaración del emisor y `signFact` exige que viaje en el contenido
12
+ * cubierto. El resultado conserva el nombre legado `securityToken` para la
13
+ * firma Ed25519, pero ya no es una credencial compartida.
14
+ *
15
+ * @param envelope Sobre sin firmar
16
+ * @param options `kid` y clave privada Ed25519 ya preparados por el llamador
17
+ * @returns validación con el sobre firmado o el error con los issues del primitivo
18
+ */
19
+ const signCloudEvent = (envelope, options) => {
20
+ const result = (0, ultra_event_signature_1.signFact)({ ...envelope, securityKeyId: options.keyId }, options);
21
+ if (result.kind === 'invalid') {
22
+ return (0, ultra_result_1.invalid)(new cloud_event_signature_error_1.CloudEventSignatureError({
23
+ extended: { issues: [...result.issues] },
24
+ }));
25
+ }
26
+ return (0, ultra_result_1.valid)(result.envelope);
27
+ };
28
+ exports.signCloudEvent = signCloudEvent;
29
+ //# sourceMappingURL=sign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/sign.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAClE,yEAAsE;AAEtE,sFAAgF;AAGhF;;;;;;;;;;;GAWG;AACI,MAAM,cAAc,GAAG,CAC5B,QAA6C,EAC7C,OAAoB,EACmC,EAAE;IACzD,MAAM,MAAM,GAAG,IAAA,gCAAQ,EACrB,EAAE,GAAG,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,KAAK,EAAE,EAC7C,OAAO,CACR,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,IAAA,sBAAO,EACZ,IAAI,sDAAwB,CAAC;YAC3B,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE;SACzC,CAAC,CACH,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,oBAAK,EAAC,MAAM,CAAC,QAAsC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAhBW,QAAA,cAAc,kBAgBzB"}
@@ -1,6 +1,12 @@
1
1
  import { z } from '@imolko/ultra-v8n';
2
- /** Utilizado para obtener el schema */
2
+ import type { VerifyOptions } from '@imolko/ultra-event-signature';
3
+ /** Utilizado para obtener el schema del sobre firmado */
3
4
  export declare const validationsPayload: z.ZodObject<{
5
+ comimolkoinstance: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../instance/props").Props, string, z.core.$ZodTypeInternals<import("../instance/props").Props, string>>;
6
+ data: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
7
+ securityKeyId: z.ZodString;
8
+ comimolkohash: z.ZodString;
9
+ securityToken: z.ZodString;
4
10
  id: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../../entity/identity/uuid/props").Props, string, z.core.$ZodTypeInternals<import("../../entity/identity/uuid/props").Props, string>>;
5
11
  source: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../emitter-domain/props").Props, string, z.core.$ZodTypeInternals<import("../emitter-domain/props").Props, string>>;
6
12
  specversion: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../sem-ver/props").Props, string, z.core.$ZodTypeInternals<import("../sem-ver/props").Props, string>>;
@@ -11,11 +17,20 @@ export declare const validationsPayload: z.ZodObject<{
11
17
  time: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../event-date/props").Props, string, z.core.$ZodTypeInternals<import("../event-date/props").Props, string>>;
12
18
  recordedtime: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../event-date/props").Props, string, z.core.$ZodTypeInternals<import("../event-date/props").Props, string>>;
13
19
  comimolkotenant: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../../entity/identity/uuid/props").Props, string, z.core.$ZodTypeInternals<import("../../entity/identity/uuid/props").Props, string>>;
14
- comimolkohash: z.ZodString;
15
- comimolkoinstance: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> & z.ZodType<import("../instance/props").Props, string, z.core.$ZodTypeInternals<import("../instance/props").Props, string>>;
16
- data: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
17
20
  }, z.core.$strip>;
21
+ /**
22
+ * Sobre firmado con los atributos serializados como strings.
23
+ *
24
+ * `passthrough` conserva los atributos de extensión de CloudEvents al
25
+ * inspeccionar el sobre: la firma cubre el contenido completo, no sólo los
26
+ * miembros que este adaptador conoce.
27
+ */
18
28
  export declare const validationsRaw: z.ZodObject<{
29
+ comimolkoinstance: z.ZodString;
30
+ data: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
31
+ securityKeyId: z.ZodString;
32
+ comimolkohash: z.ZodString;
33
+ securityToken: z.ZodString;
19
34
  id: z.ZodString;
20
35
  source: z.ZodString;
21
36
  specversion: z.ZodString;
@@ -26,11 +41,14 @@ export declare const validationsRaw: z.ZodObject<{
26
41
  time: z.ZodString;
27
42
  recordedtime: z.ZodString;
28
43
  comimolkotenant: z.ZodString;
29
- comimolkohash: z.ZodString;
30
- comimolkoinstance: z.ZodString;
31
- data: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
32
- }, z.core.$strip>;
33
- export declare const validationsRawWithoutToken: z.ZodObject<{
44
+ }, z.core.$loose>;
45
+ /**
46
+ * Sobre sin firma: omite los tres miembros que aporta el firmador.
47
+ *
48
+ * Omite, sin rechazar: los atributos de extensión de CloudEvents no se
49
+ * rechazan; se descartan porque no forman parte de este contrato.
50
+ */
51
+ export declare const validationsRawWithoutSignature: z.ZodObject<{
34
52
  type: z.ZodString;
35
53
  time: z.ZodString;
36
54
  id: z.ZodString;
@@ -44,7 +62,17 @@ export declare const validationsRawWithoutToken: z.ZodObject<{
44
62
  comimolkotenant: z.ZodString;
45
63
  comimolkoinstance: z.ZodString;
46
64
  }, z.core.$strip>;
47
- export declare const validations: (securityToken: string) => z.ZodPipe<z.ZodObject<{
65
+ /**
66
+ * Validaciones para reconstruir un CloudEvent firmado.
67
+ *
68
+ * @param options key set, política y claves revocadas ya parseados
69
+ */
70
+ export declare const validations: (options: VerifyOptions) => z.ZodPipe<z.ZodObject<{
71
+ comimolkoinstance: z.ZodString;
72
+ data: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
73
+ securityKeyId: z.ZodString;
74
+ comimolkohash: z.ZodString;
75
+ securityToken: z.ZodString;
48
76
  id: z.ZodString;
49
77
  source: z.ZodString;
50
78
  specversion: z.ZodString;
@@ -55,10 +83,7 @@ export declare const validations: (securityToken: string) => z.ZodPipe<z.ZodObje
55
83
  time: z.ZodString;
56
84
  recordedtime: z.ZodString;
57
85
  comimolkotenant: z.ZodString;
58
- comimolkohash: z.ZodString;
59
- comimolkoinstance: z.ZodString;
60
- data: z.ZodOptional<z.ZodRecord<z.ZodAny, z.ZodAny>>;
61
- }, z.core.$strip>, z.ZodTransform<{
86
+ }, z.core.$loose>, z.ZodTransform<{
62
87
  id: string;
63
88
  source: string;
64
89
  instance: string;
@@ -72,6 +97,11 @@ export declare const validations: (securityToken: string) => z.ZodPipe<z.ZodObje
72
97
  tenant: string;
73
98
  data?: Record<any, any> | undefined;
74
99
  }, {
100
+ [x: string]: unknown;
101
+ comimolkoinstance: string;
102
+ securityKeyId: string;
103
+ comimolkohash: string;
104
+ securityToken: string;
75
105
  id: string;
76
106
  source: string;
77
107
  specversion: string;
@@ -82,8 +112,6 @@ export declare const validations: (securityToken: string) => z.ZodPipe<z.ZodObje
82
112
  time: string;
83
113
  recordedtime: string;
84
114
  comimolkotenant: string;
85
- comimolkohash: string;
86
- comimolkoinstance: string;
87
115
  data?: Record<any, any> | undefined;
88
116
  }>>;
89
117
  export type ValidationsPayload = z.input<typeof validationsPayload>;
@@ -1 +1 @@
1
- {"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/validations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,CAAC,EAAE,MAAM,mBAAmB,CAAC;AA2CpD,uCAAuC;AACvC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;iBAc7B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;iBAczB,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;iBAA+C,CAAC;AAEvF,eAAO,MAAM,WAAW,GAAI,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACuB,CAAA;AAExE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../../src/event/cloud-event-ddd/validations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAkFnE,yDAAyD;AACzD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;iBAc7B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;iBAgBX,CAAC;AAEjB;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;iBAMjC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACI,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}