@gravito/echo 3.1.0 → 3.1.2

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 (245) hide show
  1. package/README.md +24 -9
  2. package/dist/OrbitEcho.d.ts +76 -60
  3. package/dist/index.d.ts +31 -16
  4. package/dist/index.js +1 -1596
  5. package/dist/index.js.map +3 -28
  6. package/dist/{echo/src/middleware → middleware}/RequestBufferMiddleware.d.ts +3 -3
  7. package/dist/providers/GenericProvider.d.ts +37 -19
  8. package/dist/providers/GitHubProvider.d.ts +21 -13
  9. package/dist/providers/StripeProvider.d.ts +20 -13
  10. package/dist/providers/index.d.ts +14 -4
  11. package/dist/receive/SignatureValidator.d.ts +33 -1
  12. package/dist/receive/WebhookReceiver.d.ts +139 -22
  13. package/dist/receive/index.d.ts +0 -1
  14. package/dist/send/WebhookDispatcher.d.ts +159 -16
  15. package/dist/send/index.d.ts +0 -1
  16. package/dist/types.d.ts +669 -57
  17. package/package.json +5 -2
  18. package/dist/OrbitEcho.d.ts.map +0 -1
  19. package/dist/atlas/src/DB.d.ts +0 -301
  20. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  21. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  22. package/dist/atlas/src/config/index.d.ts +0 -7
  23. package/dist/atlas/src/config/loadConfig.d.ts +0 -48
  24. package/dist/atlas/src/connection/Connection.d.ts +0 -108
  25. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -111
  26. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  27. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  28. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  29. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -66
  30. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -83
  31. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  32. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  33. package/dist/atlas/src/drivers/types.d.ts +0 -260
  34. package/dist/atlas/src/errors/index.d.ts +0 -45
  35. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  36. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  37. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  38. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  39. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  40. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  41. package/dist/atlas/src/index.d.ts +0 -67
  42. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  43. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  44. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  45. package/dist/atlas/src/migration/index.d.ts +0 -6
  46. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -11
  47. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  48. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  49. package/dist/atlas/src/observability/index.d.ts +0 -9
  50. package/dist/atlas/src/orm/index.d.ts +0 -5
  51. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  52. package/dist/atlas/src/orm/model/Model.d.ts +0 -449
  53. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  54. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -136
  55. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  56. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -87
  57. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  58. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  59. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  60. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  61. package/dist/atlas/src/orm/model/decorators.d.ts +0 -109
  62. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  63. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  64. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  65. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  66. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -123
  67. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  68. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  69. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  70. package/dist/atlas/src/query/Expression.d.ts +0 -60
  71. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  72. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -573
  73. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  74. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  75. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  76. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  77. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  78. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  79. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  80. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  81. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  82. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  83. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  84. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  85. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  86. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  87. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  88. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  89. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  90. package/dist/atlas/src/schema/index.d.ts +0 -8
  91. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  92. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  93. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  94. package/dist/atlas/src/seed/index.d.ts +0 -6
  95. package/dist/atlas/src/types/index.d.ts +0 -1100
  96. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  97. package/dist/core/src/Application.d.ts +0 -215
  98. package/dist/core/src/CommandKernel.d.ts +0 -33
  99. package/dist/core/src/ConfigManager.d.ts +0 -26
  100. package/dist/core/src/Container.d.ts +0 -108
  101. package/dist/core/src/ErrorHandler.d.ts +0 -63
  102. package/dist/core/src/Event.d.ts +0 -5
  103. package/dist/core/src/EventManager.d.ts +0 -123
  104. package/dist/core/src/GlobalErrorHandlers.d.ts +0 -47
  105. package/dist/core/src/GravitoServer.d.ts +0 -28
  106. package/dist/core/src/HookManager.d.ts +0 -496
  107. package/dist/core/src/Listener.d.ts +0 -4
  108. package/dist/core/src/Logger.d.ts +0 -20
  109. package/dist/core/src/PlanetCore.d.ts +0 -289
  110. package/dist/core/src/Route.d.ts +0 -36
  111. package/dist/core/src/Router.d.ts +0 -284
  112. package/dist/core/src/ServiceProvider.d.ts +0 -156
  113. package/dist/core/src/adapters/GravitoEngineAdapter.d.ts +0 -27
  114. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -171
  115. package/dist/core/src/adapters/bun/BunContext.d.ts +0 -45
  116. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +0 -31
  117. package/dist/core/src/adapters/bun/BunRequest.d.ts +0 -31
  118. package/dist/core/src/adapters/bun/RadixNode.d.ts +0 -19
  119. package/dist/core/src/adapters/bun/RadixRouter.d.ts +0 -31
  120. package/dist/core/src/adapters/bun/types.d.ts +0 -20
  121. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  122. package/dist/core/src/adapters/types.d.ts +0 -235
  123. package/dist/core/src/engine/AOTRouter.d.ts +0 -124
  124. package/dist/core/src/engine/FastContext.d.ts +0 -100
  125. package/dist/core/src/engine/Gravito.d.ts +0 -137
  126. package/dist/core/src/engine/MinimalContext.d.ts +0 -79
  127. package/dist/core/src/engine/analyzer.d.ts +0 -27
  128. package/dist/core/src/engine/constants.d.ts +0 -23
  129. package/dist/core/src/engine/index.d.ts +0 -26
  130. package/dist/core/src/engine/path.d.ts +0 -26
  131. package/dist/core/src/engine/pool.d.ts +0 -83
  132. package/dist/core/src/engine/types.d.ts +0 -143
  133. package/dist/core/src/events/CircuitBreaker.d.ts +0 -229
  134. package/dist/core/src/events/DeadLetterQueue.d.ts +0 -145
  135. package/dist/core/src/events/EventBackend.d.ts +0 -11
  136. package/dist/core/src/events/EventOptions.d.ts +0 -109
  137. package/dist/core/src/events/EventPriorityQueue.d.ts +0 -202
  138. package/dist/core/src/events/IdempotencyCache.d.ts +0 -60
  139. package/dist/core/src/events/index.d.ts +0 -14
  140. package/dist/core/src/events/observability/EventMetrics.d.ts +0 -132
  141. package/dist/core/src/events/observability/EventTracer.d.ts +0 -68
  142. package/dist/core/src/events/observability/EventTracing.d.ts +0 -161
  143. package/dist/core/src/events/observability/OTelEventMetrics.d.ts +0 -240
  144. package/dist/core/src/events/observability/ObservableHookManager.d.ts +0 -108
  145. package/dist/core/src/events/observability/index.d.ts +0 -20
  146. package/dist/core/src/events/observability/metrics-types.d.ts +0 -16
  147. package/dist/core/src/events/types.d.ts +0 -75
  148. package/dist/core/src/exceptions/AuthenticationException.d.ts +0 -8
  149. package/dist/core/src/exceptions/AuthorizationException.d.ts +0 -8
  150. package/dist/core/src/exceptions/CircularDependencyException.d.ts +0 -9
  151. package/dist/core/src/exceptions/GravitoException.d.ts +0 -23
  152. package/dist/core/src/exceptions/HttpException.d.ts +0 -9
  153. package/dist/core/src/exceptions/ModelNotFoundException.d.ts +0 -10
  154. package/dist/core/src/exceptions/ValidationException.d.ts +0 -22
  155. package/dist/core/src/exceptions/index.d.ts +0 -7
  156. package/dist/core/src/helpers/Arr.d.ts +0 -19
  157. package/dist/core/src/helpers/Str.d.ts +0 -23
  158. package/dist/core/src/helpers/data.d.ts +0 -25
  159. package/dist/core/src/helpers/errors.d.ts +0 -34
  160. package/dist/core/src/helpers/response.d.ts +0 -41
  161. package/dist/core/src/helpers.d.ts +0 -338
  162. package/dist/core/src/http/CookieJar.d.ts +0 -51
  163. package/dist/core/src/http/cookie.d.ts +0 -29
  164. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  165. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  166. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  167. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  168. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  169. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  170. package/dist/core/src/http/types.d.ts +0 -355
  171. package/dist/core/src/index.d.ts +0 -76
  172. package/dist/core/src/instrumentation/index.d.ts +0 -35
  173. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  174. package/dist/core/src/instrumentation/types.d.ts +0 -182
  175. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +0 -316
  176. package/dist/core/src/reliability/RetryPolicy.d.ts +0 -217
  177. package/dist/core/src/reliability/index.d.ts +0 -6
  178. package/dist/core/src/router/ControllerDispatcher.d.ts +0 -12
  179. package/dist/core/src/router/RequestValidator.d.ts +0 -20
  180. package/dist/core/src/runtime.d.ts +0 -119
  181. package/dist/core/src/security/Encrypter.d.ts +0 -33
  182. package/dist/core/src/security/Hasher.d.ts +0 -29
  183. package/dist/core/src/testing/HttpTester.d.ts +0 -39
  184. package/dist/core/src/testing/TestResponse.d.ts +0 -78
  185. package/dist/core/src/testing/index.d.ts +0 -2
  186. package/dist/core/src/types/events.d.ts +0 -94
  187. package/dist/echo/src/OrbitEcho.d.ts +0 -115
  188. package/dist/echo/src/index.d.ts +0 -64
  189. package/dist/echo/src/providers/GenericProvider.d.ts +0 -53
  190. package/dist/echo/src/providers/GitHubProvider.d.ts +0 -35
  191. package/dist/echo/src/providers/StripeProvider.d.ts +0 -38
  192. package/dist/echo/src/providers/index.d.ts +0 -14
  193. package/dist/echo/src/receive/SignatureValidator.d.ts +0 -67
  194. package/dist/echo/src/receive/WebhookReceiver.d.ts +0 -185
  195. package/dist/echo/src/receive/index.d.ts +0 -2
  196. package/dist/echo/src/send/WebhookDispatcher.d.ts +0 -198
  197. package/dist/echo/src/send/index.d.ts +0 -1
  198. package/dist/echo/src/types.d.ts +0 -756
  199. package/dist/index.d.ts.map +0 -1
  200. package/dist/photon/src/index.d.ts +0 -84
  201. package/dist/photon/src/middleware/binary.d.ts +0 -31
  202. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  203. package/dist/photon/src/middleware/ratelimit.d.ts +0 -157
  204. package/dist/photon/src/openapi.d.ts +0 -19
  205. package/dist/providers/GenericProvider.d.ts.map +0 -1
  206. package/dist/providers/GitHubProvider.d.ts.map +0 -1
  207. package/dist/providers/StripeProvider.d.ts.map +0 -1
  208. package/dist/providers/index.d.ts.map +0 -1
  209. package/dist/receive/SignatureValidator.d.ts.map +0 -1
  210. package/dist/receive/WebhookReceiver.d.ts.map +0 -1
  211. package/dist/receive/index.d.ts.map +0 -1
  212. package/dist/send/WebhookDispatcher.d.ts.map +0 -1
  213. package/dist/send/index.d.ts.map +0 -1
  214. package/dist/types.d.ts.map +0 -1
  215. /package/dist/{echo/src/dlq → dlq}/DeadLetterQueue.d.ts +0 -0
  216. /package/dist/{echo/src/dlq → dlq}/MemoryDeadLetterQueue.d.ts +0 -0
  217. /package/dist/{echo/src/dlq → dlq}/index.d.ts +0 -0
  218. /package/dist/{echo/src/middleware → middleware}/index.d.ts +0 -0
  219. /package/dist/{echo/src/observability → observability}/index.d.ts +0 -0
  220. /package/dist/{echo/src/observability → observability}/logging/ConsoleEchoLogger.d.ts +0 -0
  221. /package/dist/{echo/src/observability → observability}/logging/EchoLogger.d.ts +0 -0
  222. /package/dist/{echo/src/observability → observability}/logging/index.d.ts +0 -0
  223. /package/dist/{echo/src/observability → observability}/metrics/MetricsProvider.d.ts +0 -0
  224. /package/dist/{echo/src/observability → observability}/metrics/NoopMetricsProvider.d.ts +0 -0
  225. /package/dist/{echo/src/observability → observability}/metrics/PrometheusMetricsProvider.d.ts +0 -0
  226. /package/dist/{echo/src/observability → observability}/metrics/index.d.ts +0 -0
  227. /package/dist/{echo/src/observability → observability}/tracing/NoopTracer.d.ts +0 -0
  228. /package/dist/{echo/src/observability → observability}/tracing/Tracer.d.ts +0 -0
  229. /package/dist/{echo/src/observability → observability}/tracing/index.d.ts +0 -0
  230. /package/dist/{echo/src/providers → providers}/LinearProvider.d.ts +0 -0
  231. /package/dist/{echo/src/providers → providers}/PaddleProvider.d.ts +0 -0
  232. /package/dist/{echo/src/providers → providers}/ShopifyProvider.d.ts +0 -0
  233. /package/dist/{echo/src/providers → providers}/SlackProvider.d.ts +0 -0
  234. /package/dist/{echo/src/providers → providers}/TwilioProvider.d.ts +0 -0
  235. /package/dist/{echo/src/providers → providers}/base/BaseProvider.d.ts +0 -0
  236. /package/dist/{echo/src/providers → providers}/base/HeaderUtils.d.ts +0 -0
  237. /package/dist/{echo/src/replay → replay}/WebhookReplayService.d.ts +0 -0
  238. /package/dist/{echo/src/replay → replay}/index.d.ts +0 -0
  239. /package/dist/{echo/src/resilience → resilience}/CircuitBreaker.d.ts +0 -0
  240. /package/dist/{echo/src/resilience → resilience}/index.d.ts +0 -0
  241. /package/dist/{echo/src/rotation → rotation}/KeyRotationManager.d.ts +0 -0
  242. /package/dist/{echo/src/rotation → rotation}/index.d.ts +0 -0
  243. /package/dist/{echo/src/storage → storage}/MemoryWebhookStore.d.ts +0 -0
  244. /package/dist/{echo/src/storage → storage}/WebhookStore.d.ts +0 -0
  245. /package/dist/{echo/src/storage → storage}/index.d.ts +0 -0
@@ -1,6 +0,0 @@
1
- /**
2
- * Reliability and retry exports.
3
- * @packageDocumentation
4
- */
5
- export { DeadLetterQueueManager, type DLQManagerFilter, type DLQRecord, type DLQStats, } from './DeadLetterQueueManager';
6
- export { getDefaultRetryPolicy, getPresetRetryPolicy, RetryEngine, type RetryPolicy, } from './RetryPolicy';
@@ -1,12 +0,0 @@
1
- import type { GravitoHandler } from '../http/types';
2
- import type { PlanetCore } from '../PlanetCore';
3
- import type { ControllerClass } from '../Router';
4
- export declare class ControllerDispatcher {
5
- private core;
6
- private controllers;
7
- constructor(core: PlanetCore);
8
- /**
9
- * Resolve Controller Instance and Method
10
- */
11
- resolve(CtrlClass: ControllerClass, methodName: string): GravitoHandler;
12
- }
@@ -1,20 +0,0 @@
1
- import type { GravitoMiddleware } from '../http/types';
2
- import { type FormRequestClass } from '../Router';
3
- /**
4
- * Handles validation of incoming requests using FormRequest classes.
5
- * Provides mechanisms to detect and convert FormRequest classes into Gravito middleware.
6
- */
7
- export declare class RequestValidator {
8
- /**
9
- * Check if a value is a FormRequest class.
10
- * Optimized with Symbol check, prototype check, and caching.
11
- * @internal
12
- */
13
- static isFormRequestClass(value: unknown): value is FormRequestClass;
14
- /**
15
- * Convert a FormRequest class to middleware.
16
- * Uses instance caching to avoid re-instantiation on every request.
17
- * @internal
18
- */
19
- static formRequestToMiddleware(RequestClass: FormRequestClass): GravitoMiddleware;
20
- }
@@ -1,119 +0,0 @@
1
- /**
2
- * Detected Javascript Runtime Environment
3
- * @public
4
- */
5
- export type RuntimeKind = 'bun' | 'node' | 'deno' | 'unknown';
6
- /**
7
- * Options for spawning subprocesses
8
- * @public
9
- */
10
- export interface RuntimeSpawnOptions {
11
- cwd?: string;
12
- env?: Record<string, string | undefined>;
13
- stdin?: 'pipe' | 'inherit' | 'ignore';
14
- stdout?: 'pipe' | 'inherit' | 'ignore';
15
- stderr?: 'pipe' | 'inherit' | 'ignore';
16
- }
17
- /**
18
- * Abstract subprocess interface
19
- * @public
20
- */
21
- export interface RuntimeProcess {
22
- exited: Promise<number>;
23
- stdout?: ReadableStream<Uint8Array> | null;
24
- stderr?: ReadableStream<Uint8Array> | null;
25
- kill?: (signal?: string | number) => void;
26
- }
27
- /**
28
- * File statistics abstraction
29
- * @public
30
- */
31
- export interface RuntimeFileStat {
32
- size: number;
33
- }
34
- /**
35
- * HTTP Server configuration
36
- * @public
37
- */
38
- export interface RuntimeServeConfig {
39
- port?: number;
40
- fetch: (req: Request, server?: unknown) => Response | Promise<Response>;
41
- websocket?: unknown;
42
- }
43
- /**
44
- * HTTP Server interface
45
- * @public
46
- */
47
- export interface RuntimeServer {
48
- stop?: () => void;
49
- }
50
- /**
51
- * Abstraction layer for filesystem and process operations across runtimes.
52
- * @public
53
- */
54
- export interface RuntimeAdapter {
55
- kind: RuntimeKind;
56
- spawn(command: string[], options?: RuntimeSpawnOptions): RuntimeProcess;
57
- writeFile(path: string, data: Blob | Buffer | string | ArrayBuffer | Uint8Array): Promise<void>;
58
- readFile(path: string): Promise<Uint8Array>;
59
- readFileAsBlob(path: string): Promise<Blob>;
60
- exists(path: string): Promise<boolean>;
61
- stat(path: string): Promise<RuntimeFileStat>;
62
- deleteFile(path: string): Promise<void>;
63
- serve(config: RuntimeServeConfig): RuntimeServer;
64
- }
65
- /**
66
- * Abstraction layer for password hashing
67
- * @public
68
- */
69
- export interface RuntimePasswordAdapter {
70
- hash(value: string, options: {
71
- algorithm: 'bcrypt';
72
- cost?: number;
73
- } | {
74
- algorithm: 'argon2id';
75
- memoryCost?: number;
76
- timeCost?: number;
77
- parallelism?: number;
78
- }): Promise<string>;
79
- verify(value: string, hashed: string): Promise<boolean>;
80
- }
81
- /**
82
- * SQLite Statement abstraction
83
- * @public
84
- */
85
- export interface RuntimeSqliteStatement {
86
- run(params?: Record<string, unknown>): void;
87
- get(params?: Record<string, unknown>): unknown;
88
- all(params?: Record<string, unknown>): unknown[];
89
- }
90
- /**
91
- * SQLite Database abstraction
92
- * @public
93
- */
94
- export interface RuntimeSqliteDatabase {
95
- run(sql: string): void;
96
- prepare(sql: string): RuntimeSqliteStatement;
97
- query(sql: string): RuntimeSqliteStatement;
98
- close(): void;
99
- }
100
- /**
101
- * Get environment variables from the current runtime.
102
- * @public
103
- */
104
- export declare const getRuntimeEnv: () => Record<string, string | undefined>;
105
- /**
106
- * Get the runtime abstraction adapter (Bun/Node/Deno).
107
- * @public
108
- */
109
- export declare const getRuntimeAdapter: () => RuntimeAdapter;
110
- /**
111
- * Get the password hashing adapter using native optimized implementations if available.
112
- * @public
113
- */
114
- export declare const getPasswordAdapter: () => RuntimePasswordAdapter;
115
- /**
116
- * Create a SQLite database connection using runtime-native drivers.
117
- * @public
118
- */
119
- export declare const createSqliteDatabase: (path: string) => Promise<RuntimeSqliteDatabase>;
@@ -1,33 +0,0 @@
1
- /**
2
- * Options for the Encrypter class.
3
- * @public
4
- */
5
- export interface EncrypterOptions {
6
- key: string;
7
- cipher?: string;
8
- }
9
- /**
10
- * Service for OpenSSL encryption/decryption.
11
- * Compatible with Laravel's encryption format.
12
- * @public
13
- */
14
- export declare class Encrypter {
15
- private algorithm;
16
- private key;
17
- constructor(options: EncrypterOptions);
18
- /**
19
- * Encrypt a value
20
- */
21
- encrypt(value: unknown, serialize?: boolean): string;
22
- /**
23
- * Decrypt a value
24
- */
25
- decrypt(payload: string, deserialize?: boolean): unknown;
26
- private hash;
27
- private validPayload;
28
- private validMac;
29
- /**
30
- * Generate a new key
31
- */
32
- static generateKey(cipher?: string): string;
33
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Hashing interface
3
- */
4
- export interface Hasher {
5
- /**
6
- * Hash the given value
7
- */
8
- make(value: string, options?: Record<string, unknown>): Promise<string>;
9
- /**
10
- * Check the given plain value against a hash
11
- */
12
- check(value: string, hashedValue: string): Promise<boolean>;
13
- /**
14
- * Check if the given hash has been hashed using the given options
15
- */
16
- needsRehash(hashedValue: string, options?: Record<string, unknown>): boolean;
17
- }
18
- /**
19
- * Bun Hasher
20
- * Uses Bun's native password hashing (bcrypt by default)
21
- */
22
- export declare class BunHasher implements Hasher {
23
- make(value: string, options?: {
24
- algorithm?: 'bcrypt' | 'argon2id';
25
- cost?: number;
26
- }): Promise<string>;
27
- check(value: string, hashedValue: string): Promise<boolean>;
28
- needsRehash(_hashedValue: string, _options?: Record<string, unknown>): boolean;
29
- }
@@ -1,39 +0,0 @@
1
- import type { PlanetCore } from '../PlanetCore';
2
- import { TestResponse } from './TestResponse';
3
- /**
4
- * HttpTester provides a way to simulate HTTP requests against a PlanetCore instance
5
- * and returns a TestResponse for assertions.
6
- */
7
- export declare class HttpTester {
8
- private core;
9
- private cookies;
10
- constructor(core: PlanetCore);
11
- /**
12
- * Make a GET request
13
- */
14
- get(uri: string, headers?: Record<string, string>): Promise<TestResponse>;
15
- /**
16
- * Make a POST request
17
- */
18
- post(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
19
- /**
20
- * Make a PUT request
21
- */
22
- put(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
23
- /**
24
- * Make a PATCH request
25
- */
26
- patch(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
27
- /**
28
- * Make a DELETE request
29
- */
30
- delete(uri: string, data?: any, headers?: Record<string, string>): Promise<TestResponse>;
31
- /**
32
- * Core call method
33
- */
34
- private call;
35
- }
36
- /**
37
- * Helper to create an HttpTester for a PlanetCore instance
38
- */
39
- export declare function createHttpTester(core: PlanetCore): HttpTester;
@@ -1,78 +0,0 @@
1
- /**
2
- * TestResponse wraps a standard Fetch Response and provides fluent assertion methods
3
- * inspired by Laravel's TestResponse.
4
- */
5
- export declare class TestResponse {
6
- readonly response: Response;
7
- private _jsonData;
8
- private _textData;
9
- constructor(response: Response);
10
- /**
11
- * Assert the response status code
12
- */
13
- assertStatus(status: number): this;
14
- /**
15
- * Assert that the response has a 200 status code
16
- */
17
- assertOk(): this;
18
- /**
19
- * Assert that the response has a 201 status code
20
- */
21
- assertCreated(): this;
22
- /**
23
- * Assert that the response has a 404 status code
24
- */
25
- assertNotFound(): this;
26
- /**
27
- * Assert that the response has a 403 status code
28
- */
29
- assertForbidden(): this;
30
- /**
31
- * Assert that the response has a 401 status code
32
- */
33
- assertUnauthorized(): this;
34
- /**
35
- * Assert the response is a redirect
36
- */
37
- assertRedirect(uri?: string): this;
38
- /**
39
- * Assert that the response contains the given JSON data.
40
- */
41
- assertJson(data: any): Promise<this>;
42
- /**
43
- * Assert that the response contains exactly the given JSON data.
44
- */
45
- assertExactJson(data: any): Promise<this>;
46
- /**
47
- * Assert the structure of the JSON response.
48
- */
49
- assertJsonStructure(structure: any): Promise<this>;
50
- /**
51
- * Assert that the response contains the given string.
52
- */
53
- assertSee(value: string): Promise<this>;
54
- /**
55
- * Assert that the response does not contain the given string.
56
- */
57
- assertDontSee(value: string): Promise<this>;
58
- /**
59
- * Assert a header exists and matches value
60
- */
61
- assertHeader(header: string, value: string): this;
62
- /**
63
- * Assert a header does not exist
64
- */
65
- assertHeaderMissing(header: string): this;
66
- /**
67
- * Get the JSON content
68
- */
69
- getJson(): Promise<any>;
70
- /**
71
- * Get the text content
72
- */
73
- getText(): Promise<string>;
74
- /**
75
- * Alias for getText for standard expectations if needed
76
- */
77
- get body(): Promise<string>;
78
- }
@@ -1,2 +0,0 @@
1
- export * from './HttpTester';
2
- export * from './TestResponse';
@@ -1,94 +0,0 @@
1
- /**
2
- * Event system type definitions.
3
- */
4
- /**
5
- * Listener interface.
6
- *
7
- * All event listeners must implement this interface.
8
- */
9
- export interface Listener<TEvent extends Event = Event> {
10
- /**
11
- * Handle an event.
12
- * @param event - Event instance
13
- */
14
- handle(event: TEvent): Promise<void> | void;
15
- }
16
- /**
17
- * Marker interface for listeners that should be queued.
18
- *
19
- * Listeners implementing this interface can be dispatched asynchronously via a queue.
20
- */
21
- export interface ShouldQueue {
22
- /**
23
- * Queue name (optional).
24
- */
25
- queue?: string;
26
- /**
27
- * Connection name (optional).
28
- */
29
- connection?: string;
30
- /**
31
- * Delay before execution (seconds).
32
- */
33
- delay?: number;
34
- }
35
- /**
36
- * Marker interface for events that should be broadcast.
37
- *
38
- * Events implementing this interface can be automatically broadcast to clients.
39
- */
40
- export interface ShouldBroadcast {
41
- /**
42
- * Define the broadcast channel.
43
- * @returns Channel name or channel object
44
- */
45
- broadcastOn(): string | Channel;
46
- /**
47
- * Define broadcast payload (optional).
48
- * If omitted, public event properties will be used.
49
- * @returns Broadcast payload
50
- */
51
- broadcastWith?(): Record<string, unknown>;
52
- /**
53
- * Define the broadcast event name (optional).
54
- * If omitted, the event class name will be used.
55
- * @returns Event name
56
- */
57
- broadcastAs?(): string;
58
- }
59
- /**
60
- * Channel interface.
61
- */
62
- export interface Channel {
63
- /**
64
- * Channel name.
65
- */
66
- name: string;
67
- /**
68
- * Channel type.
69
- */
70
- type: 'public' | 'private' | 'presence';
71
- }
72
- /**
73
- * Base event class.
74
- *
75
- * All events should extend this class.
76
- */
77
- export declare abstract class Event {
78
- /**
79
- * Whether this event should be broadcast.
80
- */
81
- shouldBroadcast(): boolean;
82
- /**
83
- * Get broadcast channel.
84
- */
85
- getBroadcastChannel(): string | Channel | null;
86
- /**
87
- * Get broadcast payload.
88
- */
89
- getBroadcastData(): Record<string, unknown>;
90
- /**
91
- * Get broadcast event name.
92
- */
93
- getBroadcastEventName(): string;
94
- }
@@ -1,115 +0,0 @@
1
- import type { GravitoOrbit, PlanetCore } from '@gravito/core';
2
- import { WebhookReceiver } from './receive/WebhookReceiver';
3
- import { KeyRotationManager } from './rotation/KeyRotationManager';
4
- import { WebhookDispatcher } from './send/WebhookDispatcher';
5
- import type { EchoConfig, ProviderKeyEntry } from './types';
6
- /**
7
- * OrbitEcho is the official webhook orchestration module for the Gravito ecosystem.
8
- *
9
- * It serves as a comprehensive hub for managing the entire webhook lifecycle,
10
- * including secure reception, signature verification across multiple providers,
11
- * persistent storage for auditing, and reliable outgoing dispatch with
12
- * exponential backoff and circuit breaking.
13
- *
14
- * @example Basic integration with PlanetCore
15
- * ```typescript
16
- * import { PlanetCore } from '@gravito/core';
17
- * import { OrbitEcho } from '@gravito/echo';
18
- *
19
- * const core = new PlanetCore();
20
- * const echo = new OrbitEcho({
21
- * providers: {
22
- * stripe: { name: 'stripe', secret: process.env.STRIPE_SECRET }
23
- * },
24
- * dispatcher: {
25
- * secret: process.env.APP_WEBHOOK_SECRET
26
- * }
27
- * });
28
- *
29
- * core.install(echo);
30
- * ```
31
- *
32
- * @public
33
- */
34
- export declare class OrbitEcho implements GravitoOrbit {
35
- private receiver;
36
- private dispatcher?;
37
- private echoConfig;
38
- private keyRotationManager?;
39
- /**
40
- * Constructs a new OrbitEcho instance with the specified configuration.
41
- *
42
- * This constructor initializes the core receiver component, sets up key rotation
43
- * orchestration if enabled, registers defined providers, and connects the
44
- * observability stack (metrics, tracing, logging).
45
- *
46
- * @param config - The global configuration defining providers, dispatchers, and infrastructure.
47
- */
48
- constructor(config?: EchoConfig);
49
- /**
50
- * Integrates the Echo module into the Gravito application lifecycle.
51
- *
52
- * This method performs the following setup tasks:
53
- * 1. Installs request buffering middleware (if enabled) to preserve raw bodies.
54
- * 2. Binds Echo components to the service container (`echo`, `echo.receiver`).
55
- * 3. Injects the Echo instance into the request context for easy access in handlers.
56
- *
57
- * @param core - The PlanetCore instance managing the application.
58
- * @throws {Error} If the core adapter is missing or improperly configured.
59
- */
60
- install(core: PlanetCore): void;
61
- /**
62
- * Retrieves the underlying receiver instance for manual webhook processing.
63
- *
64
- * Use this when you need fine-grained control over how incoming webhooks
65
- * are routed or verified outside of the standard middleware flow.
66
- *
67
- * @returns The active WebhookReceiver instance.
68
- */
69
- getReceiver(): WebhookReceiver;
70
- /**
71
- * Retrieves the dispatcher instance for sending outgoing webhooks.
72
- *
73
- * @returns The configured WebhookDispatcher, or undefined if dispatch is disabled.
74
- */
75
- getDispatcher(): WebhookDispatcher | undefined;
76
- /**
77
- * Accesses the active configuration used by this OrbitEcho instance.
78
- *
79
- * @returns The immutable EchoConfig object.
80
- */
81
- getConfig(): EchoConfig;
82
- /**
83
- * Retrieves the key rotation manager responsible for secret lifecycle.
84
- *
85
- * @returns The manager instance, or undefined if key rotation is disabled.
86
- */
87
- getKeyRotationManager(): KeyRotationManager | undefined;
88
- /**
89
- * Initiates a zero-downtime primary key rotation for a specific provider.
90
- *
91
- * This method promotes a new key to primary status while maintaining valid old keys
92
- * for a grace period, ensuring that webhooks signed with either key are accepted
93
- * during the transition.
94
- *
95
- * @param providerName - The identifier of the provider to update.
96
- * @param newKey - Metadata and value for the replacement key.
97
- * @throws {Error} If key rotation is not enabled in the global configuration.
98
- *
99
- * @example
100
- * ```typescript
101
- * await echo.rotateProviderKey('stripe', {
102
- * key: 'whsec_new_secret',
103
- * version: 'v2',
104
- * activeFrom: new Date()
105
- * });
106
- * ```
107
- */
108
- rotateProviderKey(providerName: string, newKey: Omit<ProviderKeyEntry, 'isPrimary'>): Promise<void>;
109
- }
110
- declare module '@gravito/core' {
111
- interface GravitoVariables {
112
- /** Webhook receiver and dispatcher */
113
- echo?: OrbitEcho;
114
- }
115
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * @fileoverview \@gravito/echo - Enterprise Webhook Orchestration
3
- *
4
- * Echo provides a secure, reliable, and observable layer for handling webhooks
5
- * in Gravito applications. It standardizes incoming webhook reception with
6
- * signature verification and dynamic key rotation, while ensuring reliable
7
- * outgoing delivery via exponential backoff and circuit breaking.
8
- *
9
- * @example Receiving webhooks from Stripe
10
- * ```typescript
11
- * import { OrbitEcho, WebhookReceiver } from '@gravito/echo'
12
- *
13
- * const core = new PlanetCore()
14
- * core.install(new OrbitEcho({
15
- * providers: {
16
- * stripe: { name: 'stripe', secret: process.env.STRIPE_SECRET! }
17
- * }
18
- * }))
19
- *
20
- * const receiver = core.container.make<WebhookReceiver>('echo.receiver')
21
- * receiver.on('stripe', 'payment_intent.succeeded', async (event) => {
22
- * // Securely process validated payment
23
- * })
24
- * ```
25
- *
26
- * @example Dispatching reliable outgoing webhooks
27
- * ```typescript
28
- * import { WebhookDispatcher } from '@gravito/echo'
29
- *
30
- * const dispatcher = new WebhookDispatcher({ secret: 'app-secret' })
31
- * await dispatcher.dispatch({
32
- * url: 'https://consumer.com/hook',
33
- * event: 'order.created',
34
- * data: { id: 123 }
35
- * })
36
- * ```
37
- *
38
- * @module @gravito/echo
39
- */
40
- export type { DeadLetterEvent, DeadLetterQueue } from './dlq/DeadLetterQueue';
41
- export { MemoryDeadLetterQueue } from './dlq/MemoryDeadLetterQueue';
42
- export { createRequestBufferMiddleware, RequestBufferMiddleware } from './middleware';
43
- export { OrbitEcho } from './OrbitEcho';
44
- export type { EchoLogEvent, EchoLogger } from './observability/logging';
45
- export { ConsoleEchoLogger } from './observability/logging';
46
- export type { MetricsProvider, WebhookMetricLabels } from './observability/metrics';
47
- export { EchoMetrics, NoopMetricsProvider, PrometheusMetricsProvider, } from './observability/metrics';
48
- export type { Span, SpanOptions, Tracer } from './observability/tracing';
49
- export { NoopSpan, NoopTracer, SpanStatusCode } from './observability/tracing';
50
- export { BaseProvider, type ProviderOptions } from './providers/base/BaseProvider';
51
- export { GenericProvider } from './providers/GenericProvider';
52
- export { GitHubProvider } from './providers/GitHubProvider';
53
- export { LinearProvider } from './providers/LinearProvider';
54
- export { PaddleProvider } from './providers/PaddleProvider';
55
- export { ShopifyProvider } from './providers/ShopifyProvider';
56
- export { SlackProvider } from './providers/SlackProvider';
57
- export { StripeProvider } from './providers/StripeProvider';
58
- export { TwilioProvider } from './providers/TwilioProvider';
59
- export { computeHmacSha1, computeHmacSha256, parseStripeSignature, timingSafeEqual, validateTimestamp, } from './receive/SignatureValidator';
60
- export { WebhookReceiver } from './receive/WebhookReceiver';
61
- export { WebhookReplayService } from './replay/WebhookReplayService';
62
- export { CircuitBreaker } from './resilience';
63
- export { KeyRotationManager } from './rotation';
64
- export type { BufferedRequest, CircuitBreakerConfig, CircuitBreakerMetrics, CircuitBreakerState, EchoConfig, EchoObservabilityConfig, KeyRotationConfig, ProviderKeyEntry, ReplayOptions, ReplayResult, RequestBufferConfig, RetryConfig, WebhookDeliveryResult, WebhookDispatcherConfig, WebhookEvent, WebhookHandler, WebhookPayload, WebhookProvider, WebhookProviderConfig, WebhookProviderConfigWithRotation, WebhookVerificationResult, } from './types';
@@ -1,53 +0,0 @@
1
- /**
2
- * Generic webhook provider.
3
- * @module @gravito/echo/providers
4
- */
5
- import type { WebhookVerificationResult } from '../types';
6
- import { BaseProvider, type ProviderOptions } from './base/BaseProvider';
7
- /**
8
- * Configuration options for the generic provider.
9
- */
10
- export interface GenericProviderOptions extends ProviderOptions {
11
- /**
12
- * Custom header name for the signature.
13
- * @defaultValue 'x-webhook-signature'
14
- */
15
- signatureHeader?: string;
16
- /**
17
- * Custom header name for the timestamp.
18
- * @defaultValue 'x-webhook-timestamp'
19
- */
20
- timestampHeader?: string;
21
- }
22
- /**
23
- * Generic webhook provider using HMAC-SHA256 for signature verification.
24
- *
25
- * Expected headers:
26
- * - X-Webhook-Signature: HMAC-SHA256 hex signature.
27
- * - X-Webhook-Timestamp: Unix timestamp (optional, used for replay protection).
28
- *
29
- * @example
30
- * ```typescript
31
- * const provider = new GenericProvider({
32
- * signatureHeader: 'X-Custom-Sig',
33
- * tolerance: 600
34
- * });
35
- * const result = await provider.verify(body, headers, secret);
36
- * ```
37
- */
38
- export declare class GenericProvider extends BaseProvider {
39
- readonly name = "generic";
40
- private signatureHeader;
41
- private timestampHeader;
42
- constructor(options?: GenericProviderOptions);
43
- /**
44
- * Verifies the webhook using HMAC-SHA256.
45
- *
46
- * @param payload - Raw request body.
47
- * @param headers - Request headers.
48
- * @param secret - Secret key for HMAC computation.
49
- * @returns Verification result.
50
- * @throws Error if signature computation fails.
51
- */
52
- verify(payload: string | Buffer, headers: Record<string, string | string[] | undefined>, secret: string): Promise<WebhookVerificationResult>;
53
- }