appos 0.2.1 → 0.2.3-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 (232) hide show
  1. package/dist/bin/auth-schema-7KeUwlcd.mjs +2 -0
  2. package/dist/bin/concurrently.mjs +2 -0
  3. package/dist/bin/event-v2sCJkNd.mjs +2 -0
  4. package/dist/bin/extract-blob-metadata-TqNd9w-6.mjs +2 -0
  5. package/dist/bin/generate-image-variant-D8H9FxgD.mjs +2 -0
  6. package/dist/bin/generate-preview-5jLZLX6I.mjs +2 -0
  7. package/dist/bin/main.mjs +362 -0
  8. package/dist/bin/purge-attachment-CMlJMNOk.mjs +2 -0
  9. package/dist/bin/purge-audit-logs-hd6q6vnR.mjs +2 -0
  10. package/dist/bin/purge-unattached-blobs-BYv5b9R9.mjs +2 -0
  11. package/dist/bin/track-db-changes-q0Vl7Htm.mjs +2 -0
  12. package/dist/bin/vite.mjs +2 -0
  13. package/dist/bin/vitest.mjs +2 -0
  14. package/dist/bin/workflow-BagSlsMp.mjs +2 -0
  15. package/dist/bin/youch-handler-Jj6i1XIT.mjs +2 -0
  16. package/dist/exports/api/_virtual/rolldown_runtime.mjs +1 -0
  17. package/dist/exports/api/app-context.d.mts +115 -0
  18. package/dist/exports/api/app-context.mjs +1 -0
  19. package/dist/exports/api/auth-schema.d.mts +4248 -0
  20. package/dist/exports/api/auth-schema.mjs +1 -0
  21. package/dist/exports/api/auth.d.mts +398 -0
  22. package/dist/exports/api/auth.mjs +1 -0
  23. package/dist/exports/api/cache.d.mts +44 -0
  24. package/dist/exports/api/cache.mjs +1 -0
  25. package/dist/exports/api/config.d.mts +28 -0
  26. package/dist/exports/api/config.mjs +1 -0
  27. package/dist/exports/api/container.d.mts +210 -0
  28. package/dist/exports/api/container.mjs +1 -0
  29. package/dist/exports/api/database.d.mts +99 -0
  30. package/dist/exports/api/database.mjs +1 -0
  31. package/dist/exports/api/event.d.mts +235 -0
  32. package/dist/exports/api/event.mjs +1 -0
  33. package/dist/exports/api/i18n.d.mts +34 -0
  34. package/dist/exports/api/i18n.mjs +1 -0
  35. package/dist/exports/api/index.d.mts +21 -0
  36. package/dist/exports/api/index.mjs +1 -0
  37. package/dist/exports/api/logger.d.mts +21 -0
  38. package/dist/exports/api/logger.mjs +1 -0
  39. package/dist/exports/api/mailer.d.mts +70 -0
  40. package/dist/exports/api/mailer.mjs +1 -0
  41. package/dist/exports/api/middleware/request-logger.d.mts +24 -0
  42. package/dist/exports/api/middleware.d.mts +39 -0
  43. package/dist/exports/api/middleware.mjs +1 -0
  44. package/dist/exports/api/node_modules/.bun/change-case@5.4.4/node_modules/change-case/dist/index.mjs +1 -0
  45. package/dist/exports/api/openapi.d.mts +271 -0
  46. package/dist/exports/api/openapi.mjs +1 -0
  47. package/dist/exports/api/orm.d.mts +13 -0
  48. package/dist/exports/api/orm.mjs +1 -0
  49. package/dist/exports/api/otel.d.mts +40 -0
  50. package/dist/exports/api/otel.mjs +1 -0
  51. package/dist/exports/api/packages/appos/src/constants.mjs +1 -0
  52. package/dist/exports/api/packages/appos/src/instrumentation.d.mts +7 -0
  53. package/dist/exports/api/packages/appos/src/instrumentation.mjs +1 -0
  54. package/dist/exports/api/packages/appos/src/web/auth.mjs +1 -0
  55. package/dist/exports/api/redis.d.mts +34 -0
  56. package/dist/exports/api/redis.mjs +1 -0
  57. package/dist/exports/api/storage-schema.d.mts +707 -0
  58. package/dist/exports/api/storage-schema.mjs +1 -0
  59. package/dist/exports/api/storage.d.mts +506 -0
  60. package/dist/exports/api/storage.mjs +1 -0
  61. package/dist/exports/api/workflow.d.mts +250 -0
  62. package/dist/exports/api/workflow.mjs +1 -0
  63. package/dist/exports/api/workflows/_virtual/rolldown_runtime.mjs +1 -0
  64. package/dist/exports/api/workflows/auth-schema.mjs +1 -0
  65. package/dist/exports/api/workflows/auth.d.mts +375 -0
  66. package/dist/exports/api/workflows/cache.d.mts +44 -0
  67. package/dist/exports/api/workflows/config.d.mts +18 -0
  68. package/dist/exports/api/workflows/container.d.mts +167 -0
  69. package/dist/exports/api/workflows/database.d.mts +46 -0
  70. package/dist/exports/api/workflows/event.d.mts +68 -0
  71. package/dist/exports/api/workflows/event.mjs +1 -0
  72. package/dist/exports/api/workflows/extract-blob-metadata.mjs +1 -0
  73. package/dist/exports/api/workflows/generate-image-variant.d.mts +63 -0
  74. package/dist/exports/api/workflows/generate-image-variant.mjs +1 -0
  75. package/dist/exports/api/workflows/generate-preview.mjs +1 -0
  76. package/dist/exports/api/workflows/index.d.mts +2 -0
  77. package/dist/exports/api/workflows/index.mjs +1 -0
  78. package/dist/exports/api/workflows/logger.d.mts +21 -0
  79. package/dist/exports/api/workflows/mailer.d.mts +70 -0
  80. package/dist/exports/api/workflows/orm.d.mts +13 -0
  81. package/dist/exports/api/workflows/purge-attachment.mjs +1 -0
  82. package/dist/exports/api/workflows/purge-audit-logs.mjs +1 -0
  83. package/dist/exports/api/workflows/purge-unattached-blobs.mjs +1 -0
  84. package/dist/exports/api/workflows/redis.mjs +1 -0
  85. package/dist/exports/api/workflows/storage-schema.d.mts +699 -0
  86. package/dist/exports/api/workflows/storage.d.mts +396 -0
  87. package/dist/exports/api/workflows/track-db-changes.d.mts +72 -0
  88. package/dist/exports/api/workflows/track-db-changes.mjs +1 -0
  89. package/dist/exports/api/workflows/workflow.d.mts +24 -0
  90. package/dist/exports/api/workflows/workflow.mjs +1 -0
  91. package/dist/exports/cli/_virtual/rolldown_runtime.mjs +1 -0
  92. package/dist/exports/cli/api/auth-schema.mjs +1 -0
  93. package/dist/exports/cli/api/auth.d.mts +375 -0
  94. package/dist/exports/cli/api/cache.d.mts +44 -0
  95. package/dist/exports/cli/api/config.d.mts +18 -0
  96. package/dist/exports/cli/api/container.d.mts +167 -0
  97. package/dist/exports/cli/api/database.d.mts +46 -0
  98. package/dist/exports/cli/api/event.d.mts +68 -0
  99. package/dist/exports/cli/api/event.mjs +1 -0
  100. package/dist/exports/cli/api/logger.d.mts +21 -0
  101. package/dist/exports/cli/api/mailer.d.mts +70 -0
  102. package/dist/exports/cli/api/orm.d.mts +13 -0
  103. package/dist/exports/cli/api/redis.mjs +1 -0
  104. package/dist/exports/cli/api/storage-schema.d.mts +699 -0
  105. package/dist/exports/cli/api/storage.d.mts +396 -0
  106. package/dist/exports/cli/api/workflow.d.mts +2 -0
  107. package/dist/exports/cli/api/workflow.mjs +1 -0
  108. package/dist/exports/cli/api/workflows/extract-blob-metadata.mjs +1 -0
  109. package/dist/exports/cli/api/workflows/generate-image-variant.d.mts +63 -0
  110. package/dist/exports/cli/api/workflows/generate-image-variant.mjs +1 -0
  111. package/dist/exports/cli/api/workflows/generate-preview.mjs +1 -0
  112. package/dist/exports/cli/api/workflows/purge-attachment.mjs +1 -0
  113. package/dist/exports/cli/api/workflows/purge-audit-logs.mjs +1 -0
  114. package/dist/exports/cli/api/workflows/purge-unattached-blobs.mjs +1 -0
  115. package/dist/exports/cli/api/workflows/track-db-changes.mjs +1 -0
  116. package/dist/exports/cli/command.d.mts +54 -0
  117. package/dist/exports/cli/command.mjs +1 -0
  118. package/dist/exports/cli/context.d.mts +170 -0
  119. package/dist/exports/cli/index.d.mts +3 -0
  120. package/dist/exports/cli/index.mjs +1 -0
  121. package/dist/exports/devtools/index.d.ts +3 -0
  122. package/dist/exports/devtools/index.js +1 -0
  123. package/dist/exports/instrumentation.d.mts +1 -0
  124. package/dist/exports/instrumentation.mjs +1 -0
  125. package/dist/exports/tests/_virtual/rolldown_runtime.mjs +1 -0
  126. package/dist/exports/tests/api.d.mts +86 -0
  127. package/dist/exports/tests/api.mjs +1 -0
  128. package/dist/exports/tests/mock.d.mts +1 -0
  129. package/dist/exports/tests/mock.mjs +1 -0
  130. package/dist/exports/tests/node_modules/.bun/change-case@5.4.4/node_modules/change-case/dist/index.mjs +1 -0
  131. package/dist/exports/tests/node_modules/.bun/rate-limit-redis@4.3.1_f1fa5524233c9c60/node_modules/rate-limit-redis/dist/index.mjs +25 -0
  132. package/dist/exports/tests/packages/appos/src/api/app-context.d.mts +115 -0
  133. package/dist/exports/tests/packages/appos/src/api/auth-schema.d.mts +4248 -0
  134. package/dist/exports/tests/packages/appos/src/api/auth-schema.mjs +1 -0
  135. package/dist/exports/tests/packages/appos/src/api/auth.d.mts +398 -0
  136. package/dist/exports/tests/packages/appos/src/api/cache.d.mts +44 -0
  137. package/dist/exports/tests/packages/appos/src/api/config.d.mts +28 -0
  138. package/dist/exports/tests/packages/appos/src/api/container.d.mts +210 -0
  139. package/dist/exports/tests/packages/appos/src/api/database.d.mts +99 -0
  140. package/dist/exports/tests/packages/appos/src/api/database.mjs +1 -0
  141. package/dist/exports/tests/packages/appos/src/api/event.d.mts +235 -0
  142. package/dist/exports/tests/packages/appos/src/api/event.mjs +1 -0
  143. package/dist/exports/tests/packages/appos/src/api/i18n.d.mts +34 -0
  144. package/dist/exports/tests/packages/appos/src/api/index.d.mts +27 -0
  145. package/dist/exports/tests/packages/appos/src/api/logger.d.mts +21 -0
  146. package/dist/exports/tests/packages/appos/src/api/mailer.d.mts +70 -0
  147. package/dist/exports/tests/packages/appos/src/api/middleware/error-handler.mjs +1 -0
  148. package/dist/exports/tests/packages/appos/src/api/middleware/health.mjs +1 -0
  149. package/dist/exports/tests/packages/appos/src/api/middleware/i18n.mjs +1 -0
  150. package/dist/exports/tests/packages/appos/src/api/middleware/request-logger.d.mts +24 -0
  151. package/dist/exports/tests/packages/appos/src/api/middleware/request-logger.mjs +1 -0
  152. package/dist/exports/tests/packages/appos/src/api/middleware/shutdown.mjs +1 -0
  153. package/dist/exports/tests/packages/appos/src/api/middleware/timeout.mjs +1 -0
  154. package/dist/exports/tests/packages/appos/src/api/middleware/youch-handler.mjs +1 -0
  155. package/dist/exports/tests/packages/appos/src/api/middleware.d.mts +39 -0
  156. package/dist/exports/tests/packages/appos/src/api/middleware.mjs +1 -0
  157. package/dist/exports/tests/packages/appos/src/api/openapi.d.mts +271 -0
  158. package/dist/exports/tests/packages/appos/src/api/orm.d.mts +13 -0
  159. package/dist/exports/tests/packages/appos/src/api/otel.d.mts +40 -0
  160. package/dist/exports/tests/packages/appos/src/api/redis.d.mts +34 -0
  161. package/dist/exports/tests/packages/appos/src/api/redis.mjs +1 -0
  162. package/dist/exports/tests/packages/appos/src/api/server.mjs +1 -0
  163. package/dist/exports/tests/packages/appos/src/api/storage-schema.d.mts +707 -0
  164. package/dist/exports/tests/packages/appos/src/api/storage.d.mts +506 -0
  165. package/dist/exports/tests/packages/appos/src/api/workflow.d.mts +250 -0
  166. package/dist/exports/tests/packages/appos/src/api/workflow.mjs +1 -0
  167. package/dist/exports/tests/packages/appos/src/api/workflows/extract-blob-metadata.mjs +1 -0
  168. package/dist/exports/tests/packages/appos/src/api/workflows/generate-image-variant.d.mts +99 -0
  169. package/dist/exports/tests/packages/appos/src/api/workflows/generate-image-variant.mjs +1 -0
  170. package/dist/exports/tests/packages/appos/src/api/workflows/generate-preview.mjs +1 -0
  171. package/dist/exports/tests/packages/appos/src/api/workflows/purge-attachment.mjs +1 -0
  172. package/dist/exports/tests/packages/appos/src/api/workflows/purge-audit-logs.mjs +1 -0
  173. package/dist/exports/tests/packages/appos/src/api/workflows/purge-unattached-blobs.mjs +1 -0
  174. package/dist/exports/tests/packages/appos/src/api/workflows/track-db-changes.mjs +1 -0
  175. package/dist/exports/tests/packages/appos/src/constants.mjs +1 -0
  176. package/dist/exports/tests/packages/appos/src/instrumentation.d.mts +7 -0
  177. package/dist/exports/tests/packages/appos/src/instrumentation.mjs +1 -0
  178. package/dist/exports/tests/react.d.mts +2 -0
  179. package/dist/exports/tests/react.mjs +1 -0
  180. package/dist/exports/tests/setup.d.mts +1 -0
  181. package/dist/exports/tests/setup.mjs +1 -0
  182. package/dist/exports/vendors/date.js +1 -0
  183. package/dist/exports/vendors/toolkit.js +1 -0
  184. package/dist/exports/vendors/zod.d.ts +1 -0
  185. package/dist/exports/vendors/zod.js +1 -0
  186. package/dist/exports/vite/index.d.mts +19 -0
  187. package/dist/exports/vite/index.mjs +1 -0
  188. package/dist/exports/vitest/config.d.mts +1 -0
  189. package/dist/exports/vitest/config.mjs +1 -0
  190. package/dist/exports/vitest/globals.d.mts +1 -0
  191. package/dist/exports/vitest/globals.mjs +1 -0
  192. package/dist/exports/vitest/index.d.mts +1 -0
  193. package/dist/exports/vitest/index.mjs +1 -0
  194. package/dist/exports/web/api/auth.d.ts +125 -0
  195. package/dist/exports/web/api/database.d.ts +4 -0
  196. package/dist/exports/web/api/logger.d.ts +1 -0
  197. package/dist/exports/web/auth.d.ts +2388 -0
  198. package/dist/exports/web/auth.js +1 -0
  199. package/dist/exports/web/i18n.d.ts +42 -0
  200. package/dist/exports/web/i18n.js +1 -0
  201. package/dist/exports/web/index.d.ts +6 -0
  202. package/dist/exports/web/index.js +1 -0
  203. package/package.json +138 -98
  204. package/build/bin/main.mjs +0 -2
  205. package/build/exports/cli/index.d.mts +0 -325
  206. package/build/exports/cli/index.mjs +0 -1
  207. package/build/exports/instrumentation/execAsync-DaIUcs6_.mjs +0 -1
  208. package/build/exports/instrumentation/getMachineId-bsd-bB6ipDhm.mjs +0 -1
  209. package/build/exports/instrumentation/getMachineId-darwin-D1Bx5aCe.mjs +0 -2
  210. package/build/exports/instrumentation/getMachineId-linux-D_R9Tla0.mjs +0 -1
  211. package/build/exports/instrumentation/getMachineId-unsupported-BZKPE_Ev.mjs +0 -1
  212. package/build/exports/instrumentation/getMachineId-win-CmPvIqHL.mjs +0 -1
  213. package/build/exports/instrumentation/instrumentation.d.mts +0 -1
  214. package/build/exports/instrumentation/instrumentation.mjs +0 -80
  215. package/build/exports/server/index.d.mts +0 -327
  216. package/build/exports/server/index.mjs +0 -219
  217. package/build/exports/server/react-gPO8Jsy-.mjs +0 -13
  218. package/build/exports/server/server.node-D_9RYjm9.mjs +0 -210
  219. package/build/exports/store/index.d.mts +0 -58
  220. package/build/exports/store/index.mjs +0 -15
  221. package/build/exports/support/datetime.js +0 -1
  222. package/build/exports/support/utils.js +0 -1
  223. package/build/exports/support/zod.d.ts +0 -2
  224. package/build/exports/support/zod.js +0 -23
  225. package/build/exports/test/dist-DAsoCGWk.mjs +0 -348
  226. package/build/exports/test/index.d.mts +0 -3
  227. package/build/exports/test/index.mjs +0 -1
  228. package/build/exports/test/magic-string.es-BWgiB2kd.mjs +0 -14
  229. package/build/exports/test/setup.d.mts +0 -1
  230. package/build/exports/test/setup.mjs +0 -329
  231. /package/{build/exports/support/datetime.d.ts → dist/exports/vendors/date.d.ts} +0 -0
  232. /package/{build/exports/support/utils.d.ts → dist/exports/vendors/toolkit.d.ts} +0 -0
@@ -0,0 +1,170 @@
1
+ import { Container } from "./api/container.mjs";
2
+ import * as p from "@clack/prompts";
3
+
4
+ //#region src/cli/context.d.ts
5
+
6
+ /**
7
+ * Command context providing beautiful output, prompts, and utilities.
8
+ * Uses @clack/prompts for consistent, professional CLI formatting.
9
+ *
10
+ * @template C - Container type (defaults to base Container)
11
+ * @template A - Arguments type inferred from command's Zod args schema
12
+ * @template O - Options type inferred from command's Zod opts schema
13
+ */
14
+ interface CommandContext<C extends Container = Container, A = readonly unknown[], O = Record<string, unknown>> {
15
+ /**
16
+ * The parsed command-line arguments.
17
+ * Type is inferred from the command's Zod args schema.
18
+ */
19
+ readonly args: A;
20
+ /**
21
+ * Prompts the user for single-line text input.
22
+ * @see https://www.clack.cc for prompt options
23
+ */
24
+ ask: typeof p.text;
25
+ /**
26
+ * Displays a cancellation message and exits the process with code 0.
27
+ * @param message - Optional cancellation message (defaults to "Cancelled")
28
+ */
29
+ cancel(message?: string): never;
30
+ /**
31
+ * Prompts the user for dropdown selection from a list of options.
32
+ * @see https://www.clack.cc for prompt options
33
+ */
34
+ choice: typeof p.select;
35
+ /**
36
+ * Releases all container resources including database connections and cache clients.
37
+ * Must be called before the command exits to prevent resource leaks.
38
+ */
39
+ cleanup(): Promise<void>;
40
+ /**
41
+ * Displays a dimmed comment line for secondary information.
42
+ * @param message - The comment text to display
43
+ */
44
+ comment(message: string): void;
45
+ /**
46
+ * Prompts the user for yes/no confirmation.
47
+ * @see https://www.clack.cc for prompt options
48
+ */
49
+ confirm: typeof p.confirm;
50
+ /**
51
+ * The dependency injection container providing access to services.
52
+ * Includes database connections, cache clients, logger, mailer, and configuration.
53
+ */
54
+ readonly container: C;
55
+ /**
56
+ * Displays an error message with the error symbol.
57
+ * @param message - The error message to display
58
+ */
59
+ error(message: string): void;
60
+ /**
61
+ * Executes a shell command asynchronously.
62
+ * @param command - The command to execute
63
+ * @param args - Array of command arguments
64
+ * @throws Error if the command exits with a non-zero code
65
+ */
66
+ exec(command: string, args: string[]): Promise<void>;
67
+ /**
68
+ * Displays an error message and terminates the process with exit code 1.
69
+ * @param message - The error message to display before exiting
70
+ */
71
+ fail(message: string): never;
72
+ /**
73
+ * Groups multiple prompts together for sequential execution.
74
+ * @see https://www.clack.cc for group options
75
+ */
76
+ group: typeof p.group;
77
+ /**
78
+ * Displays an informational message with the info symbol.
79
+ * @param message - The info message to display
80
+ */
81
+ info(message: string): void;
82
+ /**
83
+ * Displays the command intro header.
84
+ * @param title - The command name or title to display
85
+ */
86
+ intro(title: string): void;
87
+ /**
88
+ * Checks if a prompt result indicates user cancellation (Ctrl+C).
89
+ * @param value - The prompt result to check
90
+ * @returns True if the user cancelled the prompt
91
+ */
92
+ isCancel: typeof p.isCancel;
93
+ /**
94
+ * Displays a plain text line.
95
+ * @param message - The text to display
96
+ */
97
+ line(message: string): void;
98
+ /**
99
+ * Prompts the user to select multiple options from a list.
100
+ * @see https://www.clack.cc for multiselect options
101
+ */
102
+ multiselect: typeof p.multiselect;
103
+ /**
104
+ * Displays a formatted note box with optional title.
105
+ * @param message - The note content
106
+ * @param title - Optional title for the note
107
+ */
108
+ note(message: string, title?: string): void;
109
+ /**
110
+ * The parsed command-line options.
111
+ * Type is inferred from the command's Zod opts schema.
112
+ */
113
+ readonly opts: O;
114
+ /**
115
+ * Displays the command outro footer.
116
+ * @param message - Optional completion message (defaults to "Done")
117
+ */
118
+ outro(message?: string): void;
119
+ /**
120
+ * Prompts the user for password input with hidden characters.
121
+ * @see https://www.clack.cc for prompt options
122
+ */
123
+ secret: typeof p.password;
124
+ /**
125
+ * Executes an async function while displaying an animated spinner.
126
+ * Use for long-running operations like starting containers.
127
+ * @template T - Return type of the task function
128
+ * @param message - Message to display while spinning
129
+ * @param fn - Async function to execute
130
+ * @returns The result of the task function
131
+ */
132
+ spinner<T>(message: string, fn: () => Promise<T>): Promise<T>;
133
+ /**
134
+ * Displays a step message indicating progress.
135
+ * @param message - The step description
136
+ */
137
+ step(message: string): void;
138
+ /**
139
+ * Displays a success message with the success symbol.
140
+ * @param message - The success message to display
141
+ */
142
+ success(message: string): void;
143
+ /**
144
+ * Displays data in a formatted note box as a table.
145
+ * @param headers - Array of column header strings
146
+ * @param rows - 2D array of cell values
147
+ */
148
+ table(headers: string[], rows: string[][]): void;
149
+ /**
150
+ * Executes an async function and displays the result with timing.
151
+ * @template T - Return type of the task function
152
+ * @param name - Display name for the task
153
+ * @param fn - Async function to execute
154
+ * @returns The result of the task function
155
+ */
156
+ task<T>(name: string, fn: () => Promise<T>): Promise<T>;
157
+ /**
158
+ * Displays a task status line without executing any function.
159
+ * @param name - Display name for the task
160
+ * @param status - Status text to display
161
+ */
162
+ taskStatus(name: string, status: string): void;
163
+ /**
164
+ * Displays a warning message with the warning symbol.
165
+ * @param message - The warning message to display
166
+ */
167
+ warn(message: string): void;
168
+ }
169
+ //#endregion
170
+ export { CommandContext };
@@ -0,0 +1,3 @@
1
+ import { CommandContext } from "./context.mjs";
2
+ import { Command, defineCommand } from "./command.mjs";
3
+ export { type Command, type CommandContext, defineCommand };
@@ -0,0 +1 @@
1
+ import{defineCommand as e}from"./command.mjs";export{e as defineCommand};
@@ -0,0 +1,3 @@
1
+ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
2
+ import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
3
+ export { ReactQueryDevtools, TanStackRouterDevtools };
@@ -0,0 +1 @@
1
+ import{ReactQueryDevtools as e}from"@tanstack/react-query-devtools";import{TanStackRouterDevtools as t}from"@tanstack/react-router-devtools";export{e as ReactQueryDevtools,t as TanStackRouterDevtools};
@@ -0,0 +1 @@
1
+ export * from "@opentelemetry/api";
@@ -0,0 +1 @@
1
+ import{register as e}from"node:module";import{getNodeAutoInstrumentations as t}from"@opentelemetry/auto-instrumentations-node";import{OTLPTraceExporter as n}from"@opentelemetry/exporter-trace-otlp-http";import{PinoInstrumentation as r}from"@opentelemetry/instrumentation-pino";import{resourceFromAttributes as i}from"@opentelemetry/resources";import{NodeSDK as a}from"@opentelemetry/sdk-node";import{BatchSpanProcessor as o}from"@opentelemetry/sdk-trace-node";import{ATTR_SERVICE_NAME as s,ATTR_SERVICE_VERSION as c}from"@opentelemetry/semantic-conventions";export*from"@opentelemetry/api";e(`@opentelemetry/instrumentation/hook.mjs`,import.meta.url);const l={name:process.env.APP_NAME||`appos`,version:process.env.APP_VERSION||`development`};new a({resource:i({[s]:l.name,[c]:l.version}),spanProcessors:[new o(new n({url:process.env.OTEL_EXPORTER_OTLP_ENDPOINT||`http://localhost:4318/v1/traces`,headers:process.env.OTEL_EXPORTER_OTLP_HEADERS?JSON.parse(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}))],instrumentations:[t({"@opentelemetry/instrumentation-fs":{enabled:!1},"@opentelemetry/instrumentation-dns":{enabled:!1}}),new r({logHook:(e,t)=>{t[`service.name`]=l.name}})]}).start();export{};
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n&&e(r,Symbol.toStringTag,{value:`Module`}),r},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},o=(e,t,n)=>(a(e,t,`default`),n&&a(n,t,`default`));export{i as __export,o as __reExport};
@@ -0,0 +1,86 @@
1
+ import { DefineTestDatabaseOptions, defineTestDatabase } from "./packages/appos/src/api/database.mjs";
2
+ import { AppContainer } from "./packages/appos/src/api/container.mjs";
3
+ import { index_d_exports } from "./packages/appos/src/api/index.mjs";
4
+ import supertestOriginal from "supertest";
5
+ import { TestAPI } from "vitest";
6
+ import { Express } from "ultimate-express";
7
+ import * as supertest_lib_agent0 from "supertest/lib/agent";
8
+
9
+ //#region src/tests/api.d.ts
10
+ type AppOSApi = typeof index_d_exports;
11
+ /**
12
+ * Type-safe options for overriding default API mocks.
13
+ * Each override must match the exact signature of the original function.
14
+ */
15
+ interface DefineApiMocksOptions {
16
+ defineDatabase?: AppOSApi["defineDatabase"];
17
+ defineStorage?: AppOSApi["defineStorage"];
18
+ defineCache?: AppOSApi["defineCache"];
19
+ defineLogger?: AppOSApi["defineLogger"];
20
+ defineMailer?: AppOSApi["defineMailer"];
21
+ defineEventBus?: AppOSApi["defineEventBus"];
22
+ defineAuth?: AppOSApi["defineAuth"];
23
+ defineI18n?: AppOSApi["defineI18n"];
24
+ }
25
+ /**
26
+ * Factory for vi.mock("appos/api").
27
+ * Intercepts define* calls and replaces them with test versions.
28
+ *
29
+ * @param overrides - Optional type-safe overrides for specific define* functions
30
+ * @returns Mock factory function for vi.mock
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Default usage
35
+ * vi.mock("appos/api", defineApiMocks());
36
+ *
37
+ * // With custom logger (must match original signature)
38
+ * vi.mock("appos/api", defineApiMocks({
39
+ * defineLogger: async (opts) => customLogger,
40
+ * }));
41
+ * ```
42
+ */
43
+ declare function defineApiMocks(overrides?: DefineApiMocksOptions): (importOriginal: () => Promise<Record<string, unknown>>) => Promise<Record<string, unknown>>;
44
+ /**
45
+ * Creates a supertest instance for testing ultimate-express apps.
46
+ *
47
+ * @param app The ultimate-express application instance.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * import { request } from "appos/tests/api";
52
+ * import express from "ultimate-express";
53
+ *
54
+ * const app = express();
55
+ * app.get("/", (req, res) => res.json({ ok: true }));
56
+ *
57
+ * const response = await request(app).get("/");
58
+ * expect(response.body).toEqual({ ok: true });
59
+ * ```
60
+ */
61
+ declare function request(app: Express): supertest_lib_agent0<supertestOriginal.SuperTestStatic.Test>;
62
+ /**
63
+ * Creates a serverTest fixture from a defineContainer function.
64
+ * Container type is inferred from defineContainer's return type.
65
+ *
66
+ * @param defineContainer - The app's container factory function
67
+ * @param containerOverrides - Optional type-safe overrides for container fields
68
+ * @returns Vitest test with app and container fixtures
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * // Basic usage
73
+ * export const serverTest = defineServerTest(defineContainer);
74
+ *
75
+ * // With container overrides (type-safe)
76
+ * export const serverTestCustom = defineServerTest(defineContainer, {
77
+ * config: { APP_NAME: "custom-test" },
78
+ * });
79
+ * ```
80
+ */
81
+ declare function defineServerTest<TContainer extends AppContainer>(defineContainer: () => Promise<TContainer>, containerOverrides?: Partial<TContainer>): TestAPI<{
82
+ app: Express;
83
+ container: TContainer;
84
+ }>;
85
+ //#endregion
86
+ export { DefineApiMocksOptions, type DefineTestDatabaseOptions, defineApiMocks, defineServerTest, defineTestDatabase, request };
@@ -0,0 +1 @@
1
+ import{defineTestDatabase as e}from"./packages/appos/src/api/database.mjs";import{defineServer as t}from"./packages/appos/src/api/server.mjs";import{mock_exports as n}from"./mock.mjs";import{mkdirSync as r,mkdtempSync as i}from"node:fs";import{rm as a}from"node:fs/promises";import{tmpdir as o}from"node:os";import{join as s}from"node:path";import c from"supertest";import{test as l}from"vitest";let u=[],d=(0,n.mock)();function f(){u=[],d=(0,n.mock)()}function p(t){return async c=>{let l=await c(),f=async t=>{let n=new URL(t.poolConfig.connectionString||`postgres://postgres:postgres@localhost:5432/test`),r=await e({connectionString:n.toString(),logger:d,name:n.pathname.slice(1)||`test`,schema:t.schema??{},relations:t.relations??{}});return u.push(r.cleanUp),r.db},p=e=>{let t=i(s(o(),`test-storage-`)),n={};for(let i of Object.keys(e.disks||{})){let e=s(t,i);r(e,{recursive:!0}),n[i]={location:e}}return u.push(()=>a(t,{recursive:!0,force:!0})),l.defineStorage({database:e.database,default:e.default,disks:n})};return{...l,defineDatabase:t?.defineDatabase??f,defineStorage:t?.defineStorage??p,defineCache:t?.defineCache??(()=>(0,n.mock)()),defineLogger:t?.defineLogger??(async()=>d),defineMailer:t?.defineMailer??(async()=>(0,n.mock)()),defineEventBus:t?.defineEventBus??(()=>(0,n.mockDeep)()),defineAuth:t?.defineAuth??(()=>(0,n.mockDeep)()),defineI18n:t?.defineI18n??(async()=>(0,n.mock)())}}}function m(e){let t=e.address?.bind(e);return e.address=()=>{let e=t?.();return e&&e.port===void 0?null:e},e.close||=t=>{e.uwsApp&&e.uwsApp.close(),t?.()},e}function h(e){return c(m(e))}function g(e,t){let n={...e};for(let r of Object.keys(t)){let i=t[r],a=e[r];i!==void 0&&typeof i==`object`&&i&&!Array.isArray(i)&&typeof a==`object`&&a&&!Array.isArray(a)?n[r]=g(a,i):i!==void 0&&(n[r]=i)}return n}function _(e,n){return l.extend({container:async({},t)=>{f();let r=await e();await t(n?g(r,n):r);for(let e of u.reverse())await e()},app:async({container:e},n)=>{await n((await t({container:e})).app)}})}export{p as defineApiMocks,_ as defineServerTest,e as defineTestDatabase,h as request};
@@ -0,0 +1 @@
1
+ export * from "vitest-mock-extended";
@@ -0,0 +1 @@
1
+ import{__reExport as e}from"./_virtual/rolldown_runtime.mjs";export*from"vitest-mock-extended";var t={};import*as n from"vitest-mock-extended";e(t,n);export{t as mock_exports};
@@ -0,0 +1 @@
1
+ const e=/([\p{Ll}\d])(\p{Lu})/gu,t=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,n=/(\d)\p{Ll}|(\p{L})\d/u,r=/[^\p{L}\d]+/giu,i=`$1\0$2`;function a(n){let a=n.trim();a=a.replace(e,i).replace(t,i),a=a.replace(r,`\0`);let o=0,s=a.length;for(;a.charAt(o)===`\0`;)o++;if(o===s)return[];for(;a.charAt(s-1)===`\0`;)s--;return a.slice(o,s).split(/\0/g)}function o(e){let t=a(e);for(let e=0;e<t.length;e++){let r=t[e],i=n.exec(r);if(i){let n=i.index+(i[1]??i[2]).length;t.splice(e,1,r.slice(0,n),r.slice(n))}}return t}function s(e,t){let[n,r,i]=f(e,t),a=c(t?.locale),o=l(t?.locale),s=t?.mergeAmbiguousCharacters?u(a,o):d(a,o);return n+r.map((e,t)=>t===0?a(e):s(e,t)).join(t?.delimiter??``)+i}function c(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function l(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function u(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function d(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function f(e,t={}){let n=t.split??(t.separateNumbers?o:a),r=t.prefixCharacters??``,i=t.suffixCharacters??``,s=0,c=e.length;for(;s<e.length;){let t=e.charAt(s);if(!r.includes(t))break;s++}for(;c>s;){let t=c-1,n=e.charAt(t);if(!i.includes(n))break;c=t}return[e.slice(0,s),n(e.slice(s,c)),e.slice(c)]}export{s as camelCase};
@@ -0,0 +1,25 @@
1
+ const e={increment:`
2
+ local windowMs = tonumber(ARGV[2])
3
+ local resetOnChange = ARGV[1] == "1"
4
+
5
+ local timeToExpire = redis.call("PTTL", KEYS[1])
6
+
7
+ if timeToExpire <= 0 then
8
+ redis.call("SET", KEYS[1], 1, "PX", windowMs)
9
+ return { 1, windowMs }
10
+ end
11
+
12
+ local totalHits = redis.call("INCR", KEYS[1])
13
+
14
+ if resetOnChange then
15
+ redis.call("PEXPIRE", KEYS[1], windowMs)
16
+ timeToExpire = windowMs
17
+ end
18
+
19
+ return { totalHits, timeToExpire }
20
+ `.replaceAll(/^\s+/gm,``).trim(),get:`
21
+ local totalHits = redis.call("GET", KEYS[1])
22
+ local timeToExpire = redis.call("PTTL", KEYS[1])
23
+
24
+ return { totalHits, timeToExpire }
25
+ `.replaceAll(/^\s+/gm,``).trim()},t=e=>typeof e==`number`?e:Number.parseInt((e??``).toString(),10),n=e=>{if(!Array.isArray(e))throw TypeError(`Expected result to be array of values`);if(e.length!==2)throw Error(`Expected 2 replies, got ${e.length}`);let n=e[0]===!1?0:t(e[0]),r=t(e[1]);return{totalHits:n,resetTime:new Date(Date.now()+r)}};var r=class{sendCommand;prefix;resetExpiryOnChange;incrementScriptSha;getScriptSha;windowMs;constructor(e){if(typeof e!=`object`)throw TypeError(`rate-limit-redis: Error: options object is required`);if(`sendCommand`in e&&!(`sendCommandCluster`in e)){let t=e.sendCommand.bind(this);this.sendCommand=async({command:e})=>t(...e)}else if(!(`sendCommand`in e)&&`sendCommandCluster`in e)this.sendCommand=e.sendCommandCluster.bind(this);else throw Error(`rate-limit-redis: Error: options must include either sendCommand or sendCommandCluster (but not both)`);this.prefix=e.prefix??`rl:`,this.resetExpiryOnChange=e.resetExpiryOnChange??!1,this.incrementScriptSha=this.loadIncrementScript(),this.getScriptSha=this.loadGetScript()}async loadIncrementScript(t){let n=await this.sendCommand({key:t,isReadOnly:!1,command:[`SCRIPT`,`LOAD`,e.increment]});if(typeof n!=`string`)throw TypeError(`unexpected reply from redis client`);return n}async loadGetScript(t){let n=await this.sendCommand({key:t,isReadOnly:!1,command:[`SCRIPT`,`LOAD`,e.get]});if(typeof n!=`string`)throw TypeError(`unexpected reply from redis client`);return n}async retryableIncrement(e){let t=this.prefixKey(e),n=async()=>this.sendCommand({key:t,isReadOnly:!1,command:[`EVALSHA`,await this.incrementScriptSha,`1`,t,this.resetExpiryOnChange?`1`:`0`,this.windowMs.toString()]});try{return await n()}catch{return this.incrementScriptSha=this.loadIncrementScript(t),n()}}prefixKey(e){return`${this.prefix}${e}`}init(e){this.windowMs=e.windowMs}async get(e){let t=this.prefixKey(e),r,i=async()=>this.sendCommand({key:t,isReadOnly:!0,command:[`EVALSHA`,await this.getScriptSha,`1`,t]});try{r=await i()}catch{this.getScriptSha=this.loadGetScript(t),r=await i()}return n(r)}async increment(e){return n(await this.retryableIncrement(e))}async decrement(e){let t=this.prefixKey(e);await this.sendCommand({key:t,isReadOnly:!1,command:[`DECR`,t]})}async resetKey(e){let t=this.prefixKey(e);await this.sendCommand({key:t,isReadOnly:!1,command:[`DEL`,t]})}};export{r as RedisStore};
@@ -0,0 +1,115 @@
1
+ import { AppContainer } from "./container.mjs";
2
+ import { RequestMetadata } from "./middleware/request-logger.mjs";
3
+ import { Request } from "ultimate-express";
4
+ import { TFunction } from "i18next";
5
+ import { Auth } from "better-auth";
6
+ import { ApiKey } from "better-auth/plugins";
7
+
8
+ //#region src/api/app-context.d.ts
9
+ declare global {
10
+ namespace Express {
11
+ interface Locals {
12
+ /**
13
+ * The application container with services and dependencies.
14
+ */
15
+ container: AppContainer;
16
+ }
17
+ interface Request {
18
+ /**
19
+ * The API key, or null if not authenticated via API key.
20
+ */
21
+ apiKey: ApiKey | null;
22
+ /**
23
+ * The text direction for the detected language (e.g., "ltr" or "rtl").
24
+ */
25
+ dir: string;
26
+ /**
27
+ * The idempotency key provided in the request headers.
28
+ */
29
+ idempotencyKey?: string;
30
+ /**
31
+ * The detected language from the request's Accept-Language header.
32
+ */
33
+ language: string;
34
+ /**
35
+ * The list of supported languages.
36
+ */
37
+ languages: readonly string[];
38
+ /**
39
+ * Metadata about the request for logging purposes.
40
+ */
41
+ metadata: RequestMetadata;
42
+ /**
43
+ * Request body in raw bytes
44
+ */
45
+ rawBody?: Buffer;
46
+ /**
47
+ * The unique request ID for tracing purposes.
48
+ */
49
+ requestId: string;
50
+ /**
51
+ * The translation function for the detected language.
52
+ */
53
+ t: TFunction;
54
+ }
55
+ }
56
+ }
57
+ /**
58
+ * Session data from Better Auth's getSession().
59
+ */
60
+ type SessionData = NonNullable<Awaited<ReturnType<Auth["api"]["getSession"]>>>;
61
+ /**
62
+ * Unified context for tRPC, OpenAPI handlers, and services.
63
+ */
64
+ interface AppContext {
65
+ /**
66
+ * The API key data, or null if not authenticated via API key.
67
+ */
68
+ apiKey: ApiKey | null;
69
+ /**
70
+ * Application container with services and dependencies.
71
+ */
72
+ container: AppContainer;
73
+ /**
74
+ * The incoming request object.
75
+ */
76
+ request: Request;
77
+ /**
78
+ * The current session, or null if not authenticated.
79
+ */
80
+ session: SessionData["session"] | null;
81
+ /**
82
+ * The current user, or null if not authenticated.
83
+ */
84
+ user: SessionData["user"] | null;
85
+ }
86
+ /**
87
+ * Options for creating an AppContext.
88
+ */
89
+ interface DefineAppContextOpts {
90
+ /**
91
+ * The API key data, or null if not authenticated via API key.
92
+ */
93
+ apiKey: ApiKey | null;
94
+ /**
95
+ * Application container with services and dependencies.
96
+ */
97
+ container: AppContainer;
98
+ /**
99
+ * Set to true to fetch session (tRPC). False for API key auth (OpenAPI).
100
+ */
101
+ fetchSession?: boolean;
102
+ /**
103
+ * The incoming request object.
104
+ */
105
+ request: Request;
106
+ }
107
+ /**
108
+ * Creates a unified AppContext for tRPC and OpenAPI handlers.
109
+ *
110
+ * For tRPC (session auth): Pass fetchSession=true to fetch session from Better Auth.
111
+ * For OpenAPI (API key auth): Pass fetchSession=false (default), session will be null.
112
+ */
113
+ declare function defineAppContext(opts: DefineAppContextOpts): Promise<AppContext>;
114
+ //#endregion
115
+ export { AppContext, DefineAppContextOpts, SessionData, defineAppContext };