appos 0.3.5-0 → 0.3.7-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/dist/bin/main.mjs +3 -3
  2. package/dist/bin/youch-handler-D7REmh8Z.mjs +2 -0
  3. package/dist/exports/api/adapter-C2mMJKvG.mjs +1504 -0
  4. package/dist/exports/api/{auth-schema.mjs → auth-schema-CON4yFFY.mjs} +2 -3
  5. package/dist/exports/api/bun-sqlite-dialect-CPpPZa23.mjs +155 -0
  6. package/dist/exports/{cli/_virtual/rolldown_runtime.mjs → api/chunk-CyXqrcp_.mjs} +14 -1
  7. package/dist/exports/api/conditions-DjBAWfiK.mjs +116 -0
  8. package/dist/exports/api/dialect-CUUD24Ge.mjs +72 -0
  9. package/dist/exports/api/env-CwT3zhez.mjs +1 -0
  10. package/dist/exports/api/esm-_hkVMulx.mjs +15816 -0
  11. package/dist/exports/api/event-BHFSE6hY.mjs +20983 -0
  12. package/dist/exports/api/extract-blob-metadata-BMgUEPcW.mjs +4 -0
  13. package/dist/exports/api/extract-blob-metadata-_9RUEwoU.mjs +9818 -0
  14. package/dist/exports/api/generate-image-variant-DOIzj1wJ.mjs +4 -0
  15. package/dist/exports/api/generate-image-variant-DxOPoGAk.mjs +118 -0
  16. package/dist/exports/api/generate-preview-CvTFuq58.mjs +160 -0
  17. package/dist/exports/api/generate-preview-Dk3coswZ.mjs +4 -0
  18. package/dist/exports/api/index.d.mts +7347 -20
  19. package/dist/exports/api/index.mjs +146856 -18
  20. package/dist/exports/api/kysely-adapter-CmP2TbkS.mjs +296 -0
  21. package/dist/exports/api/memory-adapter-BzhRhLFK.mjs +212 -0
  22. package/dist/exports/api/node-sqlite-dialect-Bl5suBxl.mjs +155 -0
  23. package/dist/exports/api/orm-CMqufD21.mjs +153690 -0
  24. package/dist/exports/api/orm-DXqYuKvB.d.mts +11 -0
  25. package/dist/exports/api/orm.d.mts +2 -11
  26. package/dist/exports/api/orm.mjs +4 -42
  27. package/dist/exports/api/pdf-YxB2Hm1p.mjs +25822 -0
  28. package/dist/exports/api/purge-attachment-Cf6KH2Jv.mjs +34 -0
  29. package/dist/exports/api/purge-attachment-DIuil7ps.mjs +4 -0
  30. package/dist/exports/{cli/api/workflows/purge-audit-logs.mjs → api/purge-audit-logs-z6j_Pu47.mjs} +3 -3
  31. package/dist/exports/{cli/api/workflows/purge-unattached-blobs.mjs → api/purge-unattached-blobs-B0TfY5Hk.mjs} +1 -1
  32. package/dist/exports/api/react-BYhV5bYt.mjs +1131 -0
  33. package/dist/exports/api/server.node-DyVrQ6cz.mjs +19298 -0
  34. package/dist/exports/api/table-6bTIEqON.mjs +2636 -0
  35. package/dist/exports/api/{workflows/track-db-changes.mjs → track-db-changes-BysaV6nN.mjs} +14 -14
  36. package/dist/exports/api/{workflow.mjs → workflow-BuSWHcX-.mjs} +121 -10
  37. package/dist/exports/api/workflows/auth-schema-BFve3hgZ.mjs +2813 -0
  38. package/dist/exports/api/workflows/{_virtual/rolldown_runtime.mjs → chunk-B36mNPO4.mjs} +5 -1
  39. package/dist/exports/api/workflows/extract-blob-metadata-BcWKvY2K.mjs +9818 -0
  40. package/dist/exports/{cli/api/workflows/generate-image-variant.mjs → api/workflows/generate-image-variant-BAFvL_zV.mjs} +20 -20
  41. package/dist/exports/{cli/api/workflows/generate-preview.mjs → api/workflows/generate-preview-BjlIVYYp.mjs} +6 -6
  42. package/dist/exports/api/workflows/index.d.mts +2011 -1
  43. package/dist/exports/api/workflows/index.mjs +2 -1
  44. package/dist/exports/api/workflows/pdf-DUB8zyIc.mjs +25822 -0
  45. package/dist/exports/{cli/api/workflows/purge-attachment.mjs → api/workflows/purge-attachment-k_sdxTPY.mjs} +3 -3
  46. package/dist/exports/api/workflows/{purge-audit-logs.mjs → purge-audit-logs-zCyWj4Mw.mjs} +12 -3
  47. package/dist/exports/api/workflows/{purge-unattached-blobs.mjs → purge-unattached-blobs-CdsuFAeW.mjs} +1 -1
  48. package/dist/exports/api/workflows/track-db-changes-CiKaI9gT.mjs +20943 -0
  49. package/dist/exports/api/workflows/track-db-changes-DEWQYryO.mjs +4 -0
  50. package/dist/exports/{cli/api/workflow.mjs → api/workflows/workflow-BjM2xCa6.mjs} +23 -3
  51. package/dist/exports/api/workflows/zod-Br0enFWK.mjs +12333 -0
  52. package/dist/exports/api/zod-CdrJdBtV.mjs +12571 -0
  53. package/dist/exports/cli/auth-schema-CNuOqPi-.mjs +2813 -0
  54. package/dist/exports/{api/_virtual/rolldown_runtime.mjs → cli/chunk-B36mNPO4.mjs} +5 -1
  55. package/dist/exports/cli/extract-blob-metadata-CV1Ke90d.mjs +9818 -0
  56. package/dist/exports/{api/workflows/generate-image-variant.mjs → cli/generate-image-variant-CM1BrVvZ.mjs} +20 -20
  57. package/dist/exports/{api/workflows/generate-preview.mjs → cli/generate-preview-DdHQ3ukz.mjs} +6 -6
  58. package/dist/exports/cli/index.d.mts +2142 -2
  59. package/dist/exports/cli/index.mjs +41 -1
  60. package/dist/exports/cli/pdf-CLUPEIdT.mjs +25822 -0
  61. package/dist/exports/{api/workflows/purge-attachment.mjs → cli/purge-attachment-Dc_J74dG.mjs} +3 -3
  62. package/dist/exports/cli/purge-audit-logs-DFhWh-Bx.mjs +56 -0
  63. package/dist/exports/cli/purge-unattached-blobs-C1MRlM_2.mjs +46 -0
  64. package/dist/exports/cli/track-db-changes-CfneOF2_.mjs +20943 -0
  65. package/dist/exports/{api/workflows/api/workflow.mjs → cli/workflow-DSbbXBMt.mjs} +23 -3
  66. package/dist/exports/cli/zod-7q0_Mtnn.mjs +12333 -0
  67. package/dist/exports/tests/api.d.mts +7354 -5
  68. package/dist/exports/tests/api.mjs +79 -1
  69. package/dist/exports/tests/auth-schema-B_qHPoa4.mjs +1 -0
  70. package/dist/exports/tests/chunk-Cii4FAhs.mjs +1 -0
  71. package/dist/exports/tests/conditions-BeWxRN_Z.mjs +1 -0
  72. package/dist/exports/tests/constants-D_m07gCJ.mjs +1 -0
  73. package/dist/exports/tests/dist-Cx2HEBOB.mjs +296 -0
  74. package/dist/exports/tests/dist-DnACOvNW.mjs +7 -0
  75. package/dist/exports/tests/extract-blob-metadata-6xQrarjB.mjs +169 -0
  76. package/dist/exports/tests/generate-image-variant-KQITLmCx.mjs +1 -0
  77. package/dist/exports/tests/generate-preview-YnujQo5I.mjs +1 -0
  78. package/dist/exports/tests/mock-BvoS23fi.mjs +1 -0
  79. package/dist/exports/tests/mock.mjs +1 -1
  80. package/dist/exports/tests/pdf-lZ-as2o7.mjs +13 -0
  81. package/dist/exports/tests/purge-attachment-DTSmCl-z.mjs +1 -0
  82. package/dist/exports/tests/purge-audit-logs-D0_UUhN2.mjs +1 -0
  83. package/dist/exports/tests/purge-unattached-blobs-IENmSB8K.mjs +1 -0
  84. package/dist/exports/tests/react.mjs +6 -1
  85. package/dist/exports/tests/setup.d.mts +1 -1
  86. package/dist/exports/tests/setup.mjs +34 -1
  87. package/dist/exports/tests/table-CmPSf_pE.mjs +1 -0
  88. package/dist/exports/tests/track-db-changes-Td9Q3DLd.mjs +1 -0
  89. package/dist/exports/tests/{api/workflow.mjs → workflow-BWRWyC83.mjs} +1 -1
  90. package/dist/exports/tests/youch-handler-efUxKCCs.mjs +1 -0
  91. package/dist/exports/tests/zod-CkJO9qpV.mjs +23 -0
  92. package/dist/exports/vendors/date.js +13236 -1
  93. package/dist/exports/vendors/toolkit.js +2206 -1
  94. package/dist/exports/vendors/zod.js +12344 -1
  95. package/dist/exports/vite/index.d.mts +1 -1
  96. package/dist/exports/vite/index.mjs +26 -1
  97. package/dist/exports/vite/lib-B0s0q6aX.mjs +382 -0
  98. package/dist/exports/vite/lib-BkrbWMaV.mjs +1 -0
  99. package/dist/exports/web/browser-ponyfill-DxTJMXNq.js +443 -0
  100. package/dist/exports/web/chunk-DksrlJLg.js +49 -0
  101. package/dist/exports/web/index.d.ts +2546 -2
  102. package/dist/exports/web/index.js +9295 -6
  103. package/dist/exports/web/plugin-DqTFWG7p.js +250 -0
  104. package/package.json +1 -7
  105. package/dist/bin/youch-handler-DrYdbUhe.mjs +0 -2
  106. package/dist/exports/api/app-context.d.mts +0 -115
  107. package/dist/exports/api/app-context.mjs +0 -24
  108. package/dist/exports/api/auth-schema.d.mts +0 -4248
  109. package/dist/exports/api/auth.d.mts +0 -402
  110. package/dist/exports/api/auth.mjs +0 -188
  111. package/dist/exports/api/cache.d.mts +0 -44
  112. package/dist/exports/api/cache.mjs +0 -28
  113. package/dist/exports/api/config.d.mts +0 -28
  114. package/dist/exports/api/config.mjs +0 -72
  115. package/dist/exports/api/constants.mjs +0 -92
  116. package/dist/exports/api/container.d.mts +0 -210
  117. package/dist/exports/api/container.mjs +0 -49
  118. package/dist/exports/api/database.d.mts +0 -101
  119. package/dist/exports/api/database.mjs +0 -219
  120. package/dist/exports/api/event.d.mts +0 -235
  121. package/dist/exports/api/event.mjs +0 -236
  122. package/dist/exports/api/i18n.d.mts +0 -34
  123. package/dist/exports/api/i18n.mjs +0 -45
  124. package/dist/exports/api/instrumentation.d.mts +0 -7
  125. package/dist/exports/api/instrumentation.mjs +0 -40
  126. package/dist/exports/api/logger.d.mts +0 -21
  127. package/dist/exports/api/logger.mjs +0 -26
  128. package/dist/exports/api/mailer.d.mts +0 -70
  129. package/dist/exports/api/mailer.mjs +0 -37
  130. package/dist/exports/api/middleware/request-logger.d.mts +0 -24
  131. package/dist/exports/api/middleware.d.mts +0 -39
  132. package/dist/exports/api/middleware.mjs +0 -73
  133. package/dist/exports/api/openapi.d.mts +0 -271
  134. package/dist/exports/api/openapi.mjs +0 -507
  135. package/dist/exports/api/otel.d.mts +0 -40
  136. package/dist/exports/api/otel.mjs +0 -56
  137. package/dist/exports/api/redis.d.mts +0 -34
  138. package/dist/exports/api/redis.mjs +0 -41
  139. package/dist/exports/api/storage-schema.d.mts +0 -707
  140. package/dist/exports/api/storage-schema.mjs +0 -72
  141. package/dist/exports/api/storage.d.mts +0 -506
  142. package/dist/exports/api/storage.mjs +0 -833
  143. package/dist/exports/api/web/auth.mjs +0 -17
  144. package/dist/exports/api/workflow.d.mts +0 -250
  145. package/dist/exports/api/workflows/api/auth-schema.mjs +0 -373
  146. package/dist/exports/api/workflows/api/auth.d.mts +0 -379
  147. package/dist/exports/api/workflows/api/cache.d.mts +0 -44
  148. package/dist/exports/api/workflows/api/config.d.mts +0 -18
  149. package/dist/exports/api/workflows/api/container.d.mts +0 -167
  150. package/dist/exports/api/workflows/api/database.d.mts +0 -47
  151. package/dist/exports/api/workflows/api/event.d.mts +0 -68
  152. package/dist/exports/api/workflows/api/event.mjs +0 -126
  153. package/dist/exports/api/workflows/api/logger.d.mts +0 -21
  154. package/dist/exports/api/workflows/api/mailer.d.mts +0 -70
  155. package/dist/exports/api/workflows/api/orm.d.mts +0 -13
  156. package/dist/exports/api/workflows/api/redis.mjs +0 -3
  157. package/dist/exports/api/workflows/api/storage-schema.d.mts +0 -699
  158. package/dist/exports/api/workflows/api/storage.d.mts +0 -396
  159. package/dist/exports/api/workflows/api/workflow.d.mts +0 -24
  160. package/dist/exports/api/workflows/constants.mjs +0 -23
  161. package/dist/exports/api/workflows/extract-blob-metadata.mjs +0 -132
  162. package/dist/exports/api/workflows/generate-image-variant.d.mts +0 -63
  163. package/dist/exports/api/workflows/track-db-changes.d.mts +0 -72
  164. package/dist/exports/cli/api/auth-schema.mjs +0 -373
  165. package/dist/exports/cli/api/auth.d.mts +0 -379
  166. package/dist/exports/cli/api/cache.d.mts +0 -44
  167. package/dist/exports/cli/api/config.d.mts +0 -18
  168. package/dist/exports/cli/api/container.d.mts +0 -167
  169. package/dist/exports/cli/api/database.d.mts +0 -47
  170. package/dist/exports/cli/api/event.d.mts +0 -68
  171. package/dist/exports/cli/api/event.mjs +0 -126
  172. package/dist/exports/cli/api/logger.d.mts +0 -21
  173. package/dist/exports/cli/api/mailer.d.mts +0 -70
  174. package/dist/exports/cli/api/orm.d.mts +0 -13
  175. package/dist/exports/cli/api/redis.mjs +0 -3
  176. package/dist/exports/cli/api/storage-schema.d.mts +0 -699
  177. package/dist/exports/cli/api/storage.d.mts +0 -396
  178. package/dist/exports/cli/api/workflow.d.mts +0 -2
  179. package/dist/exports/cli/api/workflows/extract-blob-metadata.mjs +0 -132
  180. package/dist/exports/cli/api/workflows/generate-image-variant.d.mts +0 -63
  181. package/dist/exports/cli/api/workflows/track-db-changes.mjs +0 -110
  182. package/dist/exports/cli/command.d.mts +0 -56
  183. package/dist/exports/cli/command.mjs +0 -43
  184. package/dist/exports/cli/constants.mjs +0 -23
  185. package/dist/exports/cli/context.d.mts +0 -170
  186. package/dist/exports/devtools/index.d.ts +0 -3
  187. package/dist/exports/devtools/index.js +0 -4
  188. package/dist/exports/tests/_virtual/rolldown_runtime.mjs +0 -1
  189. package/dist/exports/tests/api/app-context.d.mts +0 -115
  190. package/dist/exports/tests/api/app-context.mjs +0 -1
  191. package/dist/exports/tests/api/auth-schema.d.mts +0 -4248
  192. package/dist/exports/tests/api/auth-schema.mjs +0 -1
  193. package/dist/exports/tests/api/auth.d.mts +0 -402
  194. package/dist/exports/tests/api/cache.d.mts +0 -44
  195. package/dist/exports/tests/api/config.d.mts +0 -28
  196. package/dist/exports/tests/api/container.d.mts +0 -210
  197. package/dist/exports/tests/api/database.d.mts +0 -101
  198. package/dist/exports/tests/api/database.mjs +0 -1
  199. package/dist/exports/tests/api/event.d.mts +0 -235
  200. package/dist/exports/tests/api/event.mjs +0 -1
  201. package/dist/exports/tests/api/i18n.d.mts +0 -34
  202. package/dist/exports/tests/api/index.d.mts +0 -26
  203. package/dist/exports/tests/api/logger.d.mts +0 -21
  204. package/dist/exports/tests/api/mailer.d.mts +0 -70
  205. package/dist/exports/tests/api/middleware/error-handler.mjs +0 -1
  206. package/dist/exports/tests/api/middleware/health.mjs +0 -1
  207. package/dist/exports/tests/api/middleware/i18n.mjs +0 -1
  208. package/dist/exports/tests/api/middleware/request-logger.d.mts +0 -24
  209. package/dist/exports/tests/api/middleware/request-logger.mjs +0 -1
  210. package/dist/exports/tests/api/middleware/shutdown.mjs +0 -1
  211. package/dist/exports/tests/api/middleware/timeout.mjs +0 -1
  212. package/dist/exports/tests/api/middleware/youch-handler.mjs +0 -1
  213. package/dist/exports/tests/api/middleware.d.mts +0 -39
  214. package/dist/exports/tests/api/middleware.mjs +0 -1
  215. package/dist/exports/tests/api/openapi.d.mts +0 -271
  216. package/dist/exports/tests/api/openapi.mjs +0 -1
  217. package/dist/exports/tests/api/orm.d.mts +0 -13
  218. package/dist/exports/tests/api/otel.d.mts +0 -40
  219. package/dist/exports/tests/api/redis.d.mts +0 -34
  220. package/dist/exports/tests/api/redis.mjs +0 -1
  221. package/dist/exports/tests/api/server.mjs +0 -1
  222. package/dist/exports/tests/api/storage-schema.d.mts +0 -707
  223. package/dist/exports/tests/api/storage.d.mts +0 -506
  224. package/dist/exports/tests/api/workflow.d.mts +0 -250
  225. package/dist/exports/tests/api/workflows/extract-blob-metadata.mjs +0 -1
  226. package/dist/exports/tests/api/workflows/generate-image-variant.d.mts +0 -63
  227. package/dist/exports/tests/api/workflows/generate-image-variant.mjs +0 -1
  228. package/dist/exports/tests/api/workflows/generate-preview.mjs +0 -1
  229. package/dist/exports/tests/api/workflows/purge-attachment.mjs +0 -1
  230. package/dist/exports/tests/api/workflows/purge-audit-logs.mjs +0 -1
  231. package/dist/exports/tests/api/workflows/purge-unattached-blobs.mjs +0 -1
  232. package/dist/exports/tests/api/workflows/track-db-changes.mjs +0 -1
  233. package/dist/exports/tests/constants.mjs +0 -1
  234. package/dist/exports/tests/instrumentation.d.mts +0 -7
  235. package/dist/exports/tests/instrumentation.mjs +0 -1
  236. package/dist/exports/web/api/auth.d.ts +0 -125
  237. package/dist/exports/web/api/database.d.ts +0 -4
  238. package/dist/exports/web/api/logger.d.ts +0 -1
  239. package/dist/exports/web/auth.d.ts +0 -2388
  240. package/dist/exports/web/auth.js +0 -75
  241. package/dist/exports/web/i18n.d.ts +0 -42
  242. package/dist/exports/web/i18n.js +0 -45
@@ -1,34 +0,0 @@
1
- import { InitOptions, i18n, i18n as i18n$1 } from "i18next";
2
-
3
- //#region src/api/i18n.d.ts
4
-
5
- /**
6
- * i18n initialization options extending i18next's InitOptions.
7
- * Used for both server and client initialization.
8
- */
9
- interface I18nInitOptions extends InitOptions {}
10
- /**
11
- * Type-safe default options for i18n.
12
- * Apps should spread these and override as needed.
13
- */
14
- declare const defaultI18nOptions: {
15
- readonly fallbackLng: "en";
16
- readonly supportedLngs: readonly ["en"];
17
- readonly defaultNS: "translation";
18
- readonly ns: readonly ["translation"];
19
- readonly interpolation: {
20
- readonly escapeValue: false;
21
- };
22
- readonly react: {
23
- readonly useSuspense: false;
24
- };
25
- };
26
- /**
27
- * Initializes i18next for server-side with filesystem backend.
28
- *
29
- * @param opts - Initialization options for i18next.
30
- * @returns A promise that resolves to the initialized i18next instance.
31
- */
32
- declare function defineI18n(opts: I18nInitOptions): Promise<i18n>;
33
- //#endregion
34
- export { I18nInitOptions, defaultI18nOptions, defineI18n, type i18n$1 as i18n };
@@ -1,45 +0,0 @@
1
- import { LOCALES_DIR, PUBLIC_DIR } from "./constants.mjs";
2
- import { join } from "node:path";
3
- import { lstatSync, readdirSync, watch } from "node:fs";
4
- import { createInstance } from "i18next";
5
- import I18nextFsBackend from "i18next-fs-backend";
6
- import { initReactI18next } from "react-i18next";
7
-
8
- //#region src/api/i18n.ts
9
- /**
10
- * Type-safe default options for i18n.
11
- * Apps should spread these and override as needed.
12
- */
13
- const defaultI18nOptions = {
14
- fallbackLng: "en",
15
- supportedLngs: ["en"],
16
- defaultNS: "translation",
17
- ns: ["translation"],
18
- interpolation: { escapeValue: false },
19
- react: { useSuspense: false }
20
- };
21
- /**
22
- * Initializes i18next for server-side with filesystem backend.
23
- *
24
- * @param opts - Initialization options for i18next.
25
- * @returns A promise that resolves to the initialized i18next instance.
26
- */
27
- async function defineI18n(opts) {
28
- const localesDir = join(PUBLIC_DIR, LOCALES_DIR);
29
- const i18n$1 = createInstance();
30
- if (process.env.NODE_ENV !== "production" && !process.env.VITEST && !process.env.CI) watch(localesDir, { recursive: true }, async (event, fn) => {
31
- await i18n$1.reloadResources(opts.supportedLngs || []);
32
- }).unref();
33
- await i18n$1.use(I18nextFsBackend).use(initReactI18next).init({
34
- ...opts,
35
- backend: { loadPath: `${localesDir}/{{lng}}/{{ns}}.json` },
36
- initAsync: false,
37
- preload: readdirSync(localesDir).filter((fileName) => {
38
- return lstatSync(join(localesDir, fileName)).isDirectory();
39
- })
40
- });
41
- return i18n$1;
42
- }
43
-
44
- //#endregion
45
- export { defaultI18nOptions, defineI18n };
@@ -1,7 +0,0 @@
1
- export * from "@opentelemetry/api";
2
-
3
- //#region src/instrumentation.d.ts
4
-
5
- import * as import__opentelemetry_api from "@opentelemetry/api";
6
- //#endregion
7
- export { import__opentelemetry_api as instrumentation_d_exports };
@@ -1,40 +0,0 @@
1
- import { __reExport } from "./_virtual/rolldown_runtime.mjs";
2
- import { register } from "node:module";
3
- import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
4
- import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
5
- import { PinoInstrumentation } from "@opentelemetry/instrumentation-pino";
6
- import { resourceFromAttributes } from "@opentelemetry/resources";
7
- import { NodeSDK } from "@opentelemetry/sdk-node";
8
- import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-node";
9
- import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
10
-
11
- export * from "@opentelemetry/api"
12
-
13
- //#region src/instrumentation.ts
14
- var instrumentation_exports = {};
15
- import * as import__opentelemetry_api from "@opentelemetry/api";
16
- __reExport(instrumentation_exports, import__opentelemetry_api);
17
- register("@opentelemetry/instrumentation/hook.mjs", import.meta.url);
18
- const service = {
19
- name: process.env.APP_NAME || "appos",
20
- version: process.env.APP_VERSION || "development"
21
- };
22
- new NodeSDK({
23
- resource: resourceFromAttributes({
24
- [ATTR_SERVICE_NAME]: service.name,
25
- [ATTR_SERVICE_VERSION]: service.version
26
- }),
27
- spanProcessors: [new BatchSpanProcessor(new OTLPTraceExporter({
28
- url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || "http://localhost:4318/v1/traces",
29
- headers: process.env.OTEL_EXPORTER_OTLP_HEADERS ? JSON.parse(process.env.OTEL_EXPORTER_OTLP_HEADERS) : void 0
30
- }))],
31
- instrumentations: [getNodeAutoInstrumentations({
32
- "@opentelemetry/instrumentation-fs": { enabled: false },
33
- "@opentelemetry/instrumentation-dns": { enabled: false }
34
- }), new PinoInstrumentation({ logHook: (_span, record) => {
35
- record["service.name"] = service.name;
36
- } })]
37
- }).start();
38
-
39
- //#endregion
40
- export { instrumentation_exports };
@@ -1,21 +0,0 @@
1
- import pino, { LoggerOptions } from "pino";
2
-
3
- //#region src/api/logger.d.ts
4
-
5
- /**
6
- * Extended logger options with OpenTelemetry support.
7
- */
8
- interface DefineLoggerOptions extends LoggerOptions {}
9
- /**
10
- * The logger instance type.
11
- */
12
- type Logger = Awaited<ReturnType<typeof defineLogger>>;
13
- /**
14
- * Define the logger instance.
15
- *
16
- * @param opts - The options.
17
- * @returns The logger.
18
- */
19
- declare function defineLogger(opts: DefineLoggerOptions): Promise<pino.Logger<never, boolean>>;
20
- //#endregion
21
- export { DefineLoggerOptions, Logger, defineLogger };
@@ -1,26 +0,0 @@
1
- import pino from "pino";
2
- import pinoPretty from "pino-pretty";
3
-
4
- //#region src/api/logger.ts
5
- /**
6
- * Define the logger instance.
7
- *
8
- * @param opts - The options.
9
- * @returns The logger.
10
- */
11
- async function defineLogger(opts) {
12
- const transports = [];
13
- const commonOpts = {
14
- level: opts.level || "info",
15
- redact: opts.redact || [],
16
- ...transports.length > 0 && { transport: transports.length === 1 ? transports[0] : { targets: transports } }
17
- };
18
- try {
19
- return pino(commonOpts, process.env.NODE_ENV !== "production" && !process.env.VITEST ? pinoPretty() : void 0);
20
- } catch (_) {
21
- return pino(commonOpts);
22
- }
23
- }
24
-
25
- //#endregion
26
- export { defineLogger };
@@ -1,70 +0,0 @@
1
- import Mail from "nodemailer/lib/mailer/index.ts";
2
- import { JSX } from "react";
3
-
4
- //#region src/api/mailer.d.ts
5
-
6
- /**
7
- * The mailer type.
8
- */
9
- type Mailer = ReturnType<typeof defineMailer>;
10
- /**
11
- * The mailer payload type with React component.
12
- */
13
- type MailerPayloadReact = Omit<Mail.Options, "from" | "html" | "text"> & {
14
- /**
15
- * The email address to send the email from.
16
- */
17
- from?: string;
18
- /**
19
- * The React component to render as the email body.
20
- */
21
- react: JSX.Element;
22
- };
23
- /**
24
- * The mailer payload type with direct HTML and text.
25
- */
26
- type MailerPayloadHtml = Omit<Mail.Options, "from"> & {
27
- /**
28
- * The email address to send the email from.
29
- */
30
- from?: string;
31
- /**
32
- * The HTML content of the email.
33
- */
34
- html: string;
35
- /**
36
- * The plain text content of the email.
37
- */
38
- text: string;
39
- };
40
- /**
41
- * The mailer payload type - supports either React component or direct HTML+text.
42
- */
43
- type MailerPayload = MailerPayloadReact | MailerPayloadHtml;
44
- /**
45
- * Define the options for the mailer.
46
- */
47
- interface DefineMailerOptions {
48
- /**
49
- * The default email address to use as the sender.
50
- */
51
- from: string;
52
- /**
53
- * The SMTP URL to use for sending emails.
54
- */
55
- smtpUrl: string;
56
- }
57
- /**
58
- * Define the mailer.
59
- *
60
- * @param env - The environment variables.
61
- * @returns The mailer.
62
- */
63
- declare function defineMailer({
64
- from,
65
- smtpUrl
66
- }: DefineMailerOptions): {
67
- send(payload: MailerPayload): Promise<void>;
68
- };
69
- //#endregion
70
- export { DefineMailerOptions, Mailer, MailerPayload, MailerPayloadHtml, MailerPayloadReact, defineMailer };
@@ -1,37 +0,0 @@
1
- import { render } from "@react-email/render";
2
- import { createTransport } from "nodemailer";
3
-
4
- //#region src/api/mailer.ts
5
- /**
6
- * Define the mailer.
7
- *
8
- * @param env - The environment variables.
9
- * @returns The mailer.
10
- */
11
- function defineMailer({ from, smtpUrl }) {
12
- const mailer = createTransport({ url: smtpUrl });
13
- return { async send(payload) {
14
- let html;
15
- let text;
16
- let mailOptions;
17
- if ("react" in payload) {
18
- [html, text] = await Promise.all([render(payload.react), render(payload.react, { plainText: true })]);
19
- const { react: _, ...rest } = payload;
20
- mailOptions = rest;
21
- } else {
22
- html = payload.html;
23
- text = payload.text;
24
- const { html: _, text: __, ...rest } = payload;
25
- mailOptions = rest;
26
- }
27
- await mailer.sendMail({
28
- from: payload.from || from,
29
- ...mailOptions,
30
- html,
31
- text
32
- });
33
- } };
34
- }
35
-
36
- //#endregion
37
- export { defineMailer };
@@ -1,24 +0,0 @@
1
- import "../logger.mjs";
2
- import { RequestHandler } from "ultimate-express";
3
-
4
- //#region src/api/middleware/request-logger.d.ts
5
-
6
- /**
7
- * Metadata about the HTTP request.
8
- */
9
- interface RequestMetadata {
10
- /**
11
- * Client's IP address from X-Forwarded-For or RemoteAddr.
12
- */
13
- ipAddress: string;
14
- /**
15
- * Client's User-Agent header.
16
- */
17
- userAgent: string;
18
- /**
19
- * Client IP's country from CF-IPCountry header.
20
- */
21
- country: string;
22
- }
23
- //#endregion
24
- export { RequestMetadata };
@@ -1,39 +0,0 @@
1
- import { AppContainer } from "./container.mjs";
2
- import { Express, RequestHandler } from "ultimate-express";
3
-
4
- //#region src/api/middleware.d.ts
5
- interface Middleware {
6
- name: string | null;
7
- handler: (container: AppContainer) => RequestHandler;
8
- }
9
- /**
10
- * Defines a user middleware loaded from api/middleware/ directory.
11
- *
12
- * Use numeric prefixes (000_, 001_, etc.) to control load order.
13
- *
14
- * @example
15
- * // api/middleware/000_custom-auth.ts
16
- * export default defineMiddleware({
17
- * handler: (container) => (req, res, next) => {
18
- * // Custom logic using container
19
- * next();
20
- * },
21
- * });
22
- */
23
- declare function defineMiddleware(config: {
24
- name?: string;
25
- handler: (container: AppContainer) => RequestHandler;
26
- }): Middleware;
27
- /**
28
- * Loads user middleware from a directory and registers them with the app.
29
- *
30
- * Middleware files are loaded in alphabetical order by filename.
31
- * Use numeric prefixes (000_, 001_, etc.) to control the load order.
32
- *
33
- * @param middlewareDir - The directory containing middleware files
34
- * @param container - The application container
35
- * @param app - The Express application instance
36
- */
37
- declare function loadMiddleware(middlewareDir: string, container: AppContainer, app: Express): Promise<void>;
38
- //#endregion
39
- export { Middleware, defineMiddleware, loadMiddleware };
@@ -1,73 +0,0 @@
1
- import { FILE_EXT } from "./constants.mjs";
2
- import { basename } from "node:path";
3
- import fs, { glob } from "node:fs/promises";
4
- import { camelCase } from "es-toolkit";
5
-
6
- //#region src/api/middleware.ts
7
- /**
8
- * Defines a user middleware loaded from api/middleware/ directory.
9
- *
10
- * Use numeric prefixes (000_, 001_, etc.) to control load order.
11
- *
12
- * @example
13
- * // api/middleware/000_custom-auth.ts
14
- * export default defineMiddleware({
15
- * handler: (container) => (req, res, next) => {
16
- * // Custom logic using container
17
- * next();
18
- * },
19
- * });
20
- */
21
- function defineMiddleware(config) {
22
- return {
23
- name: config.name ?? null,
24
- handler: config.handler
25
- };
26
- }
27
- /**
28
- * Extracts middleware name from filename, removing numeric prefix.
29
- * "000_custom-auth.ts" -> "customAuth"
30
- */
31
- function getMiddlewareName(filename) {
32
- return camelCase(basename(filename, ".ts").replace(/^\d+_/, ""));
33
- }
34
- /**
35
- * Loads user middleware from a directory and registers them with the app.
36
- *
37
- * Middleware files are loaded in alphabetical order by filename.
38
- * Use numeric prefixes (000_, 001_, etc.) to control the load order.
39
- *
40
- * @param middlewareDir - The directory containing middleware files
41
- * @param container - The application container
42
- * @param app - The Express application instance
43
- */
44
- async function loadMiddleware(middlewareDir, container, app) {
45
- try {
46
- await fs.access(middlewareDir);
47
- } catch {
48
- return;
49
- }
50
- const files = [];
51
- for await (const file of glob(`${middlewareDir}/**/*.${FILE_EXT}`)) if (!file.endsWith(".test.ts") && !file.endsWith(".spec.ts") && !file.endsWith(".test.js") && !file.endsWith(".spec.js")) files.push(file);
52
- files.sort((a, b) => basename(a).localeCompare(basename(b)));
53
- for (const file of files) try {
54
- const middleware = (await import(file)).default;
55
- if (middleware && typeof middleware.handler === "function") {
56
- const name = middleware.name ?? getMiddlewareName(file);
57
- container.logger.debug({
58
- name,
59
- file
60
- }, "Loading user middleware");
61
- app.use(middleware.handler(container));
62
- } else container.logger.warn({ file }, "Middleware file missing default export with handler function");
63
- } catch (err) {
64
- container.logger.error({
65
- file,
66
- error: err instanceof Error ? err.message : err
67
- }, "Failed to load middleware");
68
- throw err;
69
- }
70
- }
71
-
72
- //#endregion
73
- export { defineMiddleware, loadMiddleware };