@xrystal/core 3.28.3 → 3.37.3

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 (233) hide show
  1. package/README.md +2331 -21
  2. package/package.json +66 -24
  3. package/tsconfig.base.json +15 -0
  4. package/x/bin/commands/create.mjs +136 -0
  5. package/x/bin/commands/doctor.mjs +149 -0
  6. package/x/bin/commands/hooks.mjs +55 -0
  7. package/x/bin/commands/project.mjs +126 -0
  8. package/x/bin/commands/release.mjs +66 -0
  9. package/x/bin/commands/sync-toolchain.mjs +43 -0
  10. package/x/bin/commands/tmp.mjs +57 -0
  11. package/x/bin/constants/index.mjs +6 -0
  12. package/x/bin/helpers/.generated/.generated-from +1 -0
  13. package/x/bin/helpers/.generated/tmp-schema.mjs +192 -0
  14. package/x/bin/helpers/banner.mjs +80 -0
  15. package/x/bin/helpers/build-config.mjs +342 -0
  16. package/x/bin/helpers/cli-help.mjs +164 -0
  17. package/x/bin/helpers/cli-identity.mjs +17 -0
  18. package/x/bin/helpers/create-target.mjs +35 -0
  19. package/{bin → x/bin}/helpers/index.mjs +44 -1
  20. package/x/bin/helpers/project-artifacts.mjs +140 -0
  21. package/x/bin/helpers/project-root.mjs +70 -0
  22. package/x/bin/helpers/runtime-info.mjs +172 -0
  23. package/x/bin/helpers/tmp-config.mjs +67 -0
  24. package/x/bin/helpers/tmp-layout.mjs +281 -0
  25. package/x/bin/helpers/tmp-schema.mjs +9 -0
  26. package/x/bin/helpers/toolchain-config.mjs +233 -0
  27. package/x/bin/main-cli.js +80 -0
  28. package/x/bin/paths.mjs +14 -0
  29. package/x/bin/scripts/clean-source-types.mjs +19 -0
  30. package/x/bin/scripts/fix-dist-imports.mjs +80 -0
  31. package/x/bin/scripts/install-git-hooks.mjs +86 -0
  32. package/x/bin/scripts/minify-dist.mjs +50 -0
  33. package/x/bin/scripts/prepare-npm-publish.mjs +49 -0
  34. package/x/bin/scripts/release-prepare.mjs +56 -0
  35. package/x/bin/scripts/tag.mjs +17 -0
  36. package/x/bin/scripts/unpublish-leaked-versions.mjs +62 -0
  37. package/x/bin/scripts/verify-npm-pack.mjs +45 -0
  38. package/x/bin/scripts/verify-version-bump.mjs +27 -0
  39. package/x/bin/scripts/version-check.mjs +370 -0
  40. package/x/dist/index.d.ts +3 -0
  41. package/x/dist/index.js +1 -0
  42. package/{source → x/dist}/loader/clients/index.d.ts +2 -1
  43. package/x/dist/loader/clients/index.js +1 -0
  44. package/{source → x/dist}/loader/configs/index.d.ts +3 -2
  45. package/x/dist/loader/configs/index.js +1 -0
  46. package/x/dist/loader/controller/index.d.ts +69 -0
  47. package/x/dist/loader/controller/index.js +1 -0
  48. package/x/dist/loader/dto/index.d.ts +39 -0
  49. package/x/dist/loader/dto/index.js +1 -0
  50. package/{source → x/dist}/loader/events/index.d.ts +1 -1
  51. package/x/dist/loader/events/index.js +1 -0
  52. package/{source → x/dist}/loader/index.d.ts +2 -1
  53. package/x/dist/loader/index.js +1 -0
  54. package/{source → x/dist}/loader/kafka/index.d.ts +6 -3
  55. package/x/dist/loader/kafka/index.js +1 -0
  56. package/{source → x/dist}/loader/localizations/index.d.ts +4 -3
  57. package/x/dist/loader/localizations/index.js +1 -0
  58. package/{source → x/dist}/loader/logger/index.d.ts +10 -7
  59. package/x/dist/loader/logger/index.js +2 -0
  60. package/x/dist/loader/service/index.js +1 -0
  61. package/{source → x/dist}/loader/system/index.d.ts +4 -3
  62. package/x/dist/loader/system/index.js +1 -0
  63. package/{source → x/dist}/project/index.d.ts +2 -2
  64. package/x/dist/project/index.js +1 -0
  65. package/x/dist/utils/constants/defaults.json +44 -0
  66. package/x/dist/utils/constants/index.d.ts +27 -0
  67. package/x/dist/utils/constants/index.js +1 -0
  68. package/x/dist/utils/helpers/configs/index.js +1 -0
  69. package/x/dist/utils/helpers/context/controller-store.d.ts +51 -0
  70. package/x/dist/utils/helpers/context/controller-store.js +1 -0
  71. package/x/dist/utils/helpers/context/index.d.ts +18 -0
  72. package/x/dist/utils/helpers/context/index.js +1 -0
  73. package/{source → x/dist}/utils/helpers/core/index.d.ts +8 -6
  74. package/x/dist/utils/helpers/core/index.js +1 -0
  75. package/x/dist/utils/helpers/core/paths.d.ts +2 -0
  76. package/x/dist/utils/helpers/core/paths.js +1 -0
  77. package/x/dist/utils/helpers/core/tmp-layout.d.ts +45 -0
  78. package/x/dist/utils/helpers/core/tmp-layout.js +1 -0
  79. package/{source → x/dist}/utils/helpers/date/index.d.ts +1 -1
  80. package/x/dist/utils/helpers/date/index.js +1 -0
  81. package/x/dist/utils/helpers/dispatch/index.d.ts +9 -0
  82. package/x/dist/utils/helpers/dispatch/index.js +1 -0
  83. package/x/dist/utils/helpers/dto/index.d.ts +10 -0
  84. package/x/dist/utils/helpers/dto/index.js +1 -0
  85. package/x/dist/utils/helpers/filters/index.js +1 -0
  86. package/x/dist/utils/helpers/framework/index.d.ts +3 -0
  87. package/x/dist/utils/helpers/framework/index.js +1 -0
  88. package/x/dist/utils/helpers/handlers/adapters.d.ts +10 -0
  89. package/x/dist/utils/helpers/handlers/adapters.js +1 -0
  90. package/x/dist/utils/helpers/handlers/execute.d.ts +5 -0
  91. package/x/dist/utils/helpers/handlers/execute.js +1 -0
  92. package/x/dist/utils/helpers/handlers/index.d.ts +18 -0
  93. package/x/dist/utils/helpers/handlers/index.js +1 -0
  94. package/x/dist/utils/helpers/hash/crypto.js +1 -0
  95. package/x/dist/utils/helpers/id/index.js +1 -0
  96. package/x/dist/utils/helpers/index.d.ts +26 -0
  97. package/x/dist/utils/helpers/index.js +1 -0
  98. package/x/dist/utils/helpers/ip/index.js +1 -0
  99. package/x/dist/utils/helpers/is/index.js +1 -0
  100. package/{source → x/dist}/utils/helpers/locales/index.d.ts +1 -0
  101. package/x/dist/utils/helpers/locales/index.js +1 -0
  102. package/x/dist/utils/helpers/math/index.js +1 -0
  103. package/x/dist/utils/helpers/middleware/index.d.ts +19 -0
  104. package/x/dist/utils/helpers/middleware/index.js +1 -0
  105. package/x/dist/utils/helpers/objects/index.js +1 -0
  106. package/x/dist/utils/helpers/path/index.js +1 -0
  107. package/x/dist/utils/helpers/protocol/index.d.ts +20 -0
  108. package/x/dist/utils/helpers/protocol/index.js +1 -0
  109. package/x/dist/utils/helpers/protocol/options.d.ts +6 -0
  110. package/x/dist/utils/helpers/protocol/options.js +1 -0
  111. package/x/dist/utils/helpers/regex/checkSpecialRegexControl.js +1 -0
  112. package/x/dist/utils/helpers/runtime/dto-access.d.ts +3 -0
  113. package/x/dist/utils/helpers/runtime/dto-access.js +1 -0
  114. package/x/dist/utils/helpers/runtime/dto-types.d.ts +19 -0
  115. package/x/dist/utils/helpers/runtime/dto-types.js +1 -0
  116. package/x/dist/utils/helpers/runtime/index.d.ts +3 -0
  117. package/x/dist/utils/helpers/runtime/index.js +1 -0
  118. package/x/dist/utils/helpers/runtime/shutdown.d.ts +3 -0
  119. package/x/dist/utils/helpers/runtime/shutdown.js +1 -0
  120. package/x/dist/utils/helpers/state/index.d.ts +59 -0
  121. package/x/dist/utils/helpers/state/index.js +1 -0
  122. package/x/dist/utils/helpers/state/props-from-tmp.d.ts +9 -0
  123. package/x/dist/utils/helpers/state/props-from-tmp.js +1 -0
  124. package/x/dist/utils/helpers/state/request-key-guard.d.ts +3 -0
  125. package/x/dist/utils/helpers/state/request-key-guard.js +1 -0
  126. package/x/dist/utils/helpers/state/scopes.d.ts +21 -0
  127. package/x/dist/utils/helpers/state/scopes.js +1 -0
  128. package/x/dist/utils/helpers/string/index.js +1 -0
  129. package/x/dist/utils/helpers/tests/tmp-schema.test.js +1 -0
  130. package/{source/utils/models/types/index.js → x/dist/utils/helpers/tests/tmp-watch.test.d.ts} +0 -1
  131. package/x/dist/utils/helpers/tests/tmp-watch.test.js +1 -0
  132. package/x/dist/utils/helpers/timer/index.js +1 -0
  133. package/x/dist/utils/helpers/tmp/index.d.ts +5 -0
  134. package/x/dist/utils/helpers/tmp/index.js +1 -0
  135. package/x/dist/utils/helpers/tmp/loader-tmp-sync.d.ts +4 -0
  136. package/x/dist/utils/helpers/tmp/loader-tmp-sync.js +1 -0
  137. package/x/dist/utils/helpers/tmp/runtime-tmp.d.ts +9 -0
  138. package/x/dist/utils/helpers/tmp/runtime-tmp.js +1 -0
  139. package/x/dist/utils/helpers/tmp/tmp-loader.d.ts +7 -0
  140. package/x/dist/utils/helpers/tmp/tmp-loader.js +1 -0
  141. package/x/dist/utils/helpers/tmp/tmp-schema.d.ts +47 -0
  142. package/x/dist/utils/helpers/tmp/tmp-schema.js +1 -0
  143. package/x/dist/utils/helpers/tmp/tmp-watch.d.ts +1 -0
  144. package/x/dist/utils/helpers/tmp/tmp-watch.js +1 -0
  145. package/x/dist/utils/helpers/validates/index.js +1 -0
  146. package/x/dist/utils/index.d.ts +3 -0
  147. package/x/dist/utils/index.js +1 -0
  148. package/x/dist/utils/models/classes/class.clients.js +1 -0
  149. package/x/dist/utils/models/classes/class.interfaces.js +1 -0
  150. package/x/dist/utils/models/classes/class.service-locator.js +1 -0
  151. package/{source → x/dist}/utils/models/classes/class.tmp-file-loader.d.ts +3 -2
  152. package/x/dist/utils/models/classes/class.tmp-file-loader.js +1 -0
  153. package/x/dist/utils/models/classes/class.x.js +1 -0
  154. package/{source → x/dist}/utils/models/enums/index.d.ts +14 -1
  155. package/x/dist/utils/models/enums/index.js +1 -0
  156. package/x/dist/utils/models/index.d.ts +9 -0
  157. package/x/dist/utils/models/index.js +1 -0
  158. package/x/dist/utils/models/types/index.d.ts +5 -0
  159. package/x/dist/utils/models/types/index.js +1 -0
  160. package/x/dist/utils/package-root.d.ts +2 -0
  161. package/x/dist/utils/package-root.js +1 -0
  162. package/x/tmp.yml +48 -17
  163. package/bin/constants/index.mjs +0 -17
  164. package/bin/main-cli.js +0 -131
  165. package/source/index.js +0 -6
  166. package/source/loader/clients/index.js +0 -18
  167. package/source/loader/configs/index.js +0 -81
  168. package/source/loader/controller/index.d.ts +0 -129
  169. package/source/loader/controller/index.js +0 -327
  170. package/source/loader/events/index.js +0 -44
  171. package/source/loader/index.js +0 -10
  172. package/source/loader/kafka/index.js +0 -122
  173. package/source/loader/localizations/index.js +0 -40
  174. package/source/loader/logger/index.js +0 -183
  175. package/source/loader/service/index.js +0 -7
  176. package/source/loader/system/index.js +0 -19
  177. package/source/project/index.js +0 -66
  178. package/source/utils/constants/index.d.ts +0 -10
  179. package/source/utils/constants/index.js +0 -11
  180. package/source/utils/helpers/configs/index.js +0 -1
  181. package/source/utils/helpers/core/index.js +0 -105
  182. package/source/utils/helpers/date/index.js +0 -48
  183. package/source/utils/helpers/filters/index.js +0 -44
  184. package/source/utils/helpers/hash/crypto.js +0 -22
  185. package/source/utils/helpers/id/index.js +0 -24
  186. package/source/utils/helpers/index.d.ts +0 -17
  187. package/source/utils/helpers/index.js +0 -17
  188. package/source/utils/helpers/ip/index.js +0 -21
  189. package/source/utils/helpers/is/index.js +0 -35
  190. package/source/utils/helpers/locales/index.js +0 -63
  191. package/source/utils/helpers/math/index.js +0 -14
  192. package/source/utils/helpers/middlewares/index.d.ts +0 -1
  193. package/source/utils/helpers/middlewares/index.js +0 -26
  194. package/source/utils/helpers/objects/index.js +0 -55
  195. package/source/utils/helpers/path/index.js +0 -4
  196. package/source/utils/helpers/regex/checkSpecialRegexControl.js +0 -3
  197. package/source/utils/helpers/string/index.js +0 -9
  198. package/source/utils/helpers/timer/index.js +0 -5
  199. package/source/utils/helpers/validates/index.js +0 -20
  200. package/source/utils/index.d.ts +0 -3
  201. package/source/utils/index.js +0 -3
  202. package/source/utils/models/classes/class.clients.js +0 -142
  203. package/source/utils/models/classes/class.dtos.d.ts +0 -47
  204. package/source/utils/models/classes/class.dtos.js +0 -36
  205. package/source/utils/models/classes/class.interfaces.js +0 -10
  206. package/source/utils/models/classes/class.response.d.ts +0 -17
  207. package/source/utils/models/classes/class.response.js +0 -35
  208. package/source/utils/models/classes/class.service-locator.js +0 -16
  209. package/source/utils/models/classes/class.tmp-file-loader.js +0 -38
  210. package/source/utils/models/classes/class.x.js +0 -179
  211. package/source/utils/models/enums/index.js +0 -133
  212. package/source/utils/models/index.d.ts +0 -11
  213. package/source/utils/models/index.js +0 -11
  214. package/source/utils/models/types/index.d.ts +0 -3
  215. /package/{source → x/dist}/loader/service/index.d.ts +0 -0
  216. /package/{source → x/dist}/utils/helpers/configs/index.d.ts +0 -0
  217. /package/{source → x/dist}/utils/helpers/filters/index.d.ts +0 -0
  218. /package/{source → x/dist}/utils/helpers/hash/crypto.d.ts +0 -0
  219. /package/{source → x/dist}/utils/helpers/id/index.d.ts +0 -0
  220. /package/{source → x/dist}/utils/helpers/ip/index.d.ts +0 -0
  221. /package/{source → x/dist}/utils/helpers/is/index.d.ts +0 -0
  222. /package/{source → x/dist}/utils/helpers/math/index.d.ts +0 -0
  223. /package/{source → x/dist}/utils/helpers/objects/index.d.ts +0 -0
  224. /package/{source → x/dist}/utils/helpers/path/index.d.ts +0 -0
  225. /package/{source → x/dist}/utils/helpers/regex/checkSpecialRegexControl.d.ts +0 -0
  226. /package/{source → x/dist}/utils/helpers/string/index.d.ts +0 -0
  227. /package/{source/index.d.ts → x/dist/utils/helpers/tests/tmp-schema.test.d.ts} +0 -0
  228. /package/{source → x/dist}/utils/helpers/timer/index.d.ts +0 -0
  229. /package/{source → x/dist}/utils/helpers/validates/index.d.ts +0 -0
  230. /package/{source → x/dist}/utils/models/classes/class.clients.d.ts +0 -0
  231. /package/{source → x/dist}/utils/models/classes/class.interfaces.d.ts +0 -0
  232. /package/{source → x/dist}/utils/models/classes/class.service-locator.d.ts +0 -0
  233. /package/{source → x/dist}/utils/models/classes/class.x.d.ts +0 -0
@@ -0,0 +1 @@
1
+ export function pickProps(f,p){if(!f)return{};const r=new Set,l=new Set;for(const n of p)if(typeof n==="string"&&n.startsWith("-"))r.add(n.substring(1));else l.add(n);function a(n,t){return t.reduce((e,s)=>e&&e[s]!==void 0?e[s]:void 0,n)}function g(n,t,e){let s=n;for(let o=0;o<t.length-1;o++){if(!(t[o]in s))s[t[o]]={};s=s[t[o]]}s[t[t.length-1]]=e}if(r.size>0){let t=function(e,s=[],o){for(const i in e){const d=[...s,i].join(".");if(!Array.from(r).some((c)=>d===c||d.startsWith(c+".")))if(typeof e[i]==="object"&&e[i]!==null&&!Array.isArray(e[i])){o[i]={};t(e[i],[...s,i],o[i])}else o[i]=e[i]}};const n={};t(f,[],n);return n}const u={};for(const n of l){const t=n.split("."),e=a(f,t);if(e!==void 0)g(u,t,e)}return u}
@@ -0,0 +1 @@
1
+ import t from"path";import{fileURLToPath as r}from"url";export const __filename=(o)=>r(o),__dirname=(o)=>t.dirname(r(o));
@@ -0,0 +1,20 @@
1
+ import { ProtocolEnum } from '../../../utils/models/enums';
2
+ import { getRuntimeTmpConfigs } from '../../../utils/helpers/tmp/runtime-tmp';
3
+ declare const REALTIME_MIDDLEWARE_HINT = "[xrystal] tmp.yml lists both ws and socketio \u2014 use realtimeMiddleware(\"ws\") or realtimeMiddleware(\"socketio\")";
4
+ export declare function parseProtocol(value: unknown): ProtocolEnum;
5
+ export declare function isRealtimeProtocol(protocol?: ProtocolEnum): boolean;
6
+ export declare function isHttpProtocol(protocol?: ProtocolEnum): boolean;
7
+ export type TmpConfigs = NonNullable<ReturnType<typeof getRuntimeTmpConfigs>>['service'];
8
+ export declare function resolveProtocolsFromConfig(configs?: TmpConfigs): ProtocolEnum[];
9
+ export declare function getConfiguredProtocols(): ProtocolEnum[];
10
+ export declare function getConfiguredRealtimeProtocols(configs?: TmpConfigs): ProtocolEnum[];
11
+ export declare function defaultRealtimeProtocolFromConfig(configs?: TmpConfigs): ProtocolEnum | undefined;
12
+ export declare function getDefaultRealtimeProtocol(): ProtocolEnum | undefined;
13
+ export declare function resolveRealtimeMiddlewareProtocol(protocol?: ProtocolEnum | string, configs?: TmpConfigs): ProtocolEnum;
14
+ export declare function detectSocketProtocol(socket: unknown, explicit?: ProtocolEnum): ProtocolEnum;
15
+ export type SocketAttachRuntime = {
16
+ attachWebSocket(socket: unknown, requestId?: string): unknown;
17
+ attachSocketIo(socket: unknown): unknown;
18
+ };
19
+ export declare function attachSocketTransport(socket: unknown, protocol: ProtocolEnum, runtime: SocketAttachRuntime): void;
20
+ export { REALTIME_MIDDLEWARE_HINT };
@@ -0,0 +1 @@
1
+ import{ProtocolEnum as h}from"../../../utils/models/enums/index.js";import{getRuntimeTmpConfigs as J}from"../../../utils/helpers/tmp/runtime-tmp.js";const G={http:h.HTTP,https:h.HTTPS,ws:h.WEBSOCKET,websocket:h.WEBSOCKET,socketio:h.SOCKETIO,socket:h.SOCKETIO},REALTIME_MIDDLEWARE_HINT='[xrystal] tmp.yml lists both ws and socketio — use realtimeMiddleware("ws") or realtimeMiddleware("socketio")';export function parseProtocol(b){if(!b)return h.HTTP;const j=String(b).toLowerCase().replace(/[-_\s.]/g,"");if(G[j])return G[j];return Object.values(h).includes(String(b))?b:h.HTTP}export function isRealtimeProtocol(b){return b===h.WEBSOCKET||b===h.SOCKETIO}export function isHttpProtocol(b){return!b||b===h.HTTP||b===h.HTTPS}function B(){return J()?.service}export function resolveProtocolsFromConfig(b){const j=b?.protocols;if(!j)return[h.HTTP];return(Array.isArray(j)?j:[j]).map(parseProtocol)}export function getConfiguredProtocols(){try{return resolveProtocolsFromConfig(B())}catch{return[h.HTTP,h.WEBSOCKET]}}export function getConfiguredRealtimeProtocols(b){return resolveProtocolsFromConfig(b).filter(isRealtimeProtocol)}export function defaultRealtimeProtocolFromConfig(b){const j=getConfiguredRealtimeProtocols(b);if(j.length===1)return j[0];if(j.length>1)return;return h.WEBSOCKET}export function getDefaultRealtimeProtocol(){try{return defaultRealtimeProtocolFromConfig(B())}catch{return h.WEBSOCKET}}export function resolveRealtimeMiddlewareProtocol(b,j){if(b!==void 0&&b!==null&&b!=="")return parseProtocol(b);let q=j;if(!q)try{q=B()}catch{return h.WEBSOCKET}const z=getConfiguredRealtimeProtocols(q);if(z.length===1)return z[0];if(z.length>1)throw Error(REALTIME_MIDDLEWARE_HINT);return h.WEBSOCKET}export function detectSocketProtocol(b,j){if(j)return j;const q=b;if(q?.__xrystalProtocol)return q.__xrystalProtocol;return h.WEBSOCKET}export function attachSocketTransport(b,j,q){const z=b;if(j===h.SOCKETIO)q.attachSocketIo(b);else q.attachWebSocket(b);z.__xrystalProtocol=j}export{REALTIME_MIDDLEWARE_HINT};
@@ -0,0 +1,6 @@
1
+ import { FrameworkEnum, ProtocolEnum } from '../../../utils/models';
2
+ export type CtrOptions = {
3
+ framework?: FrameworkEnum;
4
+ protocol?: ProtocolEnum;
5
+ };
6
+ export declare function resolveCtrOptions(opts?: FrameworkEnum | CtrOptions): CtrOptions;
@@ -0,0 +1 @@
1
+ import{FrameworkEnum as e,ProtocolEnum as o}from"../../../utils/models/index.js";import{parseProtocol as t}from"../../../utils/helpers/protocol/index.js";export function resolveCtrOptions(r){if(r===void 0)return{protocol:o.HTTP};if(typeof r==="string"){if(Object.values(e).includes(r))return{framework:r,protocol:o.HTTP};return{protocol:t(r)}}return{protocol:o.HTTP,...r}}
@@ -0,0 +1 @@
1
+ export function checkSpecialRegexControl(e,t){return t.test(e)}
@@ -0,0 +1,3 @@
1
+ import type { IDtoRuntime } from '../../../utils/helpers/runtime/dto-types';
2
+ export declare const DTO_RUNTIME_KEY = "dtoRuntime";
3
+ export declare function getDtoRuntime(): IDtoRuntime;
@@ -0,0 +1 @@
1
+ import{x as t}from"../../../utils/models/index.js";export const DTO_RUNTIME_KEY="dtoRuntime";export function getDtoRuntime(){return t.get(DTO_RUNTIME_KEY)}
@@ -0,0 +1,19 @@
1
+ import type { DTOConfig } from '@xrystal/dto/dto';
2
+ import type { ElysiaPlugin, HttpMiddleware, SocketMiddleware } from '../../../utils/helpers/middleware';
3
+ export type DtoConfigureOptions = {
4
+ rebuild?: boolean;
5
+ };
6
+ export interface IDtoRuntime {
7
+ readonly config: Readonly<DTOConfig>;
8
+ configure(config?: Partial<DTOConfig>, options?: DtoConfigureOptions): this;
9
+ express(): HttpMiddleware;
10
+ elysia(): ElysiaPlugin;
11
+ node(): HttpMiddleware;
12
+ websocket(): SocketMiddleware;
13
+ socketIo(): SocketMiddleware;
14
+ fetch(): unknown;
15
+ forRequest(request: Request): Record<string, unknown>;
16
+ attachWebSocket(socket: unknown, requestId?: string): unknown;
17
+ attachSocketIo(socket: unknown): unknown;
18
+ }
19
+ export type DtoAdapterRuntime = Pick<IDtoRuntime, 'express' | 'elysia' | 'node' | 'websocket' | 'socketIo'>;
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,3 @@
1
+ export { getDtoRuntime, DTO_RUNTIME_KEY } from '../../../utils/helpers/runtime/dto-access';
2
+ export type { IDtoRuntime, DtoAdapterRuntime, DtoConfigureOptions } from '../../../utils/helpers/runtime/dto-types';
3
+ export { gracefulShutdown, isShuttingDown, registerGracefulShutdown } from '../../../utils/helpers/runtime/shutdown';
@@ -0,0 +1 @@
1
+ export{getDtoRuntime,DTO_RUNTIME_KEY}from"../../../utils/helpers/runtime/dto-access.js";export{gracefulShutdown,isShuttingDown,registerGracefulShutdown}from"../../../utils/helpers/runtime/shutdown.js";
@@ -0,0 +1,3 @@
1
+ export declare function isShuttingDown(): boolean;
2
+ export declare function gracefulShutdown(exitCode?: number): Promise<void>;
3
+ export declare function registerGracefulShutdown(): void;
@@ -0,0 +1 @@
1
+ import{stopTmpLoader as y}from"../../../utils/helpers/tmp/tmp-loader.js";import{clearRuntimeTmpConfigs as z}from"../../../utils/helpers/tmp/runtime-tmp.js";import A from"../../../utils/models/classes/class.x.js";let k=!1,q=!1;export function isShuttingDown(){return k}export async function gracefulShutdown(b=0){if(k){process.exit(b);return}k=!0;try{await A.shutdown()}catch{}y();z();await new Promise((j)=>setImmediate(j));process.exit(b)}export function registerGracefulShutdown(){if(q)return;q=!0;const b=(j)=>{gracefulShutdown(j==="SIGINT"?130:j==="SIGTERM"?143:0)};process.on("SIGINT",b);process.on("SIGTERM",b)}
@@ -0,0 +1,59 @@
1
+ import { propsFromTmp, resolveGStoreBoot, G_PROP_NOT_ALLOWED, type GStoreBoot } from '../../../utils/helpers/state/props-from-tmp';
2
+ import { G_REQUEST_KEY_WARN, looksLikeRequestScopedKey } from '../../../utils/helpers/state/request-key-guard';
3
+ import { type GStoresSnapshot, type StoreEntry, type StoreName } from '../../../utils/helpers/state/scopes';
4
+ export { propsFromTmp, resolveGStoreBoot, G_PROP_NOT_ALLOWED, G_REQUEST_KEY_WARN, looksLikeRequestScopedKey, type GStoreBoot };
5
+ export { GStoreScopeEnum } from '../../../utils/models/enums';
6
+ export { buildStoresSnapshot, summarizeController, runContextValues, patchControllerScope, patchRunScope, type GStoresSnapshot, type StoreEntry, type StoreName, } from '../../../utils/helpers/state/scopes';
7
+ export type GState = Record<string, unknown>;
8
+ export type GChange = {
9
+ key: string;
10
+ value: unknown;
11
+ prev: unknown;
12
+ };
13
+ export type GListener = (state: Readonly<GState>, prev: Readonly<GState>, changes: GChange[]) => void;
14
+ export type GKeyListener = (value: unknown, prev: unknown, change: GChange) => void;
15
+ export type GSelector<T> = (state: Readonly<GState>) => T;
16
+ export type GScopeView = {
17
+ name: StoreName;
18
+ active: boolean;
19
+ keys(): string[];
20
+ get<T>(key: string): T | undefined;
21
+ get<T>(key: string, fallback: T): T;
22
+ set?(key: string, value: unknown): boolean;
23
+ merge?(record: Record<string, unknown>): boolean;
24
+ patch?(record: Record<string, unknown>): boolean;
25
+ };
26
+ declare class GStoreFacade {
27
+ private store;
28
+ private baseline;
29
+ private allowedKeys;
30
+ private allowAutoCreateProps;
31
+ private warnOnRequestKeys;
32
+ constructor();
33
+ configureFromTmp(tmp?: Record<string, unknown>): this;
34
+ allowsAutoCreateProps(): boolean;
35
+ declaredKeys(): string[];
36
+ private guardRequestKey;
37
+ private assertPropAllowed;
38
+ private registerAllowedKeys;
39
+ getState(): Readonly<GState>;
40
+ select<T>(selector: GSelector<T>): T;
41
+ get<T>(key: string): T | undefined;
42
+ get<T>(key: string, fallback: T): T;
43
+ set(key: string, value: unknown): this;
44
+ merge(record: Record<string, unknown>): this;
45
+ has(key: string): boolean;
46
+ remove(...keys: string[]): this;
47
+ keys(): string[];
48
+ entries(): [string, unknown][];
49
+ snapshot(): GState;
50
+ subscribe(listener: GListener): () => void;
51
+ subscribeKey(key: string, listener: GKeyListener): () => void;
52
+ bootstrap(record: Record<string, unknown>): this;
53
+ reset(): void;
54
+ stores(): GStoresSnapshot;
55
+ list(): StoreEntry[];
56
+ scope(name: StoreName): GScopeView;
57
+ }
58
+ export { GStoreFacade };
59
+ export declare const G: GStoreFacade;
@@ -0,0 +1 @@
1
+ import{createStore as w}from"zustand/vanilla";import{subscribeWithSelector as I}from"zustand/middleware";import{GStoreScopeEnum as Z}from"../../../utils/models/enums/index.js";import{propsFromTmp,resolveGStoreBoot,G_PROP_NOT_ALLOWED}from"../../../utils/helpers/state/props-from-tmp.js";import{warnIfRequestScopedKey as Q,G_REQUEST_KEY_WARN,looksLikeRequestScopedKey}from"../../../utils/helpers/state/request-key-guard.js";import{buildStoresSnapshot as U,patchControllerScope as Y,patchRunScope as q}from"../../../utils/helpers/state/scopes.js";export{propsFromTmp,resolveGStoreBoot,G_PROP_NOT_ALLOWED,G_REQUEST_KEY_WARN,looksLikeRequestScopedKey};export{GStoreScopeEnum}from"../../../utils/models/enums/index.js";export{buildStoresSnapshot,summarizeController,runContextValues,patchControllerScope,patchRunScope}from"../../../utils/helpers/state/scopes.js";const V=(j)=>JSON.parse(JSON.stringify(j));function $(j,z){const H=new Set([...Object.keys(j),...Object.keys(z)]),M=[];for(const J of H)if(j[J]!==z[J])M.push({key:J,value:z[J],prev:j[J]});return M}class GStoreFacade{store;baseline={};allowedKeys=new Set;allowAutoCreateProps=!0;warnOnRequestKeys=!0;constructor(){this.store=w(I(()=>({})))}configureFromTmp(j={}){const z=resolveGStoreBoot(j);this.allowAutoCreateProps=z.allowAutoCreateProps;this.warnOnRequestKeys=z.warnOnRequestKeys;this.allowedKeys=new Set(Object.keys(z.vars));const H=V(z.bootstrap?z.vars:{});this.store.setState(H,!0);this.baseline=V(H);return this}allowsAutoCreateProps(){return this.allowAutoCreateProps}declaredKeys(){return[...this.allowedKeys]}guardRequestKey(j){Q(j,this.warnOnRequestKeys)}assertPropAllowed(j){if(this.allowAutoCreateProps)return;if(!this.allowedKeys.has(j))throw Error(`${G_PROP_NOT_ALLOWED}: ${j}`)}registerAllowedKeys(j){for(const z of j)this.allowedKeys.add(z)}getState(){return this.store.getState()}select(j){return j(this.getState())}get(j,z){const H=this.getState();if(!(j in H))return z;return H[j]}set(j,z){this.guardRequestKey(j);this.assertPropAllowed(j);const H=this.getState();if(H[j]===z)return this;this.store.setState({...H,[j]:z});return this}merge(j){for(const M of Object.keys(j)){this.guardRequestKey(M);this.assertPropAllowed(M)}const z=this.getState();if(!$(z,{...z,...j}).length)return this;this.store.setState({...z,...j});return this}has(j){return j in this.getState()}remove(...j){const H={...this.getState()};let M=!1;for(const J of j)if(J in H){delete H[J];M=!0}if(M)this.store.setState(H,!0);return this}keys(){return Object.keys(this.getState())}entries(){return Object.entries(this.getState())}snapshot(){return{...this.getState()}}subscribe(j){return this.store.subscribe((z,H)=>j(z,H,$(H,z)))}subscribeKey(j,z){return this.store.subscribe((H)=>H[j],(H,M)=>z(H,M,{key:j,value:H,prev:M}))}bootstrap(j){if(!this.allowAutoCreateProps)for(const z of Object.keys(j))this.assertPropAllowed(z);else this.registerAllowedKeys(Object.keys(j));this.merge(j);this.baseline=V(this.getState());return this}reset(){this.store.setState(V(this.baseline),!0)}stores(){return U(this.snapshot())}list(){return Object.values(this.stores())}scope(j){const H=this.stores()[j],M={name:j,active:H.active,keys:()=>H.keys,get(J,X){if(!H.values||!(J in H.values))return X;return H.values[J]}};if(j===Z.GLOBAL)return{...M,set:(J,X)=>{this.set(J,X);return!0},merge:(J)=>{this.merge(J);return!0}};if(j===Z.RUN)return{...M,patch:(J)=>q(J)};return{...M,patch:(J)=>Y(J)}}}export{GStoreFacade};export const G=new GStoreFacade;
@@ -0,0 +1,9 @@
1
+ export type GStoreBoot = {
2
+ bootstrap: boolean;
3
+ allowAutoCreateProps: boolean;
4
+ warnOnRequestKeys: boolean;
5
+ vars: Record<string, unknown>;
6
+ };
7
+ export declare const G_PROP_NOT_ALLOWED = "[xrystal] G prop not declared in tmp.yml vars \u2014 set autoCreateProps: true to allow runtime keys";
8
+ export declare function resolveGStoreBoot(tmp?: Record<string, unknown>): GStoreBoot;
9
+ export declare function propsFromTmp(tmp?: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ import{readTmpServiceBlock as I}from"../../../utils/helpers/tmp/tmp-schema.js";export const G_PROP_NOT_ALLOWED="[xrystal] G prop not declared in tmp.yml vars — set autoCreateProps: true to allow runtime keys";const F=()=>({});function J(j){return I(j).loaders?.system?.gStore}function L(j){if(typeof j.bootstrap==="boolean")return j.bootstrap;return!0}function M(j){if(typeof j.autoCreateProps==="boolean")return j.autoCreateProps;return!0}function Q(j){if(typeof j.warnOnRequestKeys==="boolean")return j.warnOnRequestKeys;return!0}export function resolveGStoreBoot(j={}){const x=j.configs??j,z=J(x);if(!z)return{bootstrap:!0,allowAutoCreateProps:!0,warnOnRequestKeys:!0,vars:F()};const E=z.options??{},D=z.vars,H=D&&typeof D==="object"&&!Array.isArray(D)?{...D}:F();return{bootstrap:L(E),allowAutoCreateProps:M(E),warnOnRequestKeys:Q(E),vars:H}}export function propsFromTmp(j={}){const x=resolveGStoreBoot(j);return x.bootstrap?x.vars:F()}
@@ -0,0 +1,3 @@
1
+ export declare const G_REQUEST_KEY_WARN = "[xrystal] G: key looks request-scoped \u2014 use run/controller context, not global G";
2
+ export declare function looksLikeRequestScopedKey(key: string): boolean;
3
+ export declare function warnIfRequestScopedKey(key: string, enabled: boolean): void;
@@ -0,0 +1 @@
1
+ import{getRunContext as B}from"../../../utils/helpers/context/index.js";import{getControllerCtx as D}from"../../../utils/helpers/context/controller-store.js";export const G_REQUEST_KEY_WARN="[xrystal] G: key looks request-scoped — use run/controller context, not global G";const F=new Set(["requestid","reqid","correlationid","cookies","cookie","headers","header","body","query","queries","params","locals","session","sessionid"]);export function looksLikeRequestScopedKey(j){const z=j.trim();if(!z)return!1;const f=z.toLowerCase();if(F.has(f))return!0;if(f.endsWith("requestid")||f.endsWith("correlationid"))return!0;if(f==="req"||f==="res")return!0;return!1}export function warnIfRequestScopedKey(j,z){if(!z||!looksLikeRequestScopedKey(j))return;const f=B()?"run":D()?"controller":"outside-request";console.warn(`${G_REQUEST_KEY_WARN} (key: ${j}, scope: ${f})`)}
@@ -0,0 +1,21 @@
1
+ import { GStoreScopeEnum } from '../../../utils/models/enums';
2
+ import { type RunContext } from '../../../utils/helpers/context';
3
+ import { type ControllerStoreContext } from '../../../utils/helpers/context/controller-store';
4
+ export type StoreName = GStoreScopeEnum;
5
+ export type StoreEntry = {
6
+ name: StoreName;
7
+ active: boolean;
8
+ keys: string[];
9
+ values: Record<string, unknown> | null;
10
+ };
11
+ export type GStoresSnapshot = Record<GStoreScopeEnum, StoreEntry>;
12
+ export declare function summarizeController(ctx?: ControllerStoreContext): Record<string, unknown> | null;
13
+ export declare function runContextValues(ctx?: RunContext): Record<string, unknown> | null;
14
+ export declare function buildStoresSnapshot(globalValues: Record<string, unknown>): GStoresSnapshot;
15
+ export declare function patchControllerScope(patch: {
16
+ metadata?: Partial<ControllerStoreContext['metadata']>;
17
+ requestId?: string;
18
+ }): boolean;
19
+ export declare function patchRunScope(patch: Partial<Omit<RunContext, 'requestId'>> & {
20
+ meta?: Record<string, unknown>;
21
+ }): boolean;
@@ -0,0 +1 @@
1
+ import{GStoreScopeEnum as j}from"../../../utils/models/enums/index.js";import{getRunContext as q,patchRunContext as w}from"../../../utils/helpers/context/index.js";import{getControllerCtx as v}from"../../../utils/helpers/context/controller-store.js";export function summarizeController(d){if(!d)return null;return{protocol:d.protocol,framework:d.framework,requestId:d.requestId,metadata:d.metadata,hasReq:!!d.req,hasRes:!!d.res,hasSocket:!!d.socket}}export function runContextValues(d){if(!d)return null;return{...d}}export function buildStoresSnapshot(d){const f=q(),k=summarizeController(v());return{[j.GLOBAL]:{name:j.GLOBAL,active:!0,keys:Object.keys(d),values:{...d}},[j.RUN]:{name:j.RUN,active:!!f,keys:f?Object.keys(f):[],values:runContextValues(f)},[j.CONTROLLER]:{name:j.CONTROLLER,active:!!k,keys:k?Object.keys(k):[],values:k}}}export function patchControllerScope(d){const f=v();if(!f)return!1;if(d.requestId!==void 0)f.requestId=d.requestId;if(d.metadata)f.metadata={...f.metadata,...d.metadata,locals:{...f.metadata?.locals??{},...d.metadata.locals??{}}};return!0}export function patchRunScope(d){if(!q())return!1;w(d);return!0}
@@ -0,0 +1 @@
1
+ export function cleanStringForNormalize(e){if(typeof e!=="string")return"";return e.normalize("NFD").replace(/\u0307/g,"").normalize("NFC")}
@@ -0,0 +1 @@
1
+ import{describe as K,expect as j,test as A}from"bun:test";import{normalizeRootFolder as H,normalizeTmpDocument as N,readTmpCoreBlock as O,readTmpServiceBlock as J,resolveServiceLayoutPaths as Q,resolveTmpRuntimeConfigs as U}from"../../../utils/helpers/tmp/tmp-schema.js";import{resolveTmpWatchIntervalMs as V}from"../../../utils/helpers/tmp/tmp-watch.js";const G={configs:{service:{name:"my-api",framework:"elysia",paths:{root:"./infra.js",source:"./src.js",special:{tests:"specs",environments:"env",dist:"out"}},protocols:["http"],build:{typecheck:!0},loaders:{dto:{withDefaultHeaders:!0}}},core:{tmp:{fileWatchIntervalMs:200}}}};K("tmp-schema service + core blocks",()=>{A("readTmpServiceBlock reads paths.root, paths.source, paths.special",()=>{const q=J(G.configs);j(q.paths?.root).toBe("./infra.js");j(q.paths?.source).toBe("./src.js");j(q.paths?.special?.tests).toBe("specs");j(q.name).toBe("my-api");j(q.build?.typecheck).toBe(!0)});A("readTmpCoreBlock reads core.tmp.fileWatchIntervalMs",()=>{j(O(G.configs).tmp?.fileWatchIntervalMs).toBe(200)});A("normalizeRootFolder strips ./ prefix",()=>{j(H("./x.js")).toBe("x");j(H("infra")).toBe("infra")});A("resolveTmpRuntimeConfigs returns service, core, and rootFolderPath",()=>{const q=U(G);j(Object.keys(q)).toEqual(["service","core","rootFolderPath"]);j(q.rootFolderPath).toBe("infra");j(q.service.paths?.special?.dist).toBe("out");j(q.service.framework).toBe("elysia");j(q.service.loaders).toEqual({dto:{withDefaultHeaders:!0}});j(q.core.tmp?.fileWatchIntervalMs).toBe(200);j("loaders"in q).toBe(!1);j("mainFolderPath"in q).toBe(!1)});A("normalizeTmpDocument merges service + core + derived rootFolderPath onto configs",()=>{const E=N(G).configs;j(E.service).toBeTruthy();j(E.core).toBeTruthy();j(E.rootFolderPath).toBe("infra");j(E.service.loaders).toBeTruthy();j(E.loaders).toBeUndefined();j(E.mainFolderPath).toBeUndefined()});A("resolveTmpWatchIntervalMs reads core.tmp.fileWatchIntervalMs",()=>{j(V(G)).toBe(200)});A("resolveServiceLayoutPaths uses defaults when special omitted",()=>{const q=Q(J({service:{paths:{}}}));j(q.tests).toBe("tests");j(q.dist).toBe("dist")})});
@@ -0,0 +1 @@
1
+ import{describe as k,expect as f,test as j}from"bun:test";import{resolveTmpWatchIntervalMs as g}from"../../../utils/helpers/tmp/tmp-watch.js";k("resolveTmpWatchIntervalMs",()=>{j("defaults to 500ms when core.tmp omitted",()=>{f(g({configs:{}})).toBe(500)});j("reads configs.core.tmp.fileWatchIntervalMs",()=>{f(g({configs:{core:{tmp:{fileWatchIntervalMs:200}}}})).toBe(200)});j("clamps to min/max bounds",()=>{f(g({configs:{core:{tmp:{fileWatchIntervalMs:10}}}})).toBe(100);f(g({configs:{core:{tmp:{fileWatchIntervalMs:60000}}}})).toBe(1e4)})});
@@ -0,0 +1 @@
1
+ export async function delay({duration:e}){return new Promise((t,n)=>{setTimeout(()=>t(delay),e)})}
@@ -0,0 +1,5 @@
1
+ export { setRuntimeTmpConfigs, getRuntimeTmpConfigs, onRuntimeTmpChange, notifyRuntimeTmpChange, clearRuntimeTmpConfigs, type RuntimeTmpConfigs, } from '../../../utils/helpers/tmp/runtime-tmp';
2
+ export { getTmpLoader, getTmpLoaderPath, getTmpSnapshot, onTmpReload, resetTmpLoaderForTests, stopTmpLoader, } from '../../../utils/helpers/tmp/tmp-loader';
3
+ export { bindLoaderTmpSync, type ITmpSyncLoader, } from '../../../utils/helpers/tmp/loader-tmp-sync';
4
+ export { resolveTmpWatchIntervalMs } from '../../../utils/helpers/tmp/tmp-watch';
5
+ export { normalizeTmpDocument, normalizeRootFolder, normalizeSourceFolder, readTmpCoreBlock, readTmpServiceBlock, resolveServiceLayoutPaths, resolveTmpRuntimeConfigs, } from '../../../utils/helpers/tmp/tmp-schema';
@@ -0,0 +1 @@
1
+ export{setRuntimeTmpConfigs,getRuntimeTmpConfigs,onRuntimeTmpChange,notifyRuntimeTmpChange,clearRuntimeTmpConfigs}from"../../../utils/helpers/tmp/runtime-tmp.js";export{getTmpLoader,getTmpLoaderPath,getTmpSnapshot,onTmpReload,resetTmpLoaderForTests,stopTmpLoader}from"../../../utils/helpers/tmp/tmp-loader.js";export{bindLoaderTmpSync}from"../../../utils/helpers/tmp/loader-tmp-sync.js";export{resolveTmpWatchIntervalMs}from"../../../utils/helpers/tmp/tmp-watch.js";export{normalizeTmpDocument,normalizeRootFolder,normalizeSourceFolder,readTmpCoreBlock,readTmpServiceBlock,resolveServiceLayoutPaths,resolveTmpRuntimeConfigs}from"../../../utils/helpers/tmp/tmp-schema.js";
@@ -0,0 +1,4 @@
1
+ export interface ITmpSyncLoader {
2
+ syncFromTmp(): void | Promise<void>;
3
+ }
4
+ export declare function bindLoaderTmpSync(loader: ITmpSyncLoader): void;
@@ -0,0 +1 @@
1
+ import{onRuntimeTmpChange as k}from"../../../utils/helpers/tmp/runtime-tmp.js";export function bindLoaderTmpSync(c){const f=c.constructor.name;k(async()=>{try{await c.syncFromTmp()}catch(b){const j=b instanceof Error?b.message:String(b);console.warn(`[xrystal] ${f} tmp reload failed: ${j}`)}})}
@@ -0,0 +1,9 @@
1
+ import type { TmpRuntimeConfigs } from '../../../utils/helpers/tmp/tmp-schema';
2
+ export type RuntimeTmpConfigs = TmpRuntimeConfigs;
3
+ type TmpChangeListener = (configs: RuntimeTmpConfigs) => void | Promise<void>;
4
+ export declare function setRuntimeTmpConfigs(configs?: RuntimeTmpConfigs): void;
5
+ export declare function getRuntimeTmpConfigs(): RuntimeTmpConfigs | undefined;
6
+ export declare function onRuntimeTmpChange(listener: TmpChangeListener): () => void;
7
+ export declare function notifyRuntimeTmpChange(configs?: RuntimeTmpConfigs): Promise<void>;
8
+ export declare function clearRuntimeTmpConfigs(): void;
9
+ export {};
@@ -0,0 +1 @@
1
+ let e;const i=[];export function setRuntimeTmpConfigs(n){e=n}export function getRuntimeTmpConfigs(){return e}export function onRuntimeTmpChange(n){i.push(n);return()=>{const t=i.indexOf(n);if(t>=0)i.splice(t,1)}}export async function notifyRuntimeTmpChange(n){if(n)e=n;const t=e;if(!t)return;for(const o of i)await o(t)}export function clearRuntimeTmpConfigs(){e=void 0;i.length=0}
@@ -0,0 +1,7 @@
1
+ import { TmpFileLoader } from '../../../utils/models/classes/class.tmp-file-loader';
2
+ export declare function getTmpLoaderPath(): string;
3
+ export declare function getTmpLoader(): TmpFileLoader;
4
+ export declare function getTmpSnapshot(): Record<string, unknown>;
5
+ export declare function onTmpReload(listener: (tmp: Record<string, unknown>) => void): () => void;
6
+ export declare function stopTmpLoader(): void;
7
+ export declare function resetTmpLoaderForTests(): void;
@@ -0,0 +1 @@
1
+ import J from"node:fs";import K from"node:path";import{Constants as E}from"../../../utils/constants/index.js";import{assertCoreTmpGuard as M,coreCanonicalTmpPath as O,isCorePackageRoot as Q}from"../../../utils/helpers/core/tmp-layout.js";import{findFileRecursively as U}from"../../../utils/helpers/core/paths.js";import{TmpFileLoader as V}from"../../../utils/models/classes/class.tmp-file-loader.js";import{registerGracefulShutdown as W}from"../../../utils/helpers/runtime/shutdown.js";let q=null,A=null;function X(B=process.cwd(),j=E.tmpBaseName,b=E.tmpExtension){const z=K.resolve(B);if(Q(z)){const D=O(z);if(!J.existsSync(D))throw Error(`${E.packageRootFolder}/tmp.yml not found. Run xcore tmp or ensureCoreTmpEntry() before starting @xrystal/core`);M(z,D);return D}const H=U(z,j,b);if(!H)throw Error(`${j}${b.startsWith(".")?b:`.${b}`} file not found`);return H}export function getTmpLoaderPath(){if(!A)A=X();return A}export function getTmpLoader(){if(!q){q=new V({filePath:getTmpLoaderPath()});W()}return q}export function getTmpSnapshot(){return getTmpLoader().getResolvedTmpFile()}export function onTmpReload(B){const j=getTmpLoader(),b=()=>B(j.getResolvedTmpFile());j.on("reload",b);return()=>j.off("reload",b)}export function stopTmpLoader(){if(q){q.stop();q=null;A=null}}export function resetTmpLoaderForTests(){stopTmpLoader()}
@@ -0,0 +1,47 @@
1
+ export type TmpServiceSpecialPaths = {
2
+ tests?: string;
3
+ environments?: string;
4
+ dist?: string;
5
+ };
6
+ export type TmpServicePathsBlock = {
7
+ root?: string;
8
+ source?: string;
9
+ special?: TmpServiceSpecialPaths;
10
+ };
11
+ export type TmpServiceBlock = {
12
+ name?: string;
13
+ framework?: string;
14
+ paths?: TmpServicePathsBlock;
15
+ protocols?: unknown;
16
+ loaders?: Record<string, unknown>;
17
+ build?: Record<string, unknown>;
18
+ };
19
+ export type TmpCoreBlock = {
20
+ tmp?: {
21
+ fileWatchIntervalMs?: number | string;
22
+ };
23
+ };
24
+ export type TmpLayoutPathsFlat = {
25
+ tests: string;
26
+ environments: string;
27
+ dist: string;
28
+ };
29
+ export type TmpRuntimeConfigs = {
30
+ service: TmpServiceBlock & {
31
+ paths: Required<Pick<TmpServicePathsBlock, 'root' | 'source'>> & {
32
+ special: TmpLayoutPathsFlat;
33
+ };
34
+ };
35
+ core: TmpCoreBlock;
36
+ rootFolderPath: string;
37
+ };
38
+ /** `paths.root` → folder name under project root (`x`, `infra`). */
39
+ export declare function normalizeRootFolder(value?: string): string;
40
+ /** `paths.source` → dev/build source folder (`./source`, `./src`). */
41
+ export declare function normalizeSourceFolder(value?: string): string;
42
+ export declare function readTmpCoreBlock(configs?: Record<string, unknown>): TmpCoreBlock;
43
+ export declare function readTmpServiceBlock(configs?: Record<string, unknown>): TmpServiceBlock;
44
+ export declare function resolveServiceLayoutPaths(service: TmpServiceBlock): TmpLayoutPathsFlat;
45
+ /** Canonical tmp.yml shape — `service` + `core` + derived `rootFolderPath`. */
46
+ export declare function resolveTmpRuntimeConfigs(tmp?: Record<string, unknown> | null): TmpRuntimeConfigs;
47
+ export declare function normalizeTmpDocument(tmp: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ import{Constants as G}from"../../../utils/constants/index.js";function A(j){return typeof j==="object"&&j!==null&&!Array.isArray(j)}function M(j){if(typeof j==="number"||typeof j==="string")return j;return}export function normalizeRootFolder(j){if(!j?.trim())return G.packageRootFolder;return j.trim().replace(/^\.\/+/,"")}export function normalizeSourceFolder(j){if(!j?.trim())return G.mainSourceFolder;const q=j.trim();if(q.startsWith("./")||q.startsWith("../"))return q;return`./${q}`}export function readTmpCoreBlock(j){const q=A(j?.core)?j.core:{},x=A(q.tmp)?q.tmp:{};return{tmp:{fileWatchIntervalMs:M(x.fileWatchIntervalMs)}}}export function readTmpServiceBlock(j){const q=A(j?.service)?j.service:{},x=A(q.paths)?q.paths:{},D=A(x.special)?x.special:{};let E=A(q.loaders)?{...q.loaders}:void 0,H=A(q.build)?q.build:void 0;if(E&&A(E.build)){const{build:J,...K}=E;E=K;if(!H&&A(J))H=J}return{name:typeof q.name==="string"?q.name:void 0,framework:typeof q.framework==="string"?q.framework:void 0,paths:{root:typeof x.root==="string"?x.root:void 0,source:typeof x.source==="string"?x.source:void 0,special:{tests:typeof D.tests==="string"?D.tests:void 0,environments:typeof D.environments==="string"?D.environments:void 0,dist:typeof D.dist==="string"?D.dist:void 0}},protocols:q.protocols,loaders:E,build:H}}export function resolveServiceLayoutPaths(j){const q=j.paths?.special??{};return{tests:q.tests?.trim()||G.layoutPaths.tests,environments:q.environments?.trim()||G.layoutPaths.environments,dist:q.dist?.trim()||G.layoutPaths.dist}}function O(j){const q=resolveServiceLayoutPaths(j);return{name:j.name,framework:j.framework??"elysia",paths:{root:j.paths?.root??G.packageRootFolder,source:j.paths?.source??G.mainSourceFolder,special:q},protocols:j.protocols,loaders:j.loaders,build:j.build}}function Q(j){return{tmp:{fileWatchIntervalMs:j.tmp?.fileWatchIntervalMs}}}export function resolveTmpRuntimeConfigs(j){const q=A(j?.configs)?j.configs:{},x=readTmpServiceBlock(q),D=readTmpCoreBlock(q),E=O(x);return{service:E,core:Q(D),rootFolderPath:normalizeRootFolder(E.paths.root)}}export function normalizeTmpDocument(j){return{...j,configs:resolveTmpRuntimeConfigs(j)}}
@@ -0,0 +1 @@
1
+ export declare function resolveTmpWatchIntervalMs(tmp?: Record<string, unknown> | null): number;
@@ -0,0 +1 @@
1
+ import I from"../../../utils/constants/defaults.json" with { type: 'json' };import{readTmpCoreBlock as J}from"../../../utils/helpers/tmp/tmp-schema.js";const b=I.tmpWatchDefaults??{intervalMs:500,minIntervalMs:100,maxIntervalMs:1e4};export function resolveTmpWatchIntervalMs(q){const v=q?.configs,y=J(v).tmp?.fileWatchIntervalMs??b.intervalMs,j=Number(y);if(!Number.isFinite(j))return b.intervalMs;const z=b.minIntervalMs??100,G=b.maxIntervalMs??1e4;return Math.min(G,Math.max(z,Math.round(j)))}
@@ -0,0 +1 @@
1
+ export const validateScopes=({scopes:i,permissions:t,resources:o})=>{const s=i.split(" ");function r(e){if(new Set(e).size!==e.length)return!0;return!1}if(r(s))return!1;return!s.some((e)=>{const[n,c]=e.split(":"),u=o.includes(n),l=t.includes(c);return!u||!l})};
@@ -0,0 +1,3 @@
1
+ export * from '../utils/constants';
2
+ export * from '../utils/helpers';
3
+ export * from '../utils/models';
@@ -0,0 +1 @@
1
+ export*from"../utils/constants/index.js";export*from"../utils/helpers/index.js";export*from"../utils/models/index.js";
@@ -0,0 +1 @@
1
+ import{createHash as k,createHmac as E}from"node:crypto";import{Configs as y,Logger as N}from"../../../loader/index.js";import{LoggerLayerEnum as x,x as b}from"../../../utils/index.js";import{getRequestId as D}from"../../../utils/helpers/context/index.js";export class ClientStore{static _store={};static get(t){return this._store[t]||{}}static set(t,e){this._store[t]={...this._store[t],...e}}}export class Client{logger=b.get(N);configs=b.get(y);clientName;baseURL;version=null;timeout=15000;debug;authConfigs;breaker={failures:0,lastFailure:0,state:"CLOSED",threshold:5,cooldown:30000};constructor({clientName:t,baseURL:e,version:r,timeout:i,auth:s,debug:n}){this.clientName=t;this.baseURL=e;this.version=r||null;this.authConfigs=s;this.timeout=i||15000;const c=Number(this.configs.all.debug)>=x.DEBUG;this.debug=n??c;if(s?.token)ClientStore.set(t,{accessToken:s.token})}resolvePath(t,e){return e.split(".").reduce((r,i)=>r?r[i]:void 0,t)}static cryptoHashGenerate=({algorithm:t,input:e,digest:r="hex"})=>{return k(t).update(e).digest(r)}}export class BaseApiClient extends Client{constructor(t){super(t)}async request(t,e={}){if(this.breaker.state==="OPEN")if(Date.now()-this.breaker.lastFailure>this.breaker.cooldown)this.breaker.state="HALF_OPEN";else throw Error(`[CircuitBreaker] ${this.clientName} is OPEN`);const r=e.retries??3;let i=0;while(i<r)try{const s=await this._execute(t,{...e});if(s.ok||s.status===401){this.breaker.failures=0;this.breaker.state="CLOSED";return s}if([502,503,504].includes(s.status))throw Error(`Server Error: ${s.status}`);return s}catch(s){i++;this.breaker.failures++;this.breaker.lastFailure=Date.now();if(this.breaker.failures>=this.breaker.threshold)this.breaker.state="OPEN";if(i>=r)throw s;const n=Math.pow(2,i)*500;await new Promise((c)=>setTimeout(c,n))}throw Error(`${this.clientName} failed after ${r} attempts`)}async _execute(t,e){const r=this.baseURL.replace(/\/$/,""),i=e.version!==void 0?e.version:this.version,s=i?`/${i.replace(/^\//,"")}`:"",n=`${r}${s}${t}`,c=D(),l=new Headers(e.headers||{}),u=e.body instanceof URLSearchParams,d=e.body instanceof FormData;if(!u&&!d)l.set("Content-Type","application/json");if(c)l.set("x-correlation-id",c);const f=this.configs.all.internalSecret||process.env.INTERNAL_SECRET;if(f){const a=Date.now().toString(),w=E("sha256",f).update(a+this.clientName).digest("hex");l.set("x-internal-signature",w);l.set("x-internal-timestamp",a);l.set("x-internal-client",this.clientName)}const p=e.debug??this.debug,{version:L,retries:$,debug:v,...h}=e;let o=h.body;if(o&&typeof o==="object"&&!u&&!d)o=JSON.stringify(o);if(p){const a={method:h.method||"GET",url:n,body:o&&typeof o==="string"?JSON.parse(o):o};console.log(`[DEBUG] ${this.clientName}`,a);this.logger.winston.info(`${this.clientName} Request`,a)}const m=new AbortController,g=setTimeout(()=>m.abort(),this.timeout);try{const a=await fetch(n,{...h,body:o,headers:l,signal:m.signal});clearTimeout(g);return a}catch(a){clearTimeout(g);throw a}}}
@@ -0,0 +1 @@
1
+ export class ILifeCycle{async onInit(o={}){}onAfterInit(o){}onDispose(o){}}export class IProvide extends ILifeCycle{}
@@ -0,0 +1 @@
1
+ export class Locator{_context=new Map;constructor({}){}set=({service:t,reference:e,args:o})=>{this._context.set(t,new e(...o||[]))};get=(t)=>{if(!this._context.has(t))throw Error(`${t} not found in context.`);return this._context.get(t)}}export default new Locator({});
@@ -1,8 +1,9 @@
1
- import { EventEmitter } from "node:events";
1
+ import { EventEmitter } from 'node:events';
2
2
  export declare class TmpFileLoader extends EventEmitter {
3
3
  #private;
4
4
  constructor({ filePath }: {
5
5
  filePath: string;
6
6
  });
7
- getResolvedTmpFile(): any;
7
+ stop(): void;
8
+ getResolvedTmpFile(): Record<string, unknown>;
8
9
  }
@@ -0,0 +1 @@
1
+ import{EventEmitter as L}from"node:events";import{readFileSync as N,unwatchFile as G,watchFile as Q}from"node:fs";import{resolve as R}from"node:path";import{parse as U}from"yaml";import{resolveObjWithHandlebars as V}from"../../../utils/helpers/index.js";import{normalizeTmpDocument as X}from"../../../utils/helpers/tmp/tmp-schema.js";import{resolveTmpWatchIntervalMs as A}from"../../../utils/helpers/tmp/tmp-watch.js";export class TmpFileLoader extends L{#k={};#q;#B=A(null);#A=!1;constructor({filePath:k}){super();this.#q=R(k);this.#G();this.#K()}#G(){try{const k=N(this.#q,"utf8"),q=U(k),B=A(q),K=this.#A&&B!==this.#B;this.#k=q;this.#B=B;this.emit("reload",this.#k);if(K)this.#K()}catch(k){console.error(`[TmpFileLoader] Error: ${k}`)}}#K(){if(this.#A)G(this.#q);this.#B=A(this.#k);Q(this.#q,{interval:this.#B},(k,q)=>{if(k.mtimeMs!==q.mtimeMs)this.#G()});this.#A=!0}stop(){if(this.#A){G(this.#q);this.#A=!1}this.removeAllListeners()}getResolvedTmpFile(){const k=Object.keys(this.#k).length>0?this.#k:(this.#G(),this.#k);return X(V(k,k))}}
@@ -0,0 +1 @@
1
+ var __filename="/home/runner/work/-xrystal-core/-xrystal-core/x/dist/utils/models/classes/class.x.js";import{createContainer as w,asClass as y,asValue as L,InjectionMode as z,listModules as C,Lifetime as h}from"awilix";import p from"node:path";import{pathToFileURL as A}from"node:url";export const xSymbol=Symbol.for("@xrystal/core/di-container");class I{checkRegistration(e,t){return!!e.registrations[t]}}class N extends I{container;initializedNames=new Set;loadedPaths=new Set;registeredClasses=new Set;isInitializing=!1;constructor(){super();this.container=w({injectionMode:z.PROXY,strict:!0})}getName(e){if(typeof e==="string")return e.charAt(0).toLowerCase()+e.slice(1);if(typeof e==="function"&&e.name)return e.name.charAt(0).toLowerCase()+e.name.slice(1);return""}async load(e,t={}){const{verbose:r=!1,exclude:m=[],lifetime:s=h.SINGLETON}=t,i=process.cwd(),n=(Array.isArray(e)?e:[e]).map((c)=>{return(p.isAbsolute(c)?c:p.resolve(i,c)).replace(/\\/g,"/").toLowerCase()});let a=[];try{a=C(n)}catch(c){return this}for(const c of a){const f=c.path.replace(/\\/g,"/").toLowerCase();if(this.loadedPaths.has(f))continue;if(f===__filename.replace(/\\/g,"/").toLowerCase()||f.endsWith(".d.ts"))continue;try{const g=await import(A(c.path).href);let o=g.default;if(!o)o=Object.values(g).find((l)=>typeof l==="function"&&!!l.prototype&&!!l.name);if(typeof o==="function"&&!!o.prototype&&!!o.name){if(this.registeredClasses.has(o))continue;const l=this.getName(o);if(l&&!this.checkRegistration(this.container,l)){this.container.register({[l]:y(o).setLifetime(s)});this.loadedPaths.add(f);this.registeredClasses.add(o)}}}catch(u){if(r)console.error("[DI] Load Error:",u.message)}}return this}register(e,t=h.SINGLETON){const r=this.getName(e);if(!r||this.registeredClasses.has(e))return this;if(this.checkRegistration(this.container,r))return this;this.container.register({[r]:y(e).setLifetime(t)});this.registeredClasses.add(e);return this}registerInstance(e,t){if(!e)return this;const r=this.getName(e);this.container.register({[r]:L(t)});return this}async initialize(e,t=!1){if(this.isInitializing)return this;this.isInitializing=!0;try{const r=e?Array.isArray(e)?e:[e]:[];for(const s of r){const i=this.getName(s.service);if(!i||this.initializedNames.has(i))continue;const n=this.container.registrations[i];if(!n||n.lifetime!==h.SINGLETON)continue;try{const a=this.container.cradle[i];if(a&&typeof a.onInit==="function")await a.onInit(s.props||{});this.initializedNames.add(i)}catch(a){if(t)console.error(`[DI] Priority onInit Failed (${i}):`,a.message)}}const m=Object.keys(this.container.registrations);for(const s of m){if(this.initializedNames.has(s))continue;if(this.container.registrations[s].lifetime!==h.SINGLETON)continue;try{const n=this.container.cradle[s];if(n&&typeof n.onInit==="function")await n.onInit({});this.initializedNames.add(s)}catch(n){if(t)console.error(`[DI] Auto onInit Failed (${s}):`,n.message)}}for(const s of this.initializedNames)try{const i=this.container.cradle[s];if(i&&typeof i.onAfterInit==="function")await i.onAfterInit()}catch(i){if(t)console.error(`[DI] onAfterInit Failed (${s}):`,i.message)}}finally{this.isInitializing=!1}return this}get(e){const t=this.getName(e);return this.container.resolve(t)}async shutdown(){for(const e of this.initializedNames)try{const t=this.container.cradle[e];if(t&&typeof t.onDispose==="function")await t.onDispose()}catch(t){console.error(`[DI] onDispose Failed (${e})`)}await this.container.dispose()}get cradle(){return this.container.cradle}}const d=globalThis;if(!d[xSymbol])d[xSymbol]=new N;export default d[xSymbol];
@@ -7,9 +7,17 @@ export declare enum ProtocolEnum {
7
7
  HTTP = "http",
8
8
  HTTPS = "https",
9
9
  WEBSOCKET = "ws",
10
- SOCKETIO = "ws",
10
+ SOCKETIO = "socketio",
11
11
  NONE = "none"
12
12
  }
13
+ export declare enum FrameworkEnum {
14
+ EXPRESS = "express",
15
+ ELYSIA = "elysia",
16
+ NODE = "node",
17
+ FETCH = "fetch",
18
+ WEBSOCKET = "websocket",
19
+ SOCKETIO = "socketio"
20
+ }
13
21
  export declare enum PolarityTypeEnum {
14
22
  NOTR = 0,
15
23
  POSITIVE = 1,
@@ -93,6 +101,11 @@ export declare enum CoreClientsEnum {
93
101
  BASE_API_CLIENT = "base_client_name",
94
102
  SOAP_API_CLIENT = "soap_api_client"
95
103
  }
104
+ export declare enum GStoreScopeEnum {
105
+ GLOBAL = "global",
106
+ RUN = "run",
107
+ CONTROLLER = "controller"
108
+ }
96
109
  export declare enum EndpointResourceEnum {
97
110
  EXAMPLE = "example",
98
111
  FULL = "full",
@@ -0,0 +1 @@
1
+ export var NodeEnvEnum;(function(N){N.DEV="dev";N.TEST="test";N.PROD="prod"})(NodeEnvEnum||(NodeEnvEnum={}));export var ProtocolEnum;(function(N){N.HTTP="http";N.HTTPS="https";N.WEBSOCKET="ws";N.SOCKETIO="socketio";N.NONE="none"})(ProtocolEnum||(ProtocolEnum={}));export var FrameworkEnum;(function(N){N.EXPRESS="express";N.ELYSIA="elysia";N.NODE="node";N.FETCH="fetch";N.WEBSOCKET="websocket";N.SOCKETIO="socketio"})(FrameworkEnum||(FrameworkEnum={}));export var PolarityTypeEnum;(function(N){N[N.NOTR=0]="NOTR";N[N.POSITIVE=1]="POSITIVE";N[N.NEGATIVE=-1]="NEGATIVE"})(PolarityTypeEnum||(PolarityTypeEnum={}));export var LoggerLayerEnum;(function(N){N[N.CRITICAL=0]="CRITICAL";N[N.ERROR=1]="ERROR";N[N.WARN=2]="WARN";N[N.INFO=3]="INFO";N[N.HTTP=4]="HTTP";N[N.DEBUG=5]="DEBUG"})(LoggerLayerEnum||(LoggerLayerEnum={}));export var CountryCodeEnum;(function(N){N.EN="en";N.TR="tr"})(CountryCodeEnum||(CountryCodeEnum={}));export var CurrencyCodeEnum;(function(N){N.USD="usd";N.EUR="eur";N.TRY="try"})(CurrencyCodeEnum||(CurrencyCodeEnum={}));export var HttpMethodEnum;(function(N){N.POST="post";N.GET="get";N.PUT="put";N.DELETE="delete"})(HttpMethodEnum||(HttpMethodEnum={}));export var ContentTypeEnum;(function(N){N.applicationJson="application/json";N.applicationXWwwFormUrlencoded="application/x-www-form-urlencoded"})(ContentTypeEnum||(ContentTypeEnum={}));export var DeviceStatusEnum;(function(N){N[N.PENDING=0]="PENDING";N[N.OFFLINE=1]="OFFLINE";N[N.ONLINE=2]="ONLINE";N[N.CONNECTING=3]="CONNECTING";N[N.CONNECTED=4]="CONNECTED"})(DeviceStatusEnum||(DeviceStatusEnum={}));export var DevicePlatformEnum;(function(N){N.WEB="web";N.NATIVE="native";N.OTHER="other"})(DevicePlatformEnum||(DevicePlatformEnum={}));export var DeviceOSEnum;(function(N){N.ANDROID="android";N.IOS="ios";N.WINDOWS="windows";N.MACOS="macos";N.MACOSX="macosx";N.OTHER="other"})(DeviceOSEnum||(DeviceOSEnum={}));export var PriorityEnum;(function(N){N[N.HIGH=0]="HIGH";N[N.MEDIUM=1]="MEDIUM";N[N.LOW=2]="LOW"})(PriorityEnum||(PriorityEnum={}));export var PrivacyEnum;(function(N){N[N.PRIVATE=0]="PRIVATE";N[N.PUBLIC=1]="PUBLIC";N[N.ONLY_FRIENDS=2]="ONLY_FRIENDS"})(PrivacyEnum||(PrivacyEnum={}));export var TimezoneEnum;(function(N){N.UTC="UTC";N.EtcUTC="Etc/UTC";N.EtcGMT="Etc/GMT"})(TimezoneEnum||(TimezoneEnum={}));export var ModeEnum;(function(N){N.MONOLITIC="monolitic";N.MICRO_SERVICE="micro_service"})(ModeEnum||(ModeEnum={}));export var TokensEnum;(function(N){N.INTERNAL_API_TOKEN="internal_api_key";N.CSRF_TOKEN="csrf_token";N.ACCESS_TOKEN="access_token";N.REFRESH_TOKEN="refresh_token";N.REFERENCE_TOKEN="reference_token";N.PERSONAL_ACCESS_TOKEN="personal_access_token"})(TokensEnum||(TokensEnum={}));export var CoreClientsEnum;(function(N){N.BASE_API_CLIENT="base_client_name";N.SOAP_API_CLIENT="soap_api_client"})(CoreClientsEnum||(CoreClientsEnum={}));export var GStoreScopeEnum;(function(N){N.GLOBAL="global";N.RUN="run";N.CONTROLLER="controller"})(GStoreScopeEnum||(GStoreScopeEnum={}));export var EndpointResourceEnum;(function(N){N.EXAMPLE="example";N.FULL="full";N.SYSTEM="system";N.CLIENTS="clients";N.AUTH="auth";N.ACCOUNTS="accounts";N.USERS="users";N.TRANSACTIONS="transactions";N.NOTIFICATIONS="notifications";N.ADDRESSES="addresses";N.PAYMENTS="payments";N.COMMISSIONS_AND_TAXES="commissions-and-taxes";N.SUPPORTS="supports";N.INVOICES="invoices";N.FILES="files";N.TOKENS="tokens";N.WEBHOOKS="webhooks";N.OTHERS="others"})(EndpointResourceEnum||(EndpointResourceEnum={}));
@@ -0,0 +1,9 @@
1
+ import _ from 'lodash';
2
+ import x from '../../utils/models/classes/class.x';
3
+ import locator from '../../utils/models/classes/class.service-locator';
4
+ export * from '../../utils/models/classes/class.tmp-file-loader';
5
+ export * from '../../utils/models/classes/class.interfaces';
6
+ export * from '../../utils/models/classes/class.clients';
7
+ export * from '../../utils/models/types';
8
+ export * from '../../utils/models/enums';
9
+ export { x, locator, _ };
@@ -0,0 +1 @@
1
+ import _ from"lodash";import x from"../../utils/models/classes/class.x.js";import locator from"../../utils/models/classes/class.service-locator.js";export*from"../../utils/models/classes/class.tmp-file-loader.js";export*from"../../utils/models/classes/class.interfaces.js";export*from"../../utils/models/classes/class.clients.js";export*from"../../utils/models/types/index.js";export*from"../../utils/models/enums/index.js";export{x,locator,_};
@@ -0,0 +1,5 @@
1
+ export interface ICustomError extends Error {
2
+ status?: number;
3
+ }
4
+ export type GlobalObject = typeof globalThis;
5
+ /** Ambient module shims: `@xrystal/dto/*`, `qs` — see `./shims.d.ts` */
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,2 @@
1
+ export declare const sourceDir: string;
2
+ export declare const packageRootDir: string;
@@ -0,0 +1 @@
1
+ import o from"node:path";import{fileURLToPath as t}from"node:url";const r=o.dirname(t(import.meta.url));export const sourceDir=o.resolve(r,".."),packageRootDir=o.resolve(r,"..","..");
package/x/tmp.yml CHANGED
@@ -2,26 +2,57 @@ project:
2
2
  name: x
3
3
 
4
4
  configs:
5
- rootFolderPath: x
6
- service: service-name
5
+ service:
6
+ name: example-service
7
+ framework: elysia
7
8
 
8
- loaders:
9
- configs:
10
- loadPath: '@/source/utils/helpers/configs/index'
9
+ paths:
10
+ root: ./x
11
+ source: ./source
12
+ special:
13
+ tests: tests
14
+ environments: environments
15
+ dist: dist
11
16
 
12
- loggers:
13
- loadPath: logs
14
- logLevel: debug
17
+ protocols:
18
+ - http
19
+ - ws
15
20
 
16
- localization:
17
- loadPath: assets/langs
18
- fallbackLang: en
19
- preloadLangs:
20
- - en
21
- - tr
21
+ loaders:
22
+ configs:
23
+ loadPath: '@/source/utils/helpers/configs/index'
22
24
 
23
- controller:
24
- protocols: http
25
+ system:
26
+ gStore:
27
+ options:
28
+ bootstrap: true
29
+ autoCreateProps: true
30
+ vars:
31
+ test: false
32
+
33
+ loggers:
34
+ loadPath: logs
35
+ logLevel: debug
36
+
37
+ localization:
38
+ loadPath: assets/langs
39
+ fallbackLang: en
40
+ preloadLangs:
41
+ - en
42
+ - tr
43
+
44
+ dto:
45
+ withDefaultHeaders: true
46
+
47
+ controller:
48
+
49
+ build:
50
+ typecheck: true
51
+ minify: true
52
+
53
+ core:
54
+ tmp:
55
+ fileWatchIntervalMs: 500
25
56
 
26
57
  end:
27
- version: 1
58
+ version: 1
@@ -1,17 +0,0 @@
1
- import path from "node:path"
2
-
3
- export class Constants {
4
- static packageName = '@xrystal/core'
5
-
6
- static defaultRootFolderName = 'x'
7
- static defaultTmpFileName = 'tmp'
8
- static defaultTmpFileExt = '.yml'
9
-
10
- static defaultTmpFilePath = path.join(__dirname, `../../${Constants.defaultRootFolderName}/${Constants.defaultTmpFileName}.${Constants.defaultTmpFileExt}`)
11
- static defaultOwnerTmpFilePath = path.join(process.cwd(),`./${Constants.defaultRootFolderName}/${Constants.defaultTmpFileName}.${Constants.defaultTmpFileExt}`)
12
-
13
- static publicFolderName = 'public'
14
- static kafkaLogsTopic = 'logs'
15
-
16
- static templateRepoUri = 'https://github.com/xdloper/xastral-general-project-tmp.git'
17
- }