@event-driven-io/emmett-fastify 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5KFYTFPD.mjs → chunk-C2OSPDWQ.mjs} +2 -2
- package/dist/{chunk-5WRQDK26.js → chunk-DOWC7BOP.js} +2 -2
- package/dist/{chunk-RVKMY76Q.js → chunk-FSMUJ2PT.js} +2 -2
- package/dist/{chunk-QTUC2AMB.mjs → chunk-UBODMERJ.mjs} +2 -2
- package/dist/e2e/decider/api.js +1 -1
- package/dist/e2e/decider/api.mjs +1 -1
- package/dist/e2e/decider/businessLogic.js +1 -1
- package/dist/e2e/decider/businessLogic.mjs +1 -1
- package/dist/e2e/decider/shoppingCart.js +1 -1
- package/dist/e2e/decider/shoppingCart.mjs +1 -1
- package/package.json +2 -2
- /package/dist/{chunk-5KFYTFPD.mjs.map → chunk-C2OSPDWQ.mjs.map} +0 -0
- /package/dist/{chunk-5WRQDK26.js.map → chunk-DOWC7BOP.js.map} +0 -0
- /package/dist/{chunk-RVKMY76Q.js.map → chunk-FSMUJ2PT.js.map} +0 -0
- /package/dist/{chunk-QTUC2AMB.mjs.map → chunk-UBODMERJ.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b as e,g as C,h as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a,b as e,g as C,h as d}from"./chunk-UBODMERJ.mjs";var S=(p=>(p.CART_ALREADY_EXISTS="CART_ALREADY_EXISTS",p.CART_IS_ALREADY_CLOSED="CART_IS_ALREADY_CLOSED",p.PRODUCT_ITEM_NOT_FOUND="PRODUCT_ITEM_NOT_FOUND",p.CART_IS_EMPTY="CART_IS_EMPTY",p.UNKNOWN_EVENT_TYPE="UNKNOWN_EVENT_TYPE",p.UNKNOWN_COMMAND_TYPE="UNKNOWN_COMMAND_TYPE",p))(S||{}),I=(o,{productId:t,quantity:r,unitPrice:n})=>{if((o.find(i=>i.productId===t&&i.unitPrice==n)?.quantity??0)<r)throw new e("PRODUCT_ITEM_NOT_FOUND")},g=({type:o,data:t},r)=>{switch(o){case"OpenShoppingCart":{if(r.status!=="Empty")throw new e("CART_ALREADY_EXISTS");return{type:"ShoppingCartOpened",data:{shoppingCartId:t.shoppingCartId,clientId:t.clientId,openedAt:t.now}}}case"AddProductItemToShoppingCart":{if(r.status!=="Pending")throw new e("CART_IS_ALREADY_CLOSED");return{type:"ProductItemAddedToShoppingCart",data:{shoppingCartId:t.shoppingCartId,productItem:t.productItem}}}case"RemoveProductItemFromShoppingCart":{if(r.status!=="Pending")throw new e("CART_IS_ALREADY_CLOSED");return I(r.productItems,t.productItem),{type:"ProductItemRemovedFromShoppingCart",data:{shoppingCartId:t.shoppingCartId,productItem:t.productItem}}}case"ConfirmShoppingCart":{if(r.status!=="Pending")throw new e("CART_IS_ALREADY_CLOSED");if(r.productItems.length===0)throw new e("CART_IS_EMPTY");return{type:"ShoppingCartConfirmed",data:{shoppingCartId:t.shoppingCartId,confirmedAt:t.now}}}case"CancelShoppingCart":{if(r.status!=="Pending")throw new e("CART_IS_ALREADY_CLOSED");return{type:"ShoppingCartCanceled",data:{shoppingCartId:t.shoppingCartId,canceledAt:t.now}}}default:{let n=t;throw new a("UNKNOWN_COMMAND_TYPE")}}},u={decide:g,evolve:d,getInitialState:()=>C};export{S as a,I as b,g as c,u as d};
|
|
2
|
+
//# sourceMappingURL=chunk-C2OSPDWQ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkFSMUJ2PTjs = require('./chunk-FSMUJ2PT.js');var S=(p=>(p.CART_ALREADY_EXISTS="CART_ALREADY_EXISTS",p.CART_IS_ALREADY_CLOSED="CART_IS_ALREADY_CLOSED",p.PRODUCT_ITEM_NOT_FOUND="PRODUCT_ITEM_NOT_FOUND",p.CART_IS_EMPTY="CART_IS_EMPTY",p.UNKNOWN_EVENT_TYPE="UNKNOWN_EVENT_TYPE",p.UNKNOWN_COMMAND_TYPE="UNKNOWN_COMMAND_TYPE",p))(S||{}),I= exports.b =(o,{productId:t,quantity:r,unitPrice:n})=>{if((_nullishCoalesce(_optionalChain([o, 'access', _ => _.find, 'call', _2 => _2(i=>i.productId===t&&i.unitPrice==n), 'optionalAccess', _3 => _3.quantity]), () => (0)))<r)throw new (0, _chunkFSMUJ2PTjs.b)("PRODUCT_ITEM_NOT_FOUND")},g= exports.c =({type:o,data:t},r)=>{switch(o){case"OpenShoppingCart":{if(r.status!=="Empty")throw new (0, _chunkFSMUJ2PTjs.b)("CART_ALREADY_EXISTS");return{type:"ShoppingCartOpened",data:{shoppingCartId:t.shoppingCartId,clientId:t.clientId,openedAt:t.now}}}case"AddProductItemToShoppingCart":{if(r.status!=="Pending")throw new (0, _chunkFSMUJ2PTjs.b)("CART_IS_ALREADY_CLOSED");return{type:"ProductItemAddedToShoppingCart",data:{shoppingCartId:t.shoppingCartId,productItem:t.productItem}}}case"RemoveProductItemFromShoppingCart":{if(r.status!=="Pending")throw new (0, _chunkFSMUJ2PTjs.b)("CART_IS_ALREADY_CLOSED");return I(r.productItems,t.productItem),{type:"ProductItemRemovedFromShoppingCart",data:{shoppingCartId:t.shoppingCartId,productItem:t.productItem}}}case"ConfirmShoppingCart":{if(r.status!=="Pending")throw new (0, _chunkFSMUJ2PTjs.b)("CART_IS_ALREADY_CLOSED");if(r.productItems.length===0)throw new (0, _chunkFSMUJ2PTjs.b)("CART_IS_EMPTY");return{type:"ShoppingCartConfirmed",data:{shoppingCartId:t.shoppingCartId,confirmedAt:t.now}}}case"CancelShoppingCart":{if(r.status!=="Pending")throw new (0, _chunkFSMUJ2PTjs.b)("CART_IS_ALREADY_CLOSED");return{type:"ShoppingCartCanceled",data:{shoppingCartId:t.shoppingCartId,canceledAt:t.now}}}default:{let n=t;throw new (0, _chunkFSMUJ2PTjs.a)("UNKNOWN_COMMAND_TYPE")}}},u= exports.d ={decide:g,evolve:_chunkFSMUJ2PTjs.h,getInitialState:()=>_chunkFSMUJ2PTjs.g};exports.a = S; exports.b = I; exports.c = g; exports.d = u;
|
|
2
|
+
//# sourceMappingURL=chunk-DOWC7BOP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var d=(t,e,o,s,a=()=>{})=>{let r=!1,i=t.map(n=>o(n)?(r=!0,s(n)):n).filter(n=>n!==void 0).map(n=>{if(!n)throw Error("That should not happen");return n});return!r&&a()!==void 0?[...t,e]:i};var _assert = require('assert'); var _assert2 = _interopRequireDefault(_assert);var _crypto = require('crypto');var _test = require('test');var c=class
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var d=(t,e,o,s,a=()=>{})=>{let r=!1,i=t.map(n=>o(n)?(r=!0,s(n)):n).filter(n=>n!==void 0).map(n=>{if(!n)throw Error("That should not happen");return n});return!r&&a()!==void 0?[...t,e]:i};var _assert = require('assert'); var _assert2 = _interopRequireDefault(_assert);var _crypto = require('crypto');var _test = require('test');var c=class C extends Error{constructor(e){let o=e&&typeof e=="object"&&"errorCode"in e?e.errorCode:g(e)?e:500,s=e&&typeof e=="object"&&"message"in e?e.message:l(e)?e:`Error with status code '${o}' ocurred during Emmett processing`;super(s),this.errorCode=o,Object.setPrototypeOf(this,C.prototype)}};var u=class E extends c{constructor(e){super({errorCode:400,message:_nullishCoalesce(e, () => ("Validation Error ocurred during Emmett processing"))}),Object.setPrototypeOf(this,E.prototype)}},O= exports.b =class N extends c{constructor(e){super({errorCode:403,message:_nullishCoalesce(e, () => ("Illegal State ocurred during Emmett processing"))}),Object.setPrototypeOf(this,N.prototype)}};var P=(t=>(t.NOT_A_NONEMPTY_STRING="NOT_A_NONEMPTY_STRING",t.NOT_A_POSITIVE_NUMBER="NOT_A_POSITIVE_NUMBER",t.NOT_AN_UNSIGNED_BIGINT="NOT_AN_UNSIGNED_BIGINT",t))(P||{}),g=t=>typeof t=="number"&&t===t,l=t=>typeof t=="string",_= exports.c =t=>{if(!l(t)||t.length===0)throw new u("NOT_A_NONEMPTY_STRING");return t},w= exports.d =t=>{if(!g(t)||t<=0)throw new u("NOT_A_POSITIVE_NUMBER");return t};var S="STREAM_DOES_NOT_EXIST",I="NO_CONCURRENCY_CHECK";var f=(t,e,o=s=>s)=>async(s,a,r,i)=>{let n=o(a),p=await s.aggregateStream(n,{evolve:t,getInitialState:e,read:{expectedStreamVersion:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _2 => _2.expectedStreamVersion]), () => (I))}}),h=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _3 => _3.state]), () => (e())),A=_optionalChain([p, 'optionalAccess', _4 => _4.currentStreamVersion]),m=r(h),y=Array.isArray(m)?m:[m],x=_nullishCoalesce(_nullishCoalesce(_optionalChain([i, 'optionalAccess', _5 => _5.expectedStreamVersion]), () => (A)), () => (S));return{...await s.appendToStream(n,y,{expectedStreamVersion:x}),newState:y.reduce(t,h)}};var D=({decide:t,evolve:e,getInitialState:o},s=a=>a)=>async(a,r,i,n)=>f(e,o,s)(a,r,p=>t(i,p),n);var V=(a=>(a.Empty="Empty",a.Pending="Pending",a.Confirmed="Confirmed",a.Canceled="Canceled",a))(V||{}),M= exports.g ={status:"Empty"},U= exports.h =(t,{type:e,data:o})=>{switch(e){case"ShoppingCartOpened":return{id:o.shoppingCartId,clientId:o.clientId,openedAt:o.openedAt,productItems:[],status:"Pending"};case"ProductItemAddedToShoppingCart":{if(t.status!=="Pending")return t;let{productItems:s}=t,{productItem:a}=o;return{...t,productItems:d(s,a,r=>r.productId===a.productId&&r.unitPrice===a.unitPrice,r=>({...r,quantity:r.quantity+a.quantity}),()=>a)}}case"ProductItemRemovedFromShoppingCart":{if(t.status!=="Pending")return t;let{productItems:s}=t,{productItem:a}=o;return{...t,productItems:d(s,a,r=>r.productId===a.productId&&r.unitPrice===a.unitPrice,r=>({...r,quantity:r.quantity-a.quantity}))}}case"ShoppingCartConfirmed":return t.status!=="Pending"?t:{...t,status:"Confirmed",confirmedAt:o.confirmedAt};case"ShoppingCartCanceled":return t.status!=="Pending"?t:{...t,status:"Canceled",canceledAt:o.canceledAt}}},se= exports.i =t=>t.reduce(U,M),k= exports.j =(r=>(r.CART_IS_ALREADY_CLOSED="CART_IS_ALREADY_CLOSED",r.PRODUCT_ITEM_NOT_FOUND="PRODUCT_ITEM_NOT_FOUND",r.CART_IS_EMPTY="CART_IS_EMPTY",r.UNKNOWN_EVENT_TYPE="UNKNOWN_EVENT_TYPE",r.UNKNOWN_COMMAND_TYPE="UNKNOWN_COMMAND_TYPE",r))(k||{});exports.a = c; exports.b = O; exports.c = _; exports.d = w; exports.e = D; exports.f = V; exports.g = M; exports.h = U; exports.i = se; exports.j = k;
|
|
2
|
+
//# sourceMappingURL=chunk-FSMUJ2PT.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var d=(t,e,o,s,a=()=>{})=>{let r=!1,i=t.map(n=>o(n)?(r=!0,s(n)):n).filter(n=>n!==void 0).map(n=>{if(!n)throw Error("That should not happen");return n});return!r&&a()!==void 0?[...t,e]:i};import H from"assert";import W from"node:assert";import{randomUUID as z}from"node:crypto";import{after as Z,before as tt,describe as et,it as rt}from"node:test";var c=class
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var d=(t,e,o,s,a=()=>{})=>{let r=!1,i=t.map(n=>o(n)?(r=!0,s(n)):n).filter(n=>n!==void 0).map(n=>{if(!n)throw Error("That should not happen");return n});return!r&&a()!==void 0?[...t,e]:i};import H from"assert";import W from"node:assert";import{randomUUID as z}from"node:crypto";import{after as Z,before as tt,describe as et,it as rt}from"node:test";var c=class C extends Error{errorCode;constructor(e){let o=e&&typeof e=="object"&&"errorCode"in e?e.errorCode:g(e)?e:500,s=e&&typeof e=="object"&&"message"in e?e.message:l(e)?e:`Error with status code '${o}' ocurred during Emmett processing`;super(s),this.errorCode=o,Object.setPrototypeOf(this,C.prototype)}};var u=class E extends c{constructor(e){super({errorCode:400,message:e??"Validation Error ocurred during Emmett processing"}),Object.setPrototypeOf(this,E.prototype)}},O=class N extends c{constructor(e){super({errorCode:403,message:e??"Illegal State ocurred during Emmett processing"}),Object.setPrototypeOf(this,N.prototype)}};var P=(t=>(t.NOT_A_NONEMPTY_STRING="NOT_A_NONEMPTY_STRING",t.NOT_A_POSITIVE_NUMBER="NOT_A_POSITIVE_NUMBER",t.NOT_AN_UNSIGNED_BIGINT="NOT_AN_UNSIGNED_BIGINT",t))(P||{}),g=t=>typeof t=="number"&&t===t,l=t=>typeof t=="string",_=t=>{if(!l(t)||t.length===0)throw new u("NOT_A_NONEMPTY_STRING");return t},w=t=>{if(!g(t)||t<=0)throw new u("NOT_A_POSITIVE_NUMBER");return t};var S="STREAM_DOES_NOT_EXIST",I="NO_CONCURRENCY_CHECK";var f=(t,e,o=s=>s)=>async(s,a,r,i)=>{let n=o(a),p=await s.aggregateStream(n,{evolve:t,getInitialState:e,read:{expectedStreamVersion:i?.expectedStreamVersion??I}}),h=p?.state??e(),A=p?.currentStreamVersion,m=r(h),y=Array.isArray(m)?m:[m],x=i?.expectedStreamVersion??A??S;return{...await s.appendToStream(n,y,{expectedStreamVersion:x}),newState:y.reduce(t,h)}};var D=({decide:t,evolve:e,getInitialState:o},s=a=>a)=>async(a,r,i,n)=>f(e,o,s)(a,r,p=>t(i,p),n);import{randomUUID as It}from"crypto";var V=(a=>(a.Empty="Empty",a.Pending="Pending",a.Confirmed="Confirmed",a.Canceled="Canceled",a))(V||{}),M={status:"Empty"},U=(t,{type:e,data:o})=>{switch(e){case"ShoppingCartOpened":return{id:o.shoppingCartId,clientId:o.clientId,openedAt:o.openedAt,productItems:[],status:"Pending"};case"ProductItemAddedToShoppingCart":{if(t.status!=="Pending")return t;let{productItems:s}=t,{productItem:a}=o;return{...t,productItems:d(s,a,r=>r.productId===a.productId&&r.unitPrice===a.unitPrice,r=>({...r,quantity:r.quantity+a.quantity}),()=>a)}}case"ProductItemRemovedFromShoppingCart":{if(t.status!=="Pending")return t;let{productItems:s}=t,{productItem:a}=o;return{...t,productItems:d(s,a,r=>r.productId===a.productId&&r.unitPrice===a.unitPrice,r=>({...r,quantity:r.quantity-a.quantity}))}}case"ShoppingCartConfirmed":return t.status!=="Pending"?t:{...t,status:"Confirmed",confirmedAt:o.confirmedAt};case"ShoppingCartCanceled":return t.status!=="Pending"?t:{...t,status:"Canceled",canceledAt:o.canceledAt}}},se=t=>t.reduce(U,M),k=(r=>(r.CART_IS_ALREADY_CLOSED="CART_IS_ALREADY_CLOSED",r.PRODUCT_ITEM_NOT_FOUND="PRODUCT_ITEM_NOT_FOUND",r.CART_IS_EMPTY="CART_IS_EMPTY",r.UNKNOWN_EVENT_TYPE="UNKNOWN_EVENT_TYPE",r.UNKNOWN_COMMAND_TYPE="UNKNOWN_COMMAND_TYPE",r))(k||{});export{c as a,O as b,_ as c,w as d,D as e,V as f,M as g,U as h,se as i,k as j};
|
|
2
|
+
//# sourceMappingURL=chunk-UBODMERJ.mjs.map
|
package/dist/e2e/decider/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDOWC7BOPjs = require('../../chunk-DOWC7BOP.js');var _chunkFSMUJ2PTjs = require('../../chunk-FSMUJ2PT.js');require('fastify');var a=_chunkFSMUJ2PTjs.e.call(void 0, _chunkDOWC7BOPjs.d),I=o=>100,P= exports.RegisterRoutes =o=>n=>{n.post("/clients/:clientId/shopping-carts",async(e,r)=>{let{clientId:t}=e.params;_chunkFSMUJ2PTjs.c.call(void 0, t);let s=t;return await a(o,s,{type:"OpenShoppingCart",data:{clientId:s,shoppingCartId:s,now:new Date}}),r.code(201).send({id:t})}),n.post("/clients/:clientId/shopping-carts/:shoppingCartId/product-items",async(e,r)=>{let{shoppingCartId:t}=e.params;_chunkFSMUJ2PTjs.c.call(void 0, t);let{productId:s,quantity:c}=e.body,d={productId:_chunkFSMUJ2PTjs.c.call(void 0, s),quantity:_chunkFSMUJ2PTjs.d.call(void 0, c)},m=I(d.productId);return await a(o,t,{type:"AddProductItemToShoppingCart",data:{shoppingCartId:t,productItem:{...d,unitPrice:m}}}),r.code(204).send()}),n.delete("/clients/:clientId/shopping-carts/:shoppingCartId/product-items",async(e,r)=>{let{shoppingCartId:t}=e.params;_chunkFSMUJ2PTjs.c.call(void 0, t);let{productId:s,quantity:c,unitPrice:d}=e.query,m={productId:_chunkFSMUJ2PTjs.c.call(void 0, s),quantity:_chunkFSMUJ2PTjs.d.call(void 0, Number(c)),unitPrice:_chunkFSMUJ2PTjs.d.call(void 0, Number(d))};return await a(o,t,{type:"RemoveProductItemFromShoppingCart",data:{shoppingCartId:t,productItem:m}}),r.code(204).send()}),n.post("/clients/:clientId/shopping-carts/:shoppingCartId/confirm",async(e,r)=>{let{shoppingCartId:t}=e.params;return _chunkFSMUJ2PTjs.c.call(void 0, t),await a(o,t,{type:"ConfirmShoppingCart",data:{shoppingCartId:t,now:new Date}}),r.code(204).send()}),n.delete("/clients/:clientId/shopping-carts/:shoppingCartId",async(e,r)=>{let{shoppingCartId:t}=e.params;_chunkFSMUJ2PTjs.c.call(void 0, t);try{await a(o,t,{type:"CancelShoppingCart",data:{shoppingCartId:t,now:new Date}})}catch(s){return s instanceof Error&&"message"in s?r.code(403).send({detail:s.message}):r.code(403)}return r.code(204).send()})};exports.RegisterRoutes = P; exports.handle = a;
|
|
2
2
|
//# sourceMappingURL=api.js.map
|
package/dist/e2e/decider/api.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as y}from"../../chunk-
|
|
1
|
+
import{d as y}from"../../chunk-C2OSPDWQ.mjs";import{c as i,d as p,e as u}from"../../chunk-UBODMERJ.mjs";import"fastify";var a=u(y),I=o=>100,P=o=>n=>{n.post("/clients/:clientId/shopping-carts",async(e,r)=>{let{clientId:t}=e.params;i(t);let s=t;return await a(o,s,{type:"OpenShoppingCart",data:{clientId:s,shoppingCartId:s,now:new Date}}),r.code(201).send({id:t})}),n.post("/clients/:clientId/shopping-carts/:shoppingCartId/product-items",async(e,r)=>{let{shoppingCartId:t}=e.params;i(t);let{productId:s,quantity:c}=e.body,d={productId:i(s),quantity:p(c)},m=I(d.productId);return await a(o,t,{type:"AddProductItemToShoppingCart",data:{shoppingCartId:t,productItem:{...d,unitPrice:m}}}),r.code(204).send()}),n.delete("/clients/:clientId/shopping-carts/:shoppingCartId/product-items",async(e,r)=>{let{shoppingCartId:t}=e.params;i(t);let{productId:s,quantity:c,unitPrice:d}=e.query,m={productId:i(s),quantity:p(Number(c)),unitPrice:p(Number(d))};return await a(o,t,{type:"RemoveProductItemFromShoppingCart",data:{shoppingCartId:t,productItem:m}}),r.code(204).send()}),n.post("/clients/:clientId/shopping-carts/:shoppingCartId/confirm",async(e,r)=>{let{shoppingCartId:t}=e.params;return i(t),await a(o,t,{type:"ConfirmShoppingCart",data:{shoppingCartId:t,now:new Date}}),r.code(204).send()}),n.delete("/clients/:clientId/shopping-carts/:shoppingCartId",async(e,r)=>{let{shoppingCartId:t}=e.params;i(t);try{await a(o,t,{type:"CancelShoppingCart",data:{shoppingCartId:t,now:new Date}})}catch(s){return s instanceof Error&&"message"in s?r.code(403).send({detail:s.message}):r.code(403)}return r.code(204).send()})};export{P as RegisterRoutes,a as handle};
|
|
2
2
|
//# sourceMappingURL=api.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDOWC7BOPjs = require('../../chunk-DOWC7BOP.js');require('../../chunk-FSMUJ2PT.js');exports.ShoppingCartErrors = _chunkDOWC7BOPjs.a; exports.assertProductItemExists = _chunkDOWC7BOPjs.b; exports.decide = _chunkDOWC7BOPjs.c; exports.decider = _chunkDOWC7BOPjs.d;
|
|
2
2
|
//# sourceMappingURL=businessLogic.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d}from"../../chunk-
|
|
1
|
+
import{a,b,c,d}from"../../chunk-C2OSPDWQ.mjs";import"../../chunk-UBODMERJ.mjs";export{a as ShoppingCartErrors,b as assertProductItemExists,c as decide,d as decider};
|
|
2
2
|
//# sourceMappingURL=businessLogic.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFSMUJ2PTjs = require('../../chunk-FSMUJ2PT.js');exports.ShoppingCartErrors = _chunkFSMUJ2PTjs.j; exports.ShoppingCartStatus = _chunkFSMUJ2PTjs.f; exports.emptyShoppingCart = _chunkFSMUJ2PTjs.g; exports.evolve = _chunkFSMUJ2PTjs.h; exports.getShoppingCart = _chunkFSMUJ2PTjs.i;
|
|
2
2
|
//# sourceMappingURL=shoppingCart.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as a,g as b,h as c,i as d,j as e}from"../../chunk-
|
|
1
|
+
import{f as a,g as b,h as c,i as d,j as e}from"../../chunk-UBODMERJ.mjs";export{e as ShoppingCartErrors,a as ShoppingCartStatus,b as emptyShoppingCart,c as evolve,d as getShoppingCart};
|
|
2
2
|
//# sourceMappingURL=shoppingCart.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-driven-io/emmett-fastify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Emmett - Event Sourcing development made simple",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {},
|
|
53
53
|
"devDependencies": {},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@event-driven-io/emmett": "^0.
|
|
55
|
+
"@event-driven-io/emmett": "^0.7.0",
|
|
56
56
|
"fastify": "4.26.2",
|
|
57
57
|
"@fastify/compress": "7.0.0",
|
|
58
58
|
"@fastify/etag": "5.1.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|