@gravito/echo 3.1.1 → 4.0.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 (295) hide show
  1. package/README.md +24 -9
  2. package/dist/OrbitEcho.d.ts +76 -60
  3. package/dist/errors/EchoError.d.ts +29 -0
  4. package/dist/errors/codes.d.ts +20 -0
  5. package/dist/index.d.ts +34 -16
  6. package/dist/index.js +3 -1596
  7. package/dist/index.js.map +3 -28
  8. package/dist/{echo/src/middleware → middleware}/RequestBufferMiddleware.d.ts +3 -3
  9. package/dist/providers/GenericProvider.d.ts +37 -19
  10. package/dist/providers/GitHubProvider.d.ts +21 -13
  11. package/dist/providers/StripeProvider.d.ts +20 -13
  12. package/dist/providers/index.d.ts +14 -4
  13. package/dist/receive/SignatureValidator.d.ts +33 -1
  14. package/dist/receive/WebhookReceiver.d.ts +139 -22
  15. package/dist/receive/index.d.ts +0 -1
  16. package/dist/resilience/CircuitBreaker.d.ts +6 -0
  17. package/dist/{echo/src/resilience → resilience}/index.d.ts +2 -1
  18. package/dist/send/WebhookDispatcher.d.ts +159 -16
  19. package/dist/send/index.d.ts +0 -1
  20. package/dist/types.d.ts +671 -57
  21. package/package.json +9 -3
  22. package/dist/OrbitEcho.d.ts.map +0 -1
  23. package/dist/atlas/src/DB.d.ts +0 -348
  24. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  25. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  26. package/dist/atlas/src/config/index.d.ts +0 -7
  27. package/dist/atlas/src/config/loadConfig.d.ts +0 -41
  28. package/dist/atlas/src/connection/Connection.d.ts +0 -112
  29. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
  30. package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
  31. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  32. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  33. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  34. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
  35. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
  36. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  37. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  38. package/dist/atlas/src/drivers/types.d.ts +0 -260
  39. package/dist/atlas/src/errors/index.d.ts +0 -45
  40. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  41. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  42. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  43. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  44. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  45. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  46. package/dist/atlas/src/index.d.ts +0 -79
  47. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  48. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  49. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  50. package/dist/atlas/src/migration/index.d.ts +0 -6
  51. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
  52. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  53. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  54. package/dist/atlas/src/observability/index.d.ts +0 -9
  55. package/dist/atlas/src/orm/Repository.d.ts +0 -247
  56. package/dist/atlas/src/orm/index.d.ts +0 -6
  57. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  58. package/dist/atlas/src/orm/model/Model.d.ts +0 -458
  59. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  60. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
  61. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  62. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
  63. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  64. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  65. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  66. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  67. package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
  68. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  69. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  70. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  71. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  72. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
  73. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  74. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  75. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  76. package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
  77. package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
  78. package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
  79. package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
  80. package/dist/atlas/src/query/Expression.d.ts +0 -60
  81. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  82. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
  83. package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
  84. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  85. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  86. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  87. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  88. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  89. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  90. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  91. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  92. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  93. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  94. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  95. package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
  96. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  97. package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
  98. package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
  99. package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
  100. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  101. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  102. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  103. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  104. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  105. package/dist/atlas/src/schema/index.d.ts +0 -8
  106. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  107. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  108. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  109. package/dist/atlas/src/seed/index.d.ts +0 -6
  110. package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
  111. package/dist/atlas/src/types/index.d.ts +0 -1182
  112. package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
  113. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  114. package/dist/core/src/Application.d.ts +0 -215
  115. package/dist/core/src/CommandKernel.d.ts +0 -33
  116. package/dist/core/src/ConfigManager.d.ts +0 -65
  117. package/dist/core/src/Container/RequestScopeManager.d.ts +0 -62
  118. package/dist/core/src/Container/RequestScopeMetrics.d.ts +0 -144
  119. package/dist/core/src/Container.d.ts +0 -153
  120. package/dist/core/src/ErrorHandler.d.ts +0 -66
  121. package/dist/core/src/Event.d.ts +0 -5
  122. package/dist/core/src/EventManager.d.ts +0 -123
  123. package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
  124. package/dist/core/src/GravitoServer.d.ts +0 -28
  125. package/dist/core/src/HookManager.d.ts +0 -591
  126. package/dist/core/src/Listener.d.ts +0 -4
  127. package/dist/core/src/Logger.d.ts +0 -20
  128. package/dist/core/src/PlanetCore.d.ts +0 -378
  129. package/dist/core/src/RequestContext.d.ts +0 -97
  130. package/dist/core/src/Route.d.ts +0 -36
  131. package/dist/core/src/Router.d.ts +0 -284
  132. package/dist/core/src/ServiceProvider.d.ts +0 -178
  133. package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
  134. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
  135. package/dist/core/src/adapters/bun/BunContext.d.ts +0 -49
  136. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
  137. package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
  138. package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
  139. package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
  140. package/dist/core/src/adapters/bun/types.d.ts +0 -20
  141. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  142. package/dist/core/src/adapters/types.d.ts +0 -235
  143. package/dist/core/src/cli/queue-commands.d.ts +0 -6
  144. package/dist/core/src/engine/AOTRouter.d.ts +0 -129
  145. package/dist/core/src/engine/FastContext.d.ts +0 -123
  146. package/dist/core/src/engine/Gravito.d.ts +0 -136
  147. package/dist/core/src/engine/MinimalContext.d.ts +0 -100
  148. package/dist/core/src/engine/analyzer.d.ts +0 -27
  149. package/dist/core/src/engine/constants.d.ts +0 -23
  150. package/dist/core/src/engine/index.d.ts +0 -26
  151. package/dist/core/src/engine/path.d.ts +0 -26
  152. package/dist/core/src/engine/pool.d.ts +0 -83
  153. package/dist/core/src/engine/types.d.ts +0 -146
  154. package/dist/core/src/error-handling/RequestScopeErrorContext.d.ts +0 -126
  155. package/dist/core/src/events/BackpressureManager.d.ts +0 -215
  156. package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
  157. package/dist/core/src/events/DeadLetterQueue.d.ts +0 -219
  158. package/dist/core/src/events/EventBackend.d.ts +0 -12
  159. package/dist/core/src/events/EventOptions.d.ts +0 -204
  160. package/dist/core/src/events/EventPriorityQueue.d.ts +0 -301
  161. package/dist/core/src/events/FlowControlStrategy.d.ts +0 -109
  162. package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
  163. package/dist/core/src/events/MessageQueueBridge.d.ts +0 -184
  164. package/dist/core/src/events/PriorityEscalationManager.d.ts +0 -82
  165. package/dist/core/src/events/RetryScheduler.d.ts +0 -104
  166. package/dist/core/src/events/WorkerPool.d.ts +0 -98
  167. package/dist/core/src/events/WorkerPoolConfig.d.ts +0 -153
  168. package/dist/core/src/events/WorkerPoolMetrics.d.ts +0 -65
  169. package/dist/core/src/events/aggregation/AggregationWindow.d.ts +0 -77
  170. package/dist/core/src/events/aggregation/DeduplicationManager.d.ts +0 -135
  171. package/dist/core/src/events/aggregation/EventAggregationManager.d.ts +0 -108
  172. package/dist/core/src/events/aggregation/EventBatcher.d.ts +0 -99
  173. package/dist/core/src/events/aggregation/types.d.ts +0 -117
  174. package/dist/core/src/events/index.d.ts +0 -25
  175. package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
  176. package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
  177. package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
  178. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -332
  179. package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
  180. package/dist/core/src/events/observability/StreamWorkerMetrics.d.ts +0 -76
  181. package/dist/core/src/events/observability/index.d.ts +0 -24
  182. package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
  183. package/dist/core/src/events/types.d.ts +0 -134
  184. package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
  185. package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
  186. package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
  187. package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
  188. package/dist/core/src/exceptions/HttpException.d.ts +0 -9
  189. package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
  190. package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
  191. package/dist/core/src/exceptions/index.d.ts +0 -7
  192. package/dist/core/src/health/HealthProvider.d.ts +0 -67
  193. package/dist/core/src/helpers/Arr.d.ts +0 -19
  194. package/dist/core/src/helpers/Str.d.ts +0 -23
  195. package/dist/core/src/helpers/data.d.ts +0 -25
  196. package/dist/core/src/helpers/errors.d.ts +0 -34
  197. package/dist/core/src/helpers/response.d.ts +0 -41
  198. package/dist/core/src/helpers.d.ts +0 -338
  199. package/dist/core/src/http/CookieJar.d.ts +0 -51
  200. package/dist/core/src/http/cookie.d.ts +0 -29
  201. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  202. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  203. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  204. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  205. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  206. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  207. package/dist/core/src/http/types.d.ts +0 -374
  208. package/dist/core/src/index.d.ts +0 -88
  209. package/dist/core/src/instrumentation/index.d.ts +0 -35
  210. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  211. package/dist/core/src/instrumentation/types.d.ts +0 -182
  212. package/dist/core/src/observability/Metrics.d.ts +0 -244
  213. package/dist/core/src/observability/QueueDashboard.d.ts +0 -136
  214. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -350
  215. package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
  216. package/dist/core/src/reliability/index.d.ts +0 -6
  217. package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
  218. package/dist/core/src/router/RequestValidator.d.ts +0 -20
  219. package/dist/core/src/runtime.d.ts +0 -119
  220. package/dist/core/src/security/Encrypter.d.ts +0 -33
  221. package/dist/core/src/security/Hasher.d.ts +0 -29
  222. package/dist/core/src/testing/HttpTester.d.ts +0 -39
  223. package/dist/core/src/testing/TestResponse.d.ts +0 -78
  224. package/dist/core/src/testing/index.d.ts +0 -2
  225. package/dist/core/src/types/events.d.ts +0 -94
  226. package/dist/echo/src/OrbitEcho.d.ts +0 -115
  227. package/dist/echo/src/index.d.ts +0 -64
  228. package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
  229. package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
  230. package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
  231. package/dist/echo/src/providers/index.d.ts +0 -14
  232. package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
  233. package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
  234. package/dist/echo/src/receive/index.d.ts +0 -2
  235. package/dist/echo/src/resilience/CircuitBreaker.d.ts +0 -117
  236. package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
  237. package/dist/echo/src/send/index.d.ts +0 -1
  238. package/dist/echo/src/types.d.ts +0 -756
  239. package/dist/index.d.ts.map +0 -1
  240. package/dist/monitor/src/MonitorOrbit.d.ts +0 -43
  241. package/dist/monitor/src/config.d.ts +0 -106
  242. package/dist/monitor/src/health/HealthController.d.ts +0 -28
  243. package/dist/monitor/src/health/HealthRegistry.d.ts +0 -80
  244. package/dist/monitor/src/health/index.d.ts +0 -36
  245. package/dist/monitor/src/index.d.ts +0 -13
  246. package/dist/monitor/src/metrics/MetricsController.d.ts +0 -22
  247. package/dist/monitor/src/metrics/MetricsRegistry.d.ts +0 -136
  248. package/dist/monitor/src/metrics/index.d.ts +0 -11
  249. package/dist/monitor/src/tracing/TracingManager.d.ts +0 -97
  250. package/dist/monitor/src/tracing/index.d.ts +0 -10
  251. package/dist/photon/src/index.d.ts +0 -89
  252. package/dist/photon/src/middleware/binary.d.ts +0 -31
  253. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  254. package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
  255. package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
  256. package/dist/photon/src/openapi.d.ts +0 -19
  257. package/dist/providers/GenericProvider.d.ts.map +0 -1
  258. package/dist/providers/GitHubProvider.d.ts.map +0 -1
  259. package/dist/providers/StripeProvider.d.ts.map +0 -1
  260. package/dist/providers/index.d.ts.map +0 -1
  261. package/dist/receive/SignatureValidator.d.ts.map +0 -1
  262. package/dist/receive/WebhookReceiver.d.ts.map +0 -1
  263. package/dist/receive/index.d.ts.map +0 -1
  264. package/dist/send/WebhookDispatcher.d.ts.map +0 -1
  265. package/dist/send/index.d.ts.map +0 -1
  266. package/dist/types.d.ts.map +0 -1
  267. /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
  268. /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
  269. /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
  270. /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
  271. /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
  272. /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
  273. /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
  274. /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
  275. /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
  276. /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
  277. /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
  278. /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
  279. /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
  280. /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
  281. /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
  282. /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
  283. /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
  284. /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
  285. /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
  286. /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
  287. /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
  288. /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
  289. /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
  290. /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
  291. /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
  292. /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
  293. /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
  294. /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
  295. /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
@@ -1,338 +0,0 @@
1
- import type { ContentfulStatusCode } from './http/types';
2
- import type { PlanetCore } from './PlanetCore';
3
- import type { Router } from './Router';
4
- export { Arr } from './helpers/Arr';
5
- export * from './helpers/data';
6
- export * from './helpers/errors';
7
- export * from './helpers/response';
8
- export { Str } from './helpers/Str';
9
- /**
10
- * Error subclass used for dump and die functionality.
11
- * @internal
12
- */
13
- export declare class DumpDieError extends Error {
14
- readonly values: unknown[];
15
- name: string;
16
- constructor(values: unknown[]);
17
- }
18
- /**
19
- * Options for dump output
20
- * @public
21
- */
22
- export type DumpOptions = {
23
- depth?: number | null;
24
- colors?: boolean;
25
- };
26
- /**
27
- * Dump data to console for debugging.
28
- *
29
- * Uses `console.dir` with configurable depth and colors to provide a
30
- * readable representation of any value.
31
- *
32
- * @param values - One or more values to dump to the console.
33
- *
34
- * @example
35
- * ```typescript
36
- * dump(user, { meta: 'data' });
37
- * ```
38
- *
39
- * @public
40
- * @since 3.0.0
41
- */
42
- export declare function dump(...values: unknown[]): void;
43
- /**
44
- * Dump data to console and exit process (or throw in HTTP context).
45
- *
46
- * Short for "Dump and Die". In a CLI environment, it exits the process.
47
- * In an HTTP context (like a web request), it throws a `DumpDieError`
48
- * which is caught by the exception handler to display the debug output.
49
- *
50
- * @param values - One or more values to dump and then die.
51
- * @throws {DumpDieError} Always throws this error to halt execution.
52
- *
53
- * @example
54
- * ```typescript
55
- * dd(user.permissions);
56
- * ```
57
- *
58
- * @public
59
- * @since 3.0.0
60
- */
61
- export declare function dd(...values: unknown[]): never;
62
- /**
63
- * Tap into a value, execute a callback, and return the value.
64
- *
65
- * This allows you to perform "side effects" on a value without breaking
66
- * the chain of operations.
67
- *
68
- * @param value - The value to tap into.
69
- * @param callback - A callback that receives the value.
70
- * @returns The original value.
71
- *
72
- * @example
73
- * ```typescript
74
- * const user = tap(new User(), (u) => {
75
- * u.name = 'Alice';
76
- * u.save();
77
- * });
78
- * ```
79
- *
80
- * @public
81
- * @since 3.0.0
82
- */
83
- export declare function tap<T>(value: T, callback: (value: T) => unknown): T;
84
- /**
85
- * Return the default value of the given value.
86
- *
87
- * If the value is a function, it will be executed with the provided arguments
88
- * and its result will be returned. Otherwise, the value itself is returned.
89
- * This is useful for handling optional lazy-loaded values.
90
- *
91
- * @param valueOrFactory - The value or a factory function.
92
- * @param args - Arguments to pass to the factory function if it is a function.
93
- * @returns The resolved value.
94
- *
95
- * @example
96
- * ```typescript
97
- * value(10); // 10
98
- * value(() => 10); // 10
99
- * value((name) => `Hello ${name}`, 'World'); // "Hello World"
100
- * ```
101
- *
102
- * @public
103
- * @since 3.0.0
104
- */
105
- export declare function value<TArgs extends readonly unknown[], TResult>(valueOrFactory: TResult | ((...args: TArgs) => TResult), ...args: TArgs): TResult;
106
- /**
107
- * Determine if the given value is "blank".
108
- *
109
- * A value is considered blank if it is:
110
- * - `null` or `undefined`
111
- * - An empty string or a string containing only whitespace
112
- * - An empty array
113
- * - An empty object
114
- * - An empty Map or Set
115
- *
116
- * @param value - The value to check.
117
- * @returns `true` if the value is blank, `false` otherwise.
118
- *
119
- * @example
120
- * ```typescript
121
- * blank(''); // true
122
- * blank(' '); // true
123
- * blank([]); // true
124
- * blank({}); // true
125
- * blank(0); // false
126
- * ```
127
- *
128
- * @public
129
- * @since 3.0.0
130
- */
131
- export declare function blank(value: unknown): boolean;
132
- /**
133
- * Determine if the given value is "filled" (not blank).
134
- *
135
- * This is the inverse of `blank()`.
136
- *
137
- * @param value - The value to check.
138
- * @returns `true` if the value is not blank, `false` otherwise.
139
- *
140
- * @example
141
- * ```typescript
142
- * filled('hello'); // true
143
- * filled([1, 2, 3]); // true
144
- * filled(''); // false
145
- * ```
146
- *
147
- * @public
148
- * @since 3.0.0
149
- */
150
- export declare function filled(value: unknown): boolean;
151
- /**
152
- * Throw an exception if the given condition is true.
153
- *
154
- * @param condition - The condition to evaluate.
155
- * @param error - The exception to throw, a factory function, or an error message string.
156
- * @throws {Error} If the condition evaluates to true.
157
- *
158
- * @example
159
- * ```typescript
160
- * throwIf(user.isBanned, 'User is banned from the system');
161
- * throwIf(count > 100, () => new ValidationError('Too many items'));
162
- * ```
163
- *
164
- * @public
165
- * @since 3.0.0
166
- */
167
- export declare function throwIf(condition: unknown, error?: Error | string | (() => Error)): void;
168
- /**
169
- * Throw an exception unless the given condition is true.
170
- *
171
- * @param condition - The condition to evaluate.
172
- * @param error - The exception to throw, a factory function, or an error message string.
173
- * @throws {Error} If the condition evaluates to false.
174
- *
175
- * @example
176
- * ```typescript
177
- * throwUnless(user.isAdmin, 'Unauthorized access');
178
- * ```
179
- *
180
- * @public
181
- * @since 3.0.0
182
- */
183
- export declare function throwUnless(condition: unknown, error?: Error | string | (() => Error)): void;
184
- /**
185
- * Get the value of an environment variable.
186
- *
187
- * Automatically detects the runtime environment (Bun or Node.js) to retrieve
188
- * the variable.
189
- *
190
- * @param key - The environment variable name.
191
- * @param defaultValue - An optional default value to return if the variable is not defined.
192
- * @returns The environment variable value or the default value.
193
- *
194
- * @example
195
- * ```typescript
196
- * const debug = env('DEBUG', 'false');
197
- * const apiKey = env('API_KEY');
198
- * ```
199
- *
200
- * @public
201
- * @since 3.0.0
202
- */
203
- export declare function env<TDefault = string | undefined>(key: string, defaultValue?: TDefault): string | TDefault;
204
- /**
205
- * Set the global application instance.
206
- *
207
- * This is used internally during the bootstrap process to provide global
208
- * access to the application instance via the `app()` helper.
209
- *
210
- * @param core - The PlanetCore instance to set as global.
211
- * @internal
212
- */
213
- export declare function setApp(core: PlanetCore | null): void;
214
- /**
215
- * Check if the global application instance has been initialized and set.
216
- *
217
- * @returns `true` if the application instance is set, `false` otherwise.
218
- *
219
- * @public
220
- * @since 3.0.0
221
- */
222
- export declare function hasApp(): boolean;
223
- /**
224
- * Get the global application instance.
225
- *
226
- * Provides access to the core application container, configuration, and services.
227
- *
228
- * @returns The initialized PlanetCore instance.
229
- * @throws {Error} If the application has not been initialized.
230
- *
231
- * @example
232
- * ```typescript
233
- * const core = app();
234
- * console.log(core.version);
235
- * ```
236
- *
237
- * @public
238
- * @since 3.0.0
239
- */
240
- export declare function app(): PlanetCore;
241
- /**
242
- * Get a configuration value from the application.
243
- *
244
- * Supports dot notation for accessing nested configuration properties.
245
- *
246
- * @param key - The configuration key in dot notation (e.g., 'app.name').
247
- * @param defaultValue - An optional default value to return if the key is not found.
248
- * @returns The configuration value or the default value.
249
- *
250
- * @example
251
- * ```typescript
252
- * const appName = config('app.name');
253
- * const port = config('app.port', 3000);
254
- * ```
255
- *
256
- * @public
257
- * @since 3.0.0
258
- */
259
- export declare function config<T = unknown>(key: string, defaultValue?: T): T;
260
- /**
261
- * Get the global logger instance.
262
- *
263
- * Shortcut for `app().logger`.
264
- *
265
- * @returns The application's logger instance.
266
- *
267
- * @example
268
- * ```typescript
269
- * logger().info('Operation completed successfully');
270
- * ```
271
- *
272
- * @public
273
- * @since 3.0.0
274
- */
275
- export declare function logger(): import("@gravito/core").Logger;
276
- /**
277
- * Get the application's primary router instance.
278
- *
279
- * Shortcut for `app().router`.
280
- *
281
- * @returns The router instance.
282
- *
283
- * @public
284
- * @since 3.0.0
285
- */
286
- export declare function router(): Router;
287
- /**
288
- * Abort the current request with an HTTP exception.
289
- *
290
- * Throws an `HttpException` with the specified status code and optional message.
291
- *
292
- * @param status - The HTTP status code to return.
293
- * @param message - An optional custom error message.
294
- * @throws {HttpException} Always throws this exception.
295
- *
296
- * @example
297
- * ```typescript
298
- * abort(403, 'You do not have permission to access this resource');
299
- * ```
300
- *
301
- * @public
302
- * @since 3.0.0
303
- */
304
- export declare function abort(status: ContentfulStatusCode, message?: string): never;
305
- /**
306
- * Abort the request if the given condition is true.
307
- *
308
- * @param condition - The condition to evaluate.
309
- * @param status - The HTTP status code to return.
310
- * @param message - An optional custom error message.
311
- * @throws {HttpException} If the condition is true.
312
- *
313
- * @example
314
- * ```typescript
315
- * abortIf(!user.isActive, 403, 'Account is deactivated');
316
- * ```
317
- *
318
- * @public
319
- * @since 3.0.0
320
- */
321
- export declare function abortIf(condition: unknown, status: ContentfulStatusCode, message?: string): void;
322
- /**
323
- * Abort the request unless the given condition is true.
324
- *
325
- * @param condition - The condition to evaluate.
326
- * @param status - The HTTP status code to return.
327
- * @param message - An optional custom error message.
328
- * @throws {HttpException} If the condition is false.
329
- *
330
- * @example
331
- * ```typescript
332
- * abortUnless(request.hasValidToken(), 401, 'Invalid authentication token');
333
- * ```
334
- *
335
- * @public
336
- * @since 3.0.0
337
- */
338
- export declare function abortUnless(condition: unknown, status: ContentfulStatusCode, message?: string): void;
@@ -1,51 +0,0 @@
1
- import type { Encrypter } from '../security/Encrypter';
2
- import type { GravitoContext } from './types';
3
- /**
4
- * Options for setting cookies
5
- * @public
6
- */
7
- export interface CookieOptions {
8
- path?: string;
9
- domain?: string;
10
- secure?: boolean;
11
- httpOnly?: boolean;
12
- sameSite?: 'Strict' | 'Lax' | 'None';
13
- maxAge?: number;
14
- expires?: Date;
15
- encrypt?: boolean;
16
- }
17
- /**
18
- * Utility for managing cookies (request/response/encryption).
19
- * @public
20
- */
21
- export declare class CookieJar {
22
- private encrypter?;
23
- private queued;
24
- constructor(encrypter?: Encrypter | undefined);
25
- /**
26
- * Parse cookies from a Cookie header string
27
- * @param header - The Cookie header value
28
- * @returns Parsed cookies as key-value pairs
29
- */
30
- static parseCookies(header: string): Record<string, string>;
31
- /**
32
- * Queue a cookie to be sent with the response
33
- */
34
- queue(name: string, value: string, minutes?: number, options?: CookieOptions): void;
35
- /**
36
- * Make a cookie that lasts "forever" (5 years)
37
- */
38
- forever(name: string, value: string, options?: CookieOptions): void;
39
- /**
40
- * Expire a cookie
41
- */
42
- forget(name: string, options?: CookieOptions): void;
43
- /**
44
- * Serialize a cookie to a Set-Cookie header value
45
- */
46
- private serializeCookie;
47
- /**
48
- * Attach queued cookies to the context
49
- */
50
- attach(c: GravitoContext): void;
51
- }
@@ -1,29 +0,0 @@
1
- import { type CookieOptions } from './CookieJar';
2
- import type { GravitoContext } from './types';
3
- /**
4
- * Get a cookie value from the request
5
- * @param c - Context object
6
- * @param name - Cookie name
7
- * @returns Cookie value or undefined
8
- * @public
9
- */
10
- export declare function getCookie(c: GravitoContext, name: string): string | undefined;
11
- /**
12
- * Set a cookie in the response
13
- * @param c - Context object
14
- * @param name - Cookie name
15
- * @param value - Cookie value
16
- * @param options - Cookie options
17
- * @public
18
- */
19
- export declare function setCookie(c: GravitoContext, name: string, value: string, options?: CookieOptions & {
20
- maxAge?: number;
21
- }): void;
22
- /**
23
- * Delete a cookie (expire it)
24
- * @param c - Context object
25
- * @param name - Cookie name
26
- * @param options - Cookie options (path, domain, etc.)
27
- * @public
28
- */
29
- export declare function deleteCookie(c: GravitoContext, name: string, options?: CookieOptions): void;
@@ -1,16 +0,0 @@
1
- import type { GravitoMiddleware } from '../types';
2
- /**
3
- * Options for body size limiting
4
- * @public
5
- */
6
- export type BodySizeLimitOptions = {
7
- methods?: string[];
8
- requireContentLength?: boolean;
9
- };
10
- /**
11
- * Middleware to limit request body size.
12
- * @param maxBytes - Maximum allowed size in bytes
13
- * @param options - Configuration options
14
- * @public
15
- */
16
- export declare function bodySizeLimit(maxBytes: number, options?: BodySizeLimitOptions): GravitoMiddleware;
@@ -1,24 +0,0 @@
1
- import type { GravitoMiddleware } from '../types';
2
- /**
3
- * Allowed origin(s) configuration.
4
- * @public
5
- */
6
- export type CorsOrigin = string | string[] | ((origin: string | undefined) => string | false);
7
- /**
8
- * Options for CORS middleware
9
- * @public
10
- */
11
- export type CorsOptions = {
12
- origin?: CorsOrigin;
13
- methods?: string[];
14
- allowedHeaders?: string[];
15
- exposedHeaders?: string[];
16
- credentials?: boolean;
17
- maxAge?: number;
18
- optionsSuccessStatus?: number;
19
- };
20
- /**
21
- * Middleware handling Cross-Origin Resource Sharing (CORS).
22
- * @public
23
- */
24
- export declare function cors(options?: CorsOptions): GravitoMiddleware;
@@ -1,23 +0,0 @@
1
- import { type CookieOptions } from '../CookieJar';
2
- import type { GravitoContext, GravitoMiddleware } from '../types';
3
- /**
4
- * Configuration for CSRF Protection
5
- * @public
6
- */
7
- export type CsrfOptions = {
8
- cookieName?: string;
9
- headerName?: string;
10
- formFieldName?: string;
11
- cookie?: CookieOptions;
12
- safeMethods?: string[];
13
- };
14
- /**
15
- * Generate (or retrieve existing) CSRF token for the session.
16
- * @public
17
- */
18
- export declare function getCsrfToken(c: GravitoContext, options?: CsrfOptions): string;
19
- /**
20
- * Middleware that validates CSRF tokens on unsafe requests.
21
- * @public
22
- */
23
- export declare function csrfProtection(options?: CsrfOptions): GravitoMiddleware;
@@ -1,28 +0,0 @@
1
- import type { GravitoContext, GravitoMiddleware } from '../types';
2
- /**
3
- * Options for header token gate
4
- * @public
5
- */
6
- export type HeaderTokenGateOptions = {
7
- headerName?: string;
8
- token?: string | ((c: GravitoContext) => string | undefined);
9
- };
10
- /**
11
- * Options for requireHeaderToken middleware
12
- * @public
13
- */
14
- export type RequireHeaderTokenOptions = HeaderTokenGateOptions & {
15
- status?: number;
16
- message?: string;
17
- };
18
- /**
19
- * Create a simple gate function to check a header token.
20
- * @public
21
- */
22
- export declare function createHeaderGate(options?: HeaderTokenGateOptions): (c: GravitoContext) => Promise<boolean>;
23
- /**
24
- * Middleware that enforces a specific token in request headers.
25
- * Useful for internal API authentication.
26
- * @public
27
- */
28
- export declare function requireHeaderToken(options?: RequireHeaderTokenOptions): GravitoMiddleware;
@@ -1,29 +0,0 @@
1
- import type { GravitoContext, GravitoMiddleware } from '../types';
2
- /**
3
- * HSTS Configuration
4
- * @public
5
- */
6
- export type HstsOptions = {
7
- maxAge: number;
8
- includeSubDomains?: boolean;
9
- preload?: boolean;
10
- };
11
- /**
12
- * Options for Security Headers middleware
13
- * @public
14
- */
15
- export type SecurityHeadersOptions = {
16
- contentSecurityPolicy?: string | false | ((c: GravitoContext) => string | false);
17
- frameOptions?: string | false;
18
- referrerPolicy?: string | false;
19
- noSniff?: boolean;
20
- hsts?: HstsOptions | false;
21
- permissionsPolicy?: string | false;
22
- crossOriginOpenerPolicy?: string | false;
23
- crossOriginResourcePolicy?: string | false;
24
- };
25
- /**
26
- * Apply common security headers to responses (Helmet-style).
27
- * @public
28
- */
29
- export declare function securityHeaders(options?: SecurityHeadersOptions): GravitoMiddleware;
@@ -1,18 +0,0 @@
1
- import type { GravitoMiddleware } from '../../http/types';
2
- import type { PlanetCore } from '../../PlanetCore';
3
- /**
4
- * Rate Limiting Middleware using Orbit Cache.
5
- * Requires an active CacheService implementation.
6
- * @public
7
- */
8
- export declare class ThrottleRequests {
9
- private core;
10
- private keyCache;
11
- constructor(core: PlanetCore);
12
- /**
13
- * Create the middleware
14
- * @param maxAttempts - Max requests allowed
15
- * @param decaySeconds - Time window in seconds
16
- */
17
- handle(maxAttempts?: number, decaySeconds?: number): GravitoMiddleware;
18
- }