equipped 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/server/adapters/express/index.cjs +47 -1
  3. package/dist/cjs/server/adapters/express/index.cjs.map +1 -1
  4. package/dist/cjs/server/adapters/express/index.min.cjs +6 -6
  5. package/dist/cjs/server/adapters/express/index.min.cjs.map +1 -1
  6. package/dist/cjs/server/adapters/fastify/index.cjs +47 -1
  7. package/dist/cjs/server/adapters/fastify/index.cjs.map +1 -1
  8. package/dist/cjs/server/adapters/fastify/index.min.cjs +6 -6
  9. package/dist/cjs/server/adapters/fastify/index.min.cjs.map +1 -1
  10. package/dist/cjs/server/index.cjs +47 -1
  11. package/dist/cjs/server/index.cjs.map +1 -1
  12. package/dist/cjs/server/index.min.cjs +6 -6
  13. package/dist/cjs/server/index.min.cjs.map +1 -1
  14. package/dist/esm/cache/adapters/in-memory/index.min.mjs +1 -1
  15. package/dist/esm/cache/adapters/in-memory/index.mjs +2 -2
  16. package/dist/esm/cache/adapters/redis/index.min.mjs +1 -1
  17. package/dist/esm/cache/adapters/redis/index.mjs +3 -3
  18. package/dist/esm/cache/index.min.mjs +1 -1
  19. package/dist/esm/cache/index.mjs +2 -2
  20. package/dist/esm/{chunk-QHLKB47N.min.mjs → chunk-2GGMLKRP.min.mjs} +2 -2
  21. package/dist/esm/{chunk-PQCBVQL6.mjs → chunk-3TP7NINX.mjs} +2 -2
  22. package/dist/esm/{chunk-PNZNNUMN.mjs → chunk-5PZACGPI.mjs} +3 -3
  23. package/dist/esm/{chunk-ZGMFFK6Y.min.mjs → chunk-676VIABN.min.mjs} +2 -2
  24. package/dist/esm/{chunk-4MXYZS5R.mjs → chunk-7CP7ZE2O.mjs} +2 -2
  25. package/dist/esm/{chunk-5VW3JAFR.min.mjs → chunk-7NF7PV6S.min.mjs} +2 -2
  26. package/dist/esm/{chunk-4JLDXF7T.min.mjs → chunk-7SQ5JQYR.min.mjs} +2 -2
  27. package/dist/esm/{chunk-MDQKODYQ.mjs → chunk-A4P7P6BU.mjs} +48 -2
  28. package/dist/esm/chunk-A4P7P6BU.mjs.map +1 -0
  29. package/dist/esm/{chunk-JH6EBXY4.mjs → chunk-BWUFPMVG.mjs} +2 -2
  30. package/dist/esm/{chunk-AKQBDYUO.mjs → chunk-HXFNN6RI.mjs} +3 -3
  31. package/dist/esm/{chunk-FLAPYQUT.min.mjs → chunk-IN5YKIJ7.min.mjs} +7 -7
  32. package/dist/esm/chunk-IN5YKIJ7.min.mjs.map +1 -0
  33. package/dist/esm/{chunk-PCAUXBAG.min.mjs → chunk-IRYCN6PI.min.mjs} +2 -2
  34. package/dist/esm/{chunk-Z2TZ3KR7.mjs → chunk-LKS5ZE45.mjs} +2 -2
  35. package/dist/esm/{chunk-SGZNOYC3.min.mjs → chunk-MQXTTWPS.min.mjs} +2 -2
  36. package/dist/esm/{chunk-B5QQ32YY.min.mjs → chunk-P4PRHHIY.min.mjs} +2 -2
  37. package/dist/esm/{chunk-TVTYDU2D.mjs → chunk-TSVHZZE4.mjs} +3 -3
  38. package/dist/esm/dbs/adapters/mongodb/index.min.mjs +1 -1
  39. package/dist/esm/dbs/adapters/mongodb/index.mjs +3 -3
  40. package/dist/esm/dbs/index.min.mjs +1 -1
  41. package/dist/esm/dbs/index.mjs +3 -3
  42. package/dist/esm/errors/index.min.mjs +1 -1
  43. package/dist/esm/errors/index.mjs +1 -1
  44. package/dist/esm/events/adapters/kafka/index.min.mjs +1 -1
  45. package/dist/esm/events/adapters/kafka/index.mjs +2 -2
  46. package/dist/esm/events/adapters/rabbitmq/index.min.mjs +1 -1
  47. package/dist/esm/events/adapters/rabbitmq/index.mjs +1 -1
  48. package/dist/esm/index.min.mjs +1 -1
  49. package/dist/esm/index.mjs +1 -1
  50. package/dist/esm/instance/index.min.mjs +1 -1
  51. package/dist/esm/instance/index.mjs +1 -1
  52. package/dist/esm/introspection-THKMXV5V.min.mjs +2 -0
  53. package/dist/esm/{introspection-32BRYKYY.mjs → introspection-YJF3QAUK.mjs} +3 -3
  54. package/dist/esm/jobs/adapters/redis/index.min.mjs +1 -1
  55. package/dist/esm/jobs/adapters/redis/index.mjs +3 -3
  56. package/dist/esm/orm/adapters/in-memory/index.min.mjs +1 -1
  57. package/dist/esm/orm/adapters/in-memory/index.mjs +3 -3
  58. package/dist/esm/orm/adapters/json/index.min.mjs +1 -1
  59. package/dist/esm/orm/adapters/json/index.mjs +3 -3
  60. package/dist/esm/orm/adapters/mongodb/index.min.mjs +1 -1
  61. package/dist/esm/orm/adapters/mongodb/index.mjs +2 -2
  62. package/dist/esm/orm/adapters/postgresql/index.min.mjs +2 -2
  63. package/dist/esm/orm/adapters/postgresql/index.mjs +3 -3
  64. package/dist/esm/orm/index.min.mjs +1 -1
  65. package/dist/esm/orm/index.mjs +3 -3
  66. package/dist/esm/server/adapters/express/index.min.mjs +1 -1
  67. package/dist/esm/server/adapters/express/index.mjs +1 -1
  68. package/dist/esm/server/adapters/fastify/index.min.mjs +1 -1
  69. package/dist/esm/server/adapters/fastify/index.mjs +1 -1
  70. package/dist/esm/server/index.min.mjs +1 -1
  71. package/dist/esm/server/index.mjs +1 -1
  72. package/dist/esm/utilities/index.min.mjs +1 -1
  73. package/dist/esm/utilities/index.mjs +1 -1
  74. package/dist/esm/validations/index.min.mjs +1 -1
  75. package/dist/esm/validations/index.mjs +1 -1
  76. package/dist/types/{base-DVr0fHil.d.ts → base-BDTBLZ9a.d.ts} +7 -1
  77. package/dist/types/cache/adapters/in-memory/index.js +2 -2
  78. package/dist/types/cache/adapters/redis/index.js +3 -3
  79. package/dist/types/cache/index.js +2 -2
  80. package/dist/types/{chunk-NJ2FHI3U.js → chunk-4DH3POYM.js} +2 -2
  81. package/dist/types/{chunk-OHFTQGQG.js → chunk-55CTVK7R.js} +1 -1
  82. package/dist/types/{chunk-JQ2FWX4W.js → chunk-5Z26ZURE.js} +1 -1
  83. package/dist/types/{chunk-3M4PBZAQ.js → chunk-IZDJDGOV.js} +2 -2
  84. package/dist/types/{chunk-XGGGAEET.js → chunk-J3TGB5YQ.js} +1 -1
  85. package/dist/types/{chunk-3TKJGSCZ.js → chunk-LPB5LS7A.js} +1 -1
  86. package/dist/types/{chunk-YTY3EFNB.js → chunk-TT5EORDK.js} +47 -1
  87. package/dist/types/{chunk-65EHKCDZ.js → chunk-YLJNBL6J.js} +2 -2
  88. package/dist/types/dbs/adapters/mongodb/index.js +3 -3
  89. package/dist/types/dbs/index.js +3 -3
  90. package/dist/types/errors/index.js +1 -1
  91. package/dist/types/events/adapters/kafka/index.js +2 -2
  92. package/dist/types/events/adapters/rabbitmq/index.js +1 -1
  93. package/dist/types/index.js +1 -1
  94. package/dist/types/instance/index.js +1 -1
  95. package/dist/types/{introspection-VOIU3XE6.js → introspection-EHGM4RMO.js} +2 -2
  96. package/dist/types/jobs/adapters/redis/index.js +3 -3
  97. package/dist/types/orm/adapters/in-memory/index.js +3 -3
  98. package/dist/types/orm/adapters/json/index.js +3 -3
  99. package/dist/types/orm/adapters/mongodb/index.js +2 -2
  100. package/dist/types/orm/adapters/postgresql/index.js +3 -3
  101. package/dist/types/orm/index.js +3 -3
  102. package/dist/types/server/adapters/express/index.d.ts +1 -1
  103. package/dist/types/server/adapters/express/index.js +1 -1
  104. package/dist/types/server/adapters/fastify/index.d.ts +1 -1
  105. package/dist/types/server/adapters/fastify/index.js +1 -1
  106. package/dist/types/server/index.d.ts +2 -2
  107. package/dist/types/server/index.js +1 -1
  108. package/dist/types/utilities/index.js +1 -1
  109. package/dist/types/validations/index.js +1 -1
  110. package/package.json +1 -1
  111. package/dist/esm/chunk-FLAPYQUT.min.mjs.map +0 -1
  112. package/dist/esm/chunk-MDQKODYQ.mjs.map +0 -1
  113. package/dist/esm/introspection-A72WMWE3.min.mjs +0 -2
  114. /package/dist/esm/{chunk-QHLKB47N.min.mjs.map → chunk-2GGMLKRP.min.mjs.map} +0 -0
  115. /package/dist/esm/{chunk-PQCBVQL6.mjs.map → chunk-3TP7NINX.mjs.map} +0 -0
  116. /package/dist/esm/{chunk-PNZNNUMN.mjs.map → chunk-5PZACGPI.mjs.map} +0 -0
  117. /package/dist/esm/{chunk-ZGMFFK6Y.min.mjs.map → chunk-676VIABN.min.mjs.map} +0 -0
  118. /package/dist/esm/{chunk-4MXYZS5R.mjs.map → chunk-7CP7ZE2O.mjs.map} +0 -0
  119. /package/dist/esm/{chunk-5VW3JAFR.min.mjs.map → chunk-7NF7PV6S.min.mjs.map} +0 -0
  120. /package/dist/esm/{chunk-4JLDXF7T.min.mjs.map → chunk-7SQ5JQYR.min.mjs.map} +0 -0
  121. /package/dist/esm/{chunk-JH6EBXY4.mjs.map → chunk-BWUFPMVG.mjs.map} +0 -0
  122. /package/dist/esm/{chunk-AKQBDYUO.mjs.map → chunk-HXFNN6RI.mjs.map} +0 -0
  123. /package/dist/esm/{chunk-PCAUXBAG.min.mjs.map → chunk-IRYCN6PI.min.mjs.map} +0 -0
  124. /package/dist/esm/{chunk-Z2TZ3KR7.mjs.map → chunk-LKS5ZE45.mjs.map} +0 -0
  125. /package/dist/esm/{chunk-SGZNOYC3.min.mjs.map → chunk-MQXTTWPS.min.mjs.map} +0 -0
  126. /package/dist/esm/{chunk-B5QQ32YY.min.mjs.map → chunk-P4PRHHIY.min.mjs.map} +0 -0
  127. /package/dist/esm/{chunk-TVTYDU2D.mjs.map → chunk-TSVHZZE4.mjs.map} +0 -0
  128. /package/dist/esm/{introspection-32BRYKYY.mjs.map → introspection-THKMXV5V.min.mjs.map} +0 -0
  129. /package/dist/esm/{introspection-A72WMWE3.min.mjs.map → introspection-YJF3QAUK.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as r}from "../../../chunk-PCAUXBAG.min.mjs";import{K as n,m as s}from "../../../chunk-FLAPYQUT.min.mjs";import"../../../chunk-DSUJ5FUL.min.mjs";import"../../../chunk-AQY7QVYI.min.mjs";import{v as p}from"valleyed";var l=()=>p.object({}),i=class a extends s(l,r){#e=new Map;#t;constructor(t){super(t),n.on("start",async()=>{this.#t=setInterval(()=>{let e=Date.now();for(let[o,c]of this.#e.entries())c.expiredAt&&c.expiredAt<=e&&this.#e.delete(o)},5e3)},{class:a}),n.on("close",async()=>clearInterval(this.#t),{class:a})}async delete(t){this.#e.delete(this.getScopedKey(t))}async get(t){let e=this.#e.get(this.getScopedKey(t));return e&&(e.expiredAt===void 0||e.expiredAt>Date.now())?e.data:null}async set(t,e,o){this.#e.set(this.getScopedKey(t),{data:e,expiredAt:o?Date.now()+o*1e3:void 0})}};export{i as InMemoryCache,l as inMemoryCacheConfigPipe};
1
+ import{a as r}from "../../../chunk-IRYCN6PI.min.mjs";import{K as n,m as s}from "../../../chunk-IN5YKIJ7.min.mjs";import"../../../chunk-DSUJ5FUL.min.mjs";import"../../../chunk-AQY7QVYI.min.mjs";import{v as p}from"valleyed";var l=()=>p.object({}),i=class a extends s(l,r){#e=new Map;#t;constructor(t){super(t),n.on("start",async()=>{this.#t=setInterval(()=>{let e=Date.now();for(let[o,c]of this.#e.entries())c.expiredAt&&c.expiredAt<=e&&this.#e.delete(o)},5e3)},{class:a}),n.on("close",async()=>clearInterval(this.#t),{class:a})}async delete(t){this.#e.delete(this.getScopedKey(t))}async get(t){let e=this.#e.get(this.getScopedKey(t));return e&&(e.expiredAt===void 0||e.expiredAt>Date.now())?e.data:null}async set(t,e,o){this.#e.set(this.getScopedKey(t),{data:e,expiredAt:o?Date.now()+o*1e3:void 0})}};export{i as InMemoryCache,l as inMemoryCacheConfigPipe};
2
2
  //# sourceMappingURL=index.min.mjs.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Cache
3
- } from "../../../chunk-Z2TZ3KR7.mjs";
3
+ } from "../../../chunk-LKS5ZE45.mjs";
4
4
  import {
5
5
  Instance,
6
6
  configurable
7
- } from "../../../chunk-MDQKODYQ.mjs";
7
+ } from "../../../chunk-A4P7P6BU.mjs";
8
8
  import "../../../chunk-VCCS7CAI.mjs";
9
9
  import "../../../chunk-J5LGTIGS.mjs";
10
10
 
@@ -1,2 +1,2 @@
1
- import{a,b}from "../../../chunk-5VW3JAFR.min.mjs";import"../../../chunk-PCAUXBAG.min.mjs";import"../../../chunk-FLAPYQUT.min.mjs";import"../../../chunk-DSUJ5FUL.min.mjs";import"../../../chunk-AQY7QVYI.min.mjs";export{b as RedisCache,a as redisConfigPipe};
1
+ import{a,b}from "../../../chunk-7NF7PV6S.min.mjs";import"../../../chunk-IRYCN6PI.min.mjs";import"../../../chunk-IN5YKIJ7.min.mjs";import"../../../chunk-DSUJ5FUL.min.mjs";import"../../../chunk-AQY7QVYI.min.mjs";export{b as RedisCache,a as redisConfigPipe};
2
2
  //# sourceMappingURL=index.min.mjs.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  RedisCache,
3
3
  redisConfigPipe
4
- } from "../../../chunk-PNZNNUMN.mjs";
5
- import "../../../chunk-Z2TZ3KR7.mjs";
6
- import "../../../chunk-MDQKODYQ.mjs";
4
+ } from "../../../chunk-5PZACGPI.mjs";
5
+ import "../../../chunk-LKS5ZE45.mjs";
6
+ import "../../../chunk-A4P7P6BU.mjs";
7
7
  import "../../../chunk-VCCS7CAI.mjs";
8
8
  import "../../../chunk-J5LGTIGS.mjs";
9
9
  export {
@@ -1,2 +1,2 @@
1
- import{a as o}from "../chunk-PCAUXBAG.min.mjs";import"../chunk-FLAPYQUT.min.mjs";import"../chunk-DSUJ5FUL.min.mjs";import"../chunk-AQY7QVYI.min.mjs";export{o as Cache};
1
+ import{a as o}from "../chunk-IRYCN6PI.min.mjs";import"../chunk-IN5YKIJ7.min.mjs";import"../chunk-DSUJ5FUL.min.mjs";import"../chunk-AQY7QVYI.min.mjs";export{o as Cache};
2
2
  //# sourceMappingURL=index.min.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Cache
3
- } from "../chunk-Z2TZ3KR7.mjs";
4
- import "../chunk-MDQKODYQ.mjs";
3
+ } from "../chunk-LKS5ZE45.mjs";
4
+ import "../chunk-A4P7P6BU.mjs";
5
5
  import "../chunk-VCCS7CAI.mjs";
6
6
  import "../chunk-J5LGTIGS.mjs";
7
7
  export {
@@ -1,2 +1,2 @@
1
- import{b as s}from "./chunk-SGZNOYC3.min.mjs";import{K as a}from "./chunk-FLAPYQUT.min.mjs";var o=class{constructor(n){this.config=n}getScopedDb(n){return a.get().getScopedName(n).replaceAll(".","-")}};import{v as u}from"valleyed";var x=()=>u.object({debeziumUrl:u.string(),eventBus:u.instanceOf(s)});import{v as e}from"valleyed";var i=(p=>(p.and="and",p.or="or",p))(i||{}),y=(r=>(r.lt="lt",r.lte="lte",r.gt="gt",r.gte="gte",r.eq="eq",r.ne="ne",r.in="in",r.nin="nin",r))(y||{}),l=e.catch(e.defaults(e.in(["and","or"]),"and"),"and"),f=e.object({field:e.string(),value:e.any(),condition:e.catch(e.defaults(e.in(Object.values(y)),"eq"),"eq")}),c=e.recursive(()=>e.discriminate(t=>Object.values(i).includes(t.condition)?"block":"regular",{block:e.object({condition:l,value:e.array(c)}),regular:f}),"QueryWhereBlock"),d=e.defaults(e.array(c),[]);function m(){return e.meta(e.object({all:e.defaults(e.boolean(),!1),limit:e.lazy(()=>{let t=a.get().settings.utils.paginationDefaultLimit;return e.catch(e.defaults(e.number().pipe(e.lte(t)),t),t)}),page:e.catch(e.defaults(e.number().pipe(e.gte(1)),1),1),search:e.defaults(e.nullish(e.object({value:e.string(),fields:e.array(e.string())})),null),sort:e.defaults(e.array(e.object({field:e.string(),desc:e.defaults(e.boolean(),!1)})),[]),whereType:l,where:d,select:e.optional(e.array(e.string()))}).pipe(t=>({...t,auth:[],authType:"and"})),{title:"Query Params",$refId:"QueryParams"})}function O(t){return e.object({pages:e.object({current:e.number(),start:e.number(),last:e.number(),previous:e.nullable(e.number()),next:e.nullable(e.number())}),docs:e.object({limit:e.number(),total:e.number(),count:e.number()}),results:e.array(t)})}function v(t){return e.assert(m(),t)}export{o as a,x as b,i as c,y as d,m as e,O as f,v as g};
2
- //# sourceMappingURL=chunk-QHLKB47N.min.mjs.map
1
+ import{b as s}from "./chunk-MQXTTWPS.min.mjs";import{K as a}from "./chunk-IN5YKIJ7.min.mjs";var o=class{constructor(n){this.config=n}getScopedDb(n){return a.get().getScopedName(n).replaceAll(".","-")}};import{v as u}from"valleyed";var x=()=>u.object({debeziumUrl:u.string(),eventBus:u.instanceOf(s)});import{v as e}from"valleyed";var i=(p=>(p.and="and",p.or="or",p))(i||{}),y=(r=>(r.lt="lt",r.lte="lte",r.gt="gt",r.gte="gte",r.eq="eq",r.ne="ne",r.in="in",r.nin="nin",r))(y||{}),l=e.catch(e.defaults(e.in(["and","or"]),"and"),"and"),f=e.object({field:e.string(),value:e.any(),condition:e.catch(e.defaults(e.in(Object.values(y)),"eq"),"eq")}),c=e.recursive(()=>e.discriminate(t=>Object.values(i).includes(t.condition)?"block":"regular",{block:e.object({condition:l,value:e.array(c)}),regular:f}),"QueryWhereBlock"),d=e.defaults(e.array(c),[]);function m(){return e.meta(e.object({all:e.defaults(e.boolean(),!1),limit:e.lazy(()=>{let t=a.get().settings.utils.paginationDefaultLimit;return e.catch(e.defaults(e.number().pipe(e.lte(t)),t),t)}),page:e.catch(e.defaults(e.number().pipe(e.gte(1)),1),1),search:e.defaults(e.nullish(e.object({value:e.string(),fields:e.array(e.string())})),null),sort:e.defaults(e.array(e.object({field:e.string(),desc:e.defaults(e.boolean(),!1)})),[]),whereType:l,where:d,select:e.optional(e.array(e.string()))}).pipe(t=>({...t,auth:[],authType:"and"})),{title:"Query Params",$refId:"QueryParams"})}function O(t){return e.object({pages:e.object({current:e.number(),start:e.number(),last:e.number(),previous:e.nullable(e.number()),next:e.nullable(e.number())}),docs:e.object({limit:e.number(),total:e.number(),count:e.number()}),results:e.array(t)})}function v(t){return e.assert(m(),t)}export{o as a,x as b,i as c,y as d,m as e,O as f,v as g};
2
+ //# sourceMappingURL=chunk-2GGMLKRP.min.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EquippedError,
3
3
  Instance
4
- } from "./chunk-MDQKODYQ.mjs";
4
+ } from "./chunk-A4P7P6BU.mjs";
5
5
 
6
6
  // src/orm/errors/validation.ts
7
7
  var OrmValidationError = class extends EquippedError {
@@ -1277,4 +1277,4 @@ export {
1277
1277
  opTouchedFields,
1278
1278
  flattenOps
1279
1279
  };
1280
- //# sourceMappingURL=chunk-PQCBVQL6.mjs.map
1280
+ //# sourceMappingURL=chunk-3TP7NINX.mjs.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Cache
3
- } from "./chunk-Z2TZ3KR7.mjs";
3
+ } from "./chunk-LKS5ZE45.mjs";
4
4
  import {
5
5
  EquippedError,
6
6
  Instance,
7
7
  configurable
8
- } from "./chunk-MDQKODYQ.mjs";
8
+ } from "./chunk-A4P7P6BU.mjs";
9
9
 
10
10
  // src/cache/adapters/redis/index.ts
11
11
  import { Cluster, Redis } from "ioredis";
@@ -110,4 +110,4 @@ export {
110
110
  redisConfigPipe,
111
111
  RedisCache
112
112
  };
113
- //# sourceMappingURL=chunk-PNZNNUMN.mjs.map
113
+ //# sourceMappingURL=chunk-5PZACGPI.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as r}from "./chunk-FLAPYQUT.min.mjs";var t=class extends r{adapter;table;constructor(e){super(`Introspection failed for table '${e.table}' on adapter '${e.adapter}'`,{adapter:e.adapter,table:e.table},e.cause),this.adapter=e.adapter,this.table=e.table}};export{t as a};
2
- //# sourceMappingURL=chunk-ZGMFFK6Y.min.mjs.map
1
+ import{a as r}from "./chunk-IN5YKIJ7.min.mjs";var t=class extends r{adapter;table;constructor(e){super(`Introspection failed for table '${e.table}' on adapter '${e.adapter}'`,{adapter:e.adapter,table:e.table},e.cause),this.adapter=e.adapter,this.table=e.table}};export{t as a};
2
+ //# sourceMappingURL=chunk-676VIABN.min.mjs.map
@@ -4,7 +4,7 @@ import {
4
4
  configurable,
5
5
  parseJSONValue,
6
6
  random_exports
7
- } from "./chunk-MDQKODYQ.mjs";
7
+ } from "./chunk-A4P7P6BU.mjs";
8
8
  import {
9
9
  EventBus
10
10
  } from "./chunk-VCCS7CAI.mjs";
@@ -99,4 +99,4 @@ export {
99
99
  kafkaConfigPipe,
100
100
  KafkaEventBus
101
101
  };
102
- //# sourceMappingURL=chunk-4MXYZS5R.mjs.map
102
+ //# sourceMappingURL=chunk-7CP7ZE2O.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as p}from "./chunk-PCAUXBAG.min.mjs";import{K as n,a as c,m as r}from "./chunk-FLAPYQUT.min.mjs";import{Cluster as d,Redis as u}from"ioredis";import{v as t}from"valleyed";var m=()=>t.meta(t.object({host:t.string(),port:t.optional(t.number()),password:t.optional(t.string()),username:t.optional(t.string()),tls:t.optional(t.boolean()),cluster:t.optional(t.boolean())}),{title:"Redis Config",$refId:"RedisConfig"}),l=class a extends r(m,p){#e;constructor(e,s){super(e);let o={...e.host?{host:e.host}:{},...e.port?{port:e.port}:{}},i={...s,...e.password?{password:e.password}:{},...e.username?{username:e.username}:{},...e.tls?{tls:{}}:{},lazyConnect:!0};this.#e=e.cluster?new d([o],{...s,redisOptions:i,lazyConnect:!0}):new u({...i,...o}),this.#e.on("error",async h=>{n.crash(new c("Redis failed with error",{},h))}),s||n.on("start",async()=>this.#e.connect(),{class:a}),n.on("close",async()=>this.#e.quit(),{class:a})}get connectionOptions(){return this.#e.options}async delete(e){await this.#e.del(this.getScopedKey(e))}async get(e){return await this.#e.get(this.getScopedKey(e))}async set(e,s,o){o?await this.#e.setex(this.getScopedKey(e),o,s):this.#e.set(this.getScopedKey(e),s)}};export{m as a,l as b};
2
- //# sourceMappingURL=chunk-5VW3JAFR.min.mjs.map
1
+ import{a as p}from "./chunk-IRYCN6PI.min.mjs";import{K as n,a as c,m as r}from "./chunk-IN5YKIJ7.min.mjs";import{Cluster as d,Redis as u}from"ioredis";import{v as t}from"valleyed";var m=()=>t.meta(t.object({host:t.string(),port:t.optional(t.number()),password:t.optional(t.string()),username:t.optional(t.string()),tls:t.optional(t.boolean()),cluster:t.optional(t.boolean())}),{title:"Redis Config",$refId:"RedisConfig"}),l=class a extends r(m,p){#e;constructor(e,s){super(e);let o={...e.host?{host:e.host}:{},...e.port?{port:e.port}:{}},i={...s,...e.password?{password:e.password}:{},...e.username?{username:e.username}:{},...e.tls?{tls:{}}:{},lazyConnect:!0};this.#e=e.cluster?new d([o],{...s,redisOptions:i,lazyConnect:!0}):new u({...i,...o}),this.#e.on("error",async h=>{n.crash(new c("Redis failed with error",{},h))}),s||n.on("start",async()=>this.#e.connect(),{class:a}),n.on("close",async()=>this.#e.quit(),{class:a})}get connectionOptions(){return this.#e.options}async delete(e){await this.#e.del(this.getScopedKey(e))}async get(e){return await this.#e.get(this.getScopedKey(e))}async set(e,s,o){o?await this.#e.setex(this.getScopedKey(e),o,s):this.#e.set(this.getScopedKey(e),s)}};export{m as a,l as b};
2
+ //# sourceMappingURL=chunk-7NF7PV6S.min.mjs.map
@@ -1,2 +1,2 @@
1
- import{K as x,a as m}from "./chunk-FLAPYQUT.min.mjs";var f=class extends m{constructor(t,r,c,l){super(`ORM validation error (${t}) on ${r}.${c}`,{kind:t,schema:r,operation:c,failures:l});this.kind=t;this.schema=r;this.operation=c;this.failures=l}};import"valleyed";var O=class{name;path;constructor(e,t){this.name=e,this.path=t??[e]}};function p(a){return a instanceof O?a.path.join("."):a}var T=class extends O{pipe;onCreate;onUpdate;constructor(e,t,r){super(e),this.pipe=t,this.onCreate=r?.onCreate,this.onUpdate=r?.onUpdate}},P=class{constructor(e,t,r,c){this.name=e;this.pipe=t;this.deps=r;this.compute=c}};var i=class{constructor(e,t,r){this.op=t;this.value=r;this.field=p(e)}field},g=class a{constructor(e="and",t){this.op=e;this.children=t??[]}children;#e(e){return new a(this.op,[...this.children,e])}eq(e,t){return this.#e(new i(e,"eq",t))}ne(e,t){return this.#e(new i(e,"ne",t))}gt(e,t){return this.#e(new i(e,"gt",t))}gte(e,t){return this.#e(new i(e,"gte",t))}lt(e,t){return this.#e(new i(e,"lt",t))}lte(e,t){return this.#e(new i(e,"lte",t))}in(e,t){return this.#e(new i(e,"in",t))}notIn(e,t){return this.#e(new i(e,"notIn",t))}like(e,t){return this.#e(new i(e,"like",t))}exists(e){return this.#e(new i(e,"exists",!0))}notExists(e){return this.#e(new i(e,"notExists",!0))}contains(e,t){return this.#e(new i(e,"contains",t))}notContains(e,t){return this.#e(new i(e,"notContains",t))}and(e){if(e.length===0)throw new m("and() requires at least one filter factory",{op:"and"});let t=new a("and",e.map(r=>r(a.create())));return this.#e(t)}or(e){if(e.length===0)throw new m("or() requires at least one filter factory",{op:"or"});let t=new a("or",e.map(r=>r(a.create())));return this.#e(t)}clone(){return new a(this.op,this.children.map(e=>e instanceof i?new i(e.field,e.op,structuredClone(e.value)):e.clone()))}static create(){return new a}};function V(a,e,t){let r=[];t.aggregates.length===0&&r.push({cause:"At least one aggregator step is required"});let c=new Set;for(let s of t.aggregates)c.has(s.alias)&&r.push({alias:s.alias,cause:`Duplicate alias "${s.alias}"`}),c.add(s.alias),e.aggregateOps.includes(s.fn)||r.push({alias:s.alias,cause:`Undeclared aggregate op "${s.fn}"`});let l=a.fields,n=new Set(Object.keys(l));for(let s of t.groupBy)n.has(s)||r.push({field:s,cause:`Unknown groupBy field "${s}" on schema "${a.name}"`}),c.has(s)&&r.push({alias:s,cause:`Alias "${s}" collides with groupBy field name`});if(r.length>0)throw new f("aggregate",a.name,"aggregate",r);if(t.where&&E(a,t.where),t.having){let h=function(d){if(d instanceof i)s.has(d.field)||u.push({field:d.field,cause:`Unknown having field "${d.field}" \u2014 must be an aggregator alias or groupBy field`});else if(d instanceof g)for(let U of d.children)h(U)};var o=h;let s=new Set([...c,...t.groupBy]),u=[];for(let d of t.having.children)h(d);if(u.length>0)throw new f("aggregate",a.name,"aggregate",u)}}function E(a,e){let t=a.fields,r=new Set(Object.keys(t)),c=[];function l(n){if(n instanceof i)r.has(n.field)||c.push({field:n.field,cause:`Unknown field "${n.field}" on schema "${a.name}"`});else if(n instanceof g)for(let o of n.children)l(o)}for(let n of e.children)l(n);if(c.length>0)throw new f("validation",a.name,"filter",c.map(n=>({field:n.field,cause:n.cause})))}var q=class{queryableOps=[];updateOps=[];aggregateOps=[];supportedFieldTypes=[];onFatalError(e){let t=e instanceof m?e:new m("OrmAdapter fatal error",{},e);x.crash(t)}constructor(){let e=this;typeof e.connect=="function"&&x.on("start",()=>e.connect(),{class:this.constructor}),typeof e.disconnect=="function"&&x.on("close",()=>e.disconnect(),{class:this.constructor})}use(e,t){let r=this,c=async function*(){},l={findMany:(n,o)=>r.findMany?.(e,t,n,o)??Promise.resolve([]),iterateMany:(n,o)=>r.iterateMany?.(e,t,n,o)??c(),findOne:async n=>(await l.findMany(n,{limit:1}))[0]??null,count:n=>r.count?.(e,t,n)??Promise.reject(new Error("count not implemented")),createOne:async n=>(await l.createMany([n]))[0],createMany:n=>r.createMany?.(e,t,n)??Promise.resolve([]),updateMany:(n,o)=>r.updateMany?.(e,t,n,o)??Promise.resolve([]),updateOne:async(n,o)=>{let s=await l.findOne(n);if(!s)return null;let u=e.pkField.name,h=g.create().eq(u,s[u]);return(await l.updateMany(h,o))[0]??null},upsertOne:(n,o,s)=>r.upsertOne?.(e,t,n,o,s)??Promise.reject(new Error("upsertOne not implemented")),deleteOne:async n=>{let o=await l.findOne(n);if(!o)return null;let s=e.pkField.name;if(r.deleteByPk)await r.deleteByPk(e,t,o[s]);else if(r.deleteMany){let u=g.create().eq(s,o[s]);await r.deleteMany(e,t,u)}return o},deleteMany:n=>r.deleteMany?.(e,t,n)??Promise.resolve([]),raw:(...n)=>r.raw?.(e,t,...n)??Promise.reject(new Error("raw not implemented")),aggregate:n=>r.aggregate?.(e,t,n)??Promise.reject(new Error("aggregate not implemented")),aggregateOps:r.aggregateOps??[]};return l}};var y=class{constructor(e){this.values=e}kind="set"},w=class{constructor(e,t){this.field=e;this.value=t}kind="inc"},F=class{constructor(e,t){this.field=e;this.value=t}kind="mul"},S=class{constructor(e,t){this.field=e;this.value=t}kind="min"},v=class{constructor(e,t){this.field=e;this.value=t}kind="max"},k=class{constructor(e){this.field=e}kind="unset"},A=class{constructor(e,t){this.field=e;this.value=t}kind="push"},b=class{constructor(e,t){this.field=e;this.value=t}kind="pull"},B=class{constructor(e,t){this.field=e;this.value=t}kind="patch"};function Q(a){return a instanceof y||a instanceof w||a instanceof F||a instanceof S||a instanceof v||a instanceof k||a instanceof A||a instanceof b||a instanceof B}function z(a){return new y(a)}function J(a,e){return new w(p(a),e)}function X(a,e){return new F(p(a),e)}function Y(a,e){return new S(p(a),e)}function Z(a,e){return new v(p(a),e)}function ee(a){return new k(p(a))}function te(a,e){return new A(p(a),e)}function ae(a,e){return new b(p(a),e)}function ne(a,e){return new B(p(a),e)}function re(a){return a instanceof y?Object.keys(a.values):[a.field]}function se(a){let e={};for(let t of a)t instanceof y?Object.assign(e,t.values):e[t.field]=t;return e}export{f as a,O as b,p as c,T as d,P as e,i as f,g,V as h,E as i,q as j,y as k,w as l,F as m,S as n,v as o,k as p,A as q,b as r,B as s,Q as t,z as u,J as v,X as w,Y as x,Z as y,ee as z,te as A,ae as B,ne as C,re as D,se as E};
2
- //# sourceMappingURL=chunk-4JLDXF7T.min.mjs.map
1
+ import{K as x,a as m}from "./chunk-IN5YKIJ7.min.mjs";var f=class extends m{constructor(t,r,c,l){super(`ORM validation error (${t}) on ${r}.${c}`,{kind:t,schema:r,operation:c,failures:l});this.kind=t;this.schema=r;this.operation=c;this.failures=l}};import"valleyed";var O=class{name;path;constructor(e,t){this.name=e,this.path=t??[e]}};function p(a){return a instanceof O?a.path.join("."):a}var T=class extends O{pipe;onCreate;onUpdate;constructor(e,t,r){super(e),this.pipe=t,this.onCreate=r?.onCreate,this.onUpdate=r?.onUpdate}},P=class{constructor(e,t,r,c){this.name=e;this.pipe=t;this.deps=r;this.compute=c}};var i=class{constructor(e,t,r){this.op=t;this.value=r;this.field=p(e)}field},g=class a{constructor(e="and",t){this.op=e;this.children=t??[]}children;#e(e){return new a(this.op,[...this.children,e])}eq(e,t){return this.#e(new i(e,"eq",t))}ne(e,t){return this.#e(new i(e,"ne",t))}gt(e,t){return this.#e(new i(e,"gt",t))}gte(e,t){return this.#e(new i(e,"gte",t))}lt(e,t){return this.#e(new i(e,"lt",t))}lte(e,t){return this.#e(new i(e,"lte",t))}in(e,t){return this.#e(new i(e,"in",t))}notIn(e,t){return this.#e(new i(e,"notIn",t))}like(e,t){return this.#e(new i(e,"like",t))}exists(e){return this.#e(new i(e,"exists",!0))}notExists(e){return this.#e(new i(e,"notExists",!0))}contains(e,t){return this.#e(new i(e,"contains",t))}notContains(e,t){return this.#e(new i(e,"notContains",t))}and(e){if(e.length===0)throw new m("and() requires at least one filter factory",{op:"and"});let t=new a("and",e.map(r=>r(a.create())));return this.#e(t)}or(e){if(e.length===0)throw new m("or() requires at least one filter factory",{op:"or"});let t=new a("or",e.map(r=>r(a.create())));return this.#e(t)}clone(){return new a(this.op,this.children.map(e=>e instanceof i?new i(e.field,e.op,structuredClone(e.value)):e.clone()))}static create(){return new a}};function V(a,e,t){let r=[];t.aggregates.length===0&&r.push({cause:"At least one aggregator step is required"});let c=new Set;for(let s of t.aggregates)c.has(s.alias)&&r.push({alias:s.alias,cause:`Duplicate alias "${s.alias}"`}),c.add(s.alias),e.aggregateOps.includes(s.fn)||r.push({alias:s.alias,cause:`Undeclared aggregate op "${s.fn}"`});let l=a.fields,n=new Set(Object.keys(l));for(let s of t.groupBy)n.has(s)||r.push({field:s,cause:`Unknown groupBy field "${s}" on schema "${a.name}"`}),c.has(s)&&r.push({alias:s,cause:`Alias "${s}" collides with groupBy field name`});if(r.length>0)throw new f("aggregate",a.name,"aggregate",r);if(t.where&&E(a,t.where),t.having){let h=function(d){if(d instanceof i)s.has(d.field)||u.push({field:d.field,cause:`Unknown having field "${d.field}" \u2014 must be an aggregator alias or groupBy field`});else if(d instanceof g)for(let U of d.children)h(U)};var o=h;let s=new Set([...c,...t.groupBy]),u=[];for(let d of t.having.children)h(d);if(u.length>0)throw new f("aggregate",a.name,"aggregate",u)}}function E(a,e){let t=a.fields,r=new Set(Object.keys(t)),c=[];function l(n){if(n instanceof i)r.has(n.field)||c.push({field:n.field,cause:`Unknown field "${n.field}" on schema "${a.name}"`});else if(n instanceof g)for(let o of n.children)l(o)}for(let n of e.children)l(n);if(c.length>0)throw new f("validation",a.name,"filter",c.map(n=>({field:n.field,cause:n.cause})))}var q=class{queryableOps=[];updateOps=[];aggregateOps=[];supportedFieldTypes=[];onFatalError(e){let t=e instanceof m?e:new m("OrmAdapter fatal error",{},e);x.crash(t)}constructor(){let e=this;typeof e.connect=="function"&&x.on("start",()=>e.connect(),{class:this.constructor}),typeof e.disconnect=="function"&&x.on("close",()=>e.disconnect(),{class:this.constructor})}use(e,t){let r=this,c=async function*(){},l={findMany:(n,o)=>r.findMany?.(e,t,n,o)??Promise.resolve([]),iterateMany:(n,o)=>r.iterateMany?.(e,t,n,o)??c(),findOne:async n=>(await l.findMany(n,{limit:1}))[0]??null,count:n=>r.count?.(e,t,n)??Promise.reject(new Error("count not implemented")),createOne:async n=>(await l.createMany([n]))[0],createMany:n=>r.createMany?.(e,t,n)??Promise.resolve([]),updateMany:(n,o)=>r.updateMany?.(e,t,n,o)??Promise.resolve([]),updateOne:async(n,o)=>{let s=await l.findOne(n);if(!s)return null;let u=e.pkField.name,h=g.create().eq(u,s[u]);return(await l.updateMany(h,o))[0]??null},upsertOne:(n,o,s)=>r.upsertOne?.(e,t,n,o,s)??Promise.reject(new Error("upsertOne not implemented")),deleteOne:async n=>{let o=await l.findOne(n);if(!o)return null;let s=e.pkField.name;if(r.deleteByPk)await r.deleteByPk(e,t,o[s]);else if(r.deleteMany){let u=g.create().eq(s,o[s]);await r.deleteMany(e,t,u)}return o},deleteMany:n=>r.deleteMany?.(e,t,n)??Promise.resolve([]),raw:(...n)=>r.raw?.(e,t,...n)??Promise.reject(new Error("raw not implemented")),aggregate:n=>r.aggregate?.(e,t,n)??Promise.reject(new Error("aggregate not implemented")),aggregateOps:r.aggregateOps??[]};return l}};var y=class{constructor(e){this.values=e}kind="set"},w=class{constructor(e,t){this.field=e;this.value=t}kind="inc"},F=class{constructor(e,t){this.field=e;this.value=t}kind="mul"},S=class{constructor(e,t){this.field=e;this.value=t}kind="min"},v=class{constructor(e,t){this.field=e;this.value=t}kind="max"},k=class{constructor(e){this.field=e}kind="unset"},A=class{constructor(e,t){this.field=e;this.value=t}kind="push"},b=class{constructor(e,t){this.field=e;this.value=t}kind="pull"},B=class{constructor(e,t){this.field=e;this.value=t}kind="patch"};function Q(a){return a instanceof y||a instanceof w||a instanceof F||a instanceof S||a instanceof v||a instanceof k||a instanceof A||a instanceof b||a instanceof B}function z(a){return new y(a)}function J(a,e){return new w(p(a),e)}function X(a,e){return new F(p(a),e)}function Y(a,e){return new S(p(a),e)}function Z(a,e){return new v(p(a),e)}function ee(a){return new k(p(a))}function te(a,e){return new A(p(a),e)}function ae(a,e){return new b(p(a),e)}function ne(a,e){return new B(p(a),e)}function re(a){return a instanceof y?Object.keys(a.values):[a.field]}function se(a){let e={};for(let t of a)t instanceof y?Object.assign(e,t.values):e[t.field]=t;return e}export{f as a,O as b,p as c,T as d,P as e,i as f,g,V as h,E as i,q as j,y as k,w as l,F as m,S as n,v as o,k as p,A as q,b as r,B as s,Q as t,z as u,J as v,X as w,Y as x,Z as y,ee as z,te as A,ae as B,ne as C,re as D,se as E};
2
+ //# sourceMappingURL=chunk-7SQ5JQYR.min.mjs.map
@@ -969,6 +969,7 @@ var Server = class {
969
969
  #queue = [];
970
970
  #routesByKey = /* @__PURE__ */ new Set();
971
971
  #started = false;
972
+ #beforeListenHandlers = [];
972
973
  #notFoundHandler = null;
973
974
  setup(httpServer, config) {
974
975
  this.#httpServer = httpServer;
@@ -1024,6 +1025,11 @@ var Server = class {
1024
1025
  this.#notFoundHandler = handler;
1025
1026
  return this;
1026
1027
  }
1028
+ onBeforeListen(handler) {
1029
+ if (this.#started) throw new EquippedError("Cannot add before-listen handler after server has started", {});
1030
+ this.#beforeListenHandlers.push(handler);
1031
+ return this;
1032
+ }
1027
1033
  test() {
1028
1034
  return supertest(this.#httpServer);
1029
1035
  }
@@ -1057,6 +1063,7 @@ var Server = class {
1057
1063
  });
1058
1064
  return await this.handleResponse(res, response);
1059
1065
  });
1066
+ for (const handler of this.#beforeListenHandlers) await handler({ httpServer: this.#httpServer, port: config.port });
1060
1067
  const started = await this.startServer(config.port);
1061
1068
  if (started) Instance.get().log.info(`${instance.id}(${app.name}) service listening on port ${config.port}`);
1062
1069
  return started;
@@ -1208,6 +1215,7 @@ if (void 0) {
1208
1215
  const testInstanceState = globalThis;
1209
1216
  class TestServer extends Server {
1210
1217
  handledResponse = null;
1218
+ startedPorts = [];
1211
1219
  notFoundHandler = null;
1212
1220
  constructor() {
1213
1221
  super();
@@ -1252,7 +1260,8 @@ if (void 0) {
1252
1260
  registerNotFoundHandler(cb) {
1253
1261
  this.notFoundHandler = cb;
1254
1262
  }
1255
- async startServer() {
1263
+ async startServer(port) {
1264
+ this.startedPorts.push(port);
1256
1265
  return true;
1257
1266
  }
1258
1267
  async dispatchNotFound(path) {
@@ -1263,6 +1272,43 @@ if (void 0) {
1263
1272
  return { handledResponse: this.handledResponse, rawResponse };
1264
1273
  }
1265
1274
  }
1275
+ describe("Server before-listen handlers", () => {
1276
+ test("runs before-listen handlers before adapter listen in registration order", async () => {
1277
+ ensureTestInstance();
1278
+ const server = new TestServer();
1279
+ const calls = [];
1280
+ let receivedServer = null;
1281
+ server.onBeforeListen(({ httpServer, port }) => {
1282
+ calls.push(`first:${port}`);
1283
+ receivedServer = httpServer;
1284
+ expect(server.startedPorts).toEqual([]);
1285
+ }).onBeforeListen(({ httpServer, port }) => {
1286
+ calls.push(`second:${port}`);
1287
+ expect(httpServer).toBe(receivedServer);
1288
+ expect(server.startedPorts).toEqual([]);
1289
+ });
1290
+ await server.start();
1291
+ expect(calls).toEqual(["first:0", "second:0"]);
1292
+ expect(receivedServer).toBeInstanceOf(http.Server);
1293
+ expect(server.startedPorts).toEqual([0]);
1294
+ });
1295
+ test("rejects startup when a before-listen handler fails before adapter listen", async () => {
1296
+ ensureTestInstance();
1297
+ const server = new TestServer();
1298
+ server.onBeforeListen(async () => {
1299
+ throw new Error("before-listen failed");
1300
+ });
1301
+ await expect(server.start()).rejects.toThrow("before-listen failed");
1302
+ expect(server.startedPorts).toEqual([]);
1303
+ });
1304
+ test("rejects adding before-listen handlers after server startup", async () => {
1305
+ ensureTestInstance();
1306
+ const server = new TestServer();
1307
+ await server.start();
1308
+ expect(() => server.onBeforeListen(() => {
1309
+ })).toThrow("Cannot add before-listen handler after server has started");
1310
+ });
1311
+ });
1266
1312
  describe("Server not-found handler", () => {
1267
1313
  test("throws the default Equipped not-found error when no custom handler is set", async () => {
1268
1314
  ensureTestInstance();
@@ -2032,4 +2078,4 @@ export {
2032
2078
  ValidationError,
2033
2079
  Instance
2034
2080
  };
2035
- //# sourceMappingURL=chunk-MDQKODYQ.mjs.map
2081
+ //# sourceMappingURL=chunk-A4P7P6BU.mjs.map