@gravito/ripple 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +26 -10
  2. package/dist/{ripple/src/OrbitRipple.d.ts → OrbitRipple.d.ts} +1 -0
  3. package/dist/{ripple/src/RippleServer.d.ts → RippleServer.d.ts} +32 -1
  4. package/dist/core/src/Application.d.ts +41 -0
  5. package/dist/core/src/HookManager.d.ts +33 -189
  6. package/dist/core/src/PlanetCore.d.ts +25 -1
  7. package/dist/core/src/Router.d.ts +32 -46
  8. package/dist/core/src/adapters/bun/BunContext.d.ts +6 -1
  9. package/dist/core/src/adapters/bun/BunNativeAdapter.d.ts +35 -0
  10. package/dist/core/src/adapters/bun/BunWebSocketHandler.d.ts +48 -0
  11. package/dist/core/src/adapters/bun/RadixRouter.d.ts +1 -0
  12. package/dist/core/src/adapters/bun/index.d.ts +7 -0
  13. package/dist/core/src/binary/BinaryUtils.d.ts +105 -0
  14. package/dist/core/src/binary/index.d.ts +5 -0
  15. package/dist/core/src/compat/async-local-storage.d.ts +7 -0
  16. package/dist/core/src/compat/crypto.d.ts +6 -0
  17. package/dist/core/src/engine/AOTRouter.d.ts +10 -0
  18. package/dist/core/src/engine/FastContext.d.ts +19 -1
  19. package/dist/core/src/engine/Gravito.d.ts +13 -18
  20. package/dist/core/src/engine/MinimalContext.d.ts +2 -0
  21. package/dist/core/src/engine/analyzer.d.ts +92 -6
  22. package/dist/core/src/engine/types.d.ts +3 -0
  23. package/dist/core/src/events/EventPriorityQueue.d.ts +18 -256
  24. package/dist/core/src/events/index.d.ts +12 -11
  25. package/dist/core/src/events/queue-core.d.ts +77 -0
  26. package/dist/core/src/events/task-executor.d.ts +51 -0
  27. package/dist/core/src/ffi/NativeAccelerator.d.ts +62 -0
  28. package/dist/core/src/ffi/NativeHasher.d.ts +139 -0
  29. package/dist/core/src/ffi/cbor-fallback.d.ts +96 -0
  30. package/dist/core/src/ffi/hash-fallback.d.ts +33 -0
  31. package/dist/core/src/ffi/index.d.ts +10 -0
  32. package/dist/core/src/ffi/types.d.ts +135 -0
  33. package/dist/core/src/helpers/Str.d.ts +15 -0
  34. package/dist/core/src/hooks/ActionManager.d.ts +132 -0
  35. package/dist/core/src/hooks/AsyncDetector.d.ts +84 -0
  36. package/dist/core/src/hooks/FilterManager.d.ts +71 -0
  37. package/dist/core/src/hooks/MigrationWarner.d.ts +24 -0
  38. package/dist/core/src/hooks/dlq-operations.d.ts +60 -0
  39. package/dist/core/src/hooks/types.d.ts +107 -0
  40. package/dist/core/src/http/CookieJar.d.ts +2 -2
  41. package/dist/core/src/http/types.d.ts +24 -3
  42. package/dist/core/src/index.d.ts +491 -14
  43. package/dist/core/src/observability/contracts.d.ts +137 -0
  44. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +2 -3
  45. package/dist/core/src/runtime/adapter-bun.d.ts +12 -0
  46. package/dist/core/src/runtime/adapter-deno.d.ts +12 -0
  47. package/dist/core/src/runtime/adapter-node.d.ts +12 -0
  48. package/dist/core/src/runtime/adapter-unknown.d.ts +13 -0
  49. package/dist/core/src/runtime/archive.d.ts +17 -0
  50. package/dist/core/src/runtime/compression.d.ts +21 -0
  51. package/dist/core/src/runtime/deep-equals.d.ts +56 -0
  52. package/dist/core/src/runtime/detection.d.ts +22 -0
  53. package/dist/core/src/runtime/escape.d.ts +34 -0
  54. package/dist/core/src/runtime/index.d.ts +44 -0
  55. package/dist/core/src/runtime/markdown.d.ts +44 -0
  56. package/dist/core/src/runtime/types.d.ts +436 -0
  57. package/dist/core/src/runtime-helpers.d.ts +67 -0
  58. package/dist/core/src/runtime.d.ts +10 -118
  59. package/dist/core/src/testing/HttpTester.d.ts +1 -0
  60. package/dist/core/src/transpiler-utils.d.ts +170 -0
  61. package/dist/{ripple/src/engines → engines}/BunEngine.d.ts +11 -0
  62. package/dist/index.js +1 -7502
  63. package/dist/index.js.map +3 -71
  64. package/package.json +6 -2
  65. package/dist/atlas/src/DB.d.ts +0 -348
  66. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  67. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  68. package/dist/atlas/src/config/index.d.ts +0 -7
  69. package/dist/atlas/src/config/loadConfig.d.ts +0 -41
  70. package/dist/atlas/src/connection/Connection.d.ts +0 -112
  71. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
  72. package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
  73. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  74. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  75. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  76. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
  77. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
  78. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  79. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  80. package/dist/atlas/src/drivers/types.d.ts +0 -260
  81. package/dist/atlas/src/errors/index.d.ts +0 -45
  82. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  83. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  84. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  85. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  86. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  87. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  88. package/dist/atlas/src/index.d.ts +0 -79
  89. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  90. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  91. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  92. package/dist/atlas/src/migration/index.d.ts +0 -6
  93. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
  94. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  95. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  96. package/dist/atlas/src/observability/index.d.ts +0 -9
  97. package/dist/atlas/src/orm/Repository.d.ts +0 -247
  98. package/dist/atlas/src/orm/index.d.ts +0 -6
  99. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  100. package/dist/atlas/src/orm/model/Model.d.ts +0 -458
  101. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  102. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
  103. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  104. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
  105. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  106. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  107. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  108. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  109. package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
  110. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  111. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  112. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  113. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  114. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
  115. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  116. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  117. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  118. package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
  119. package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
  120. package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
  121. package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
  122. package/dist/atlas/src/query/Expression.d.ts +0 -60
  123. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  124. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
  125. package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
  126. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  127. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  128. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  129. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  130. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  131. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  132. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  133. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  134. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  135. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  136. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  137. package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
  138. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  139. package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
  140. package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
  141. package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
  142. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  143. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  144. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  145. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  146. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  147. package/dist/atlas/src/schema/index.d.ts +0 -8
  148. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  149. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  150. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  151. package/dist/atlas/src/seed/index.d.ts +0 -6
  152. package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
  153. package/dist/atlas/src/types/index.d.ts +0 -1182
  154. package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
  155. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  156. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
  157. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  158. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  159. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  160. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  161. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  162. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  163. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  164. package/dist/core/src/instrumentation/index.d.ts +0 -35
  165. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  166. package/dist/core/src/instrumentation/types.d.ts +0 -182
  167. package/dist/core/src/observability/Metrics.d.ts +0 -244
  168. package/dist/photon/src/index.d.ts +0 -89
  169. package/dist/photon/src/middleware/binary.d.ts +0 -31
  170. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  171. package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
  172. package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
  173. package/dist/photon/src/openapi.d.ts +0 -19
  174. /package/dist/{ripple/src/channels → channels}/Channel.d.ts +0 -0
  175. /package/dist/{ripple/src/channels → channels}/ChannelManager.d.ts +0 -0
  176. /package/dist/{ripple/src/channels → channels}/index.d.ts +0 -0
  177. /package/dist/{ripple/src/drivers → drivers}/LocalDriver.d.ts +0 -0
  178. /package/dist/{ripple/src/drivers → drivers}/NATSDriver.d.ts +0 -0
  179. /package/dist/{ripple/src/drivers → drivers}/RedisDriver.d.ts +0 -0
  180. /package/dist/{ripple/src/drivers → drivers}/index.d.ts +0 -0
  181. /package/dist/{ripple/src/engines → engines}/IRippleEngine.d.ts +0 -0
  182. /package/dist/{ripple/src/engines → engines}/UWebSocketsEngine.d.ts +0 -0
  183. /package/dist/{ripple/src/engines → engines}/WsEngine.d.ts +0 -0
  184. /package/dist/{ripple/src/engines → engines}/index.d.ts +0 -0
  185. /package/dist/{ripple/src/errors → errors}/RippleError.d.ts +0 -0
  186. /package/dist/{ripple/src/errors → errors}/index.d.ts +0 -0
  187. /package/dist/{ripple/src/events → events}/BroadcastEvent.d.ts +0 -0
  188. /package/dist/{ripple/src/events → events}/BroadcastManager.d.ts +0 -0
  189. /package/dist/{ripple/src/events → events}/Broadcaster.d.ts +0 -0
  190. /package/dist/{ripple/src/events → events}/index.d.ts +0 -0
  191. /package/dist/{ripple/src/health → health}/HealthChecker.d.ts +0 -0
  192. /package/dist/{ripple/src/health → health}/index.d.ts +0 -0
  193. /package/dist/{ripple/src/index.d.ts → index.d.ts} +0 -0
  194. /package/dist/{ripple/src/logging → logging}/Logger.d.ts +0 -0
  195. /package/dist/{ripple/src/logging → logging}/index.d.ts +0 -0
  196. /package/dist/{ripple/src/middleware → middleware}/InterceptorManager.d.ts +0 -0
  197. /package/dist/{ripple/src/observability → observability}/RippleMetrics.d.ts +0 -0
  198. /package/dist/{ripple/src/reliability → reliability}/AckManager.d.ts +0 -0
  199. /package/dist/{ripple/src/serializers → serializers}/ISerializer.d.ts +0 -0
  200. /package/dist/{ripple/src/serializers → serializers}/JsonSerializer.d.ts +0 -0
  201. /package/dist/{ripple/src/serializers → serializers}/ProtobufSerializer.d.ts +0 -0
  202. /package/dist/{ripple/src/serializers → serializers}/index.d.ts +0 -0
  203. /package/dist/{ripple/src/tracking → tracking}/ConnectionTracker.d.ts +0 -0
  204. /package/dist/{ripple/src/tracking → tracking}/SessionManager.d.ts +0 -0
  205. /package/dist/{ripple/src/tracking → tracking}/index.d.ts +0 -0
  206. /package/dist/{ripple/src/types.d.ts → types.d.ts} +0 -0
  207. /package/dist/{ripple/src/utils → utils}/MessageSerializer.d.ts +0 -0
  208. /package/dist/{ripple/src/utils → utils}/TokenBucket.d.ts +0 -0
  209. /package/dist/{ripple/src/utils → utils}/index.d.ts +0 -0
@@ -1,54 +0,0 @@
1
- /**
2
- * MySQL Grammar
3
- * @description SQL grammar implementation for MySQL/MariaDB
4
- */
5
- import type { CompiledQuery } from '../types';
6
- import { Grammar } from './Grammar';
7
- /**
8
- * MySQL Grammar
9
- * Implements MySQL/MariaDB-specific SQL syntax
10
- */
11
- export declare class MySQLGrammar extends Grammar {
12
- /**
13
- * MySQL uses backticks for identifiers
14
- */
15
- protected wrapChar: string;
16
- /**
17
- * Get placeholder for MySQL (?)
18
- */
19
- getPlaceholder(_index: number): string;
20
- /**
21
- * Compile INSERT and return ID using LAST_INSERT_ID()
22
- */
23
- compileInsertGetId(query: CompiledQuery, values: Record<string, unknown>, _primaryKey: string): string;
24
- /**
25
- * Compile TRUNCATE for MySQL
26
- */
27
- compileTruncate(query: CompiledQuery): string;
28
- /**
29
- * MySQL-specific: Compile UPSERT using ON DUPLICATE KEY UPDATE
30
- */
31
- compileUpsert(query: CompiledQuery, values: Record<string, unknown>[], _uniqueBy: string[], update: string[]): string;
32
- /**
33
- * MySQL-specific: Compile locking clause
34
- */
35
- compileLock(mode: 'update' | 'share'): string;
36
- /**
37
- * Override offset placeholders - MySQL uses ? for all
38
- */
39
- protected offsetPlaceholders(sql: string, _offset: number): string;
40
- /**
41
- * Compile EXISTS with MySQL syntax
42
- */
43
- compileExists(query: CompiledQuery): string;
44
- /**
45
- * Override aggregate to use backticks
46
- */
47
- compileAggregate(query: CompiledQuery, aggregate: {
48
- function: string;
49
- column: string;
50
- }): string;
51
- compileJsonPath(column: string, _value: unknown): string;
52
- compileJsonContains(column: string, _value: unknown): string;
53
- compileUpdateJson(query: CompiledQuery, column: string, _value: unknown): string;
54
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Null Grammar
3
- * @description A fallback grammar for non-SQL drivers
4
- */
5
- import type { CompiledQuery, GrammarContract } from '../types';
6
- /**
7
- * Null Grammar
8
- * Used for MongoDB, Redis, etc. where SQL compilation is not needed.
9
- */
10
- export declare class NullGrammar implements GrammarContract {
11
- compileSelect(_query: CompiledQuery): string;
12
- compileInsert(_query: CompiledQuery, _values: Record<string, unknown>[]): string;
13
- compileInsertGetId(_query: CompiledQuery, _values: Record<string, unknown>, _primaryKey: string): string;
14
- compileUpdate(_query: CompiledQuery, _values: Record<string, unknown>): string;
15
- compileDelete(_query: CompiledQuery): string;
16
- compileTruncate(_query: CompiledQuery): string;
17
- compileAggregate(_query: CompiledQuery, _aggregate: {
18
- function: string;
19
- column: string;
20
- }): string;
21
- compileExists(_query: CompiledQuery): string;
22
- getPlaceholder(_index: number): string;
23
- wrapColumn(column: string): string;
24
- wrapTable(table: string): string;
25
- quoteValue(value: unknown): string;
26
- compileLateralEagerLoad(_table: string, _foreignKey: string, _parentKeys: unknown[], _query: CompiledQuery): {
27
- sql: string;
28
- bindings: unknown[];
29
- };
30
- getStructuralKey(_query: CompiledQuery): string;
31
- compileJsonPath(column: string, _value: unknown): string;
32
- compileJsonContains(column: string, _value: unknown): string;
33
- compileUpdateJson(_query: CompiledQuery, column: string, _value: unknown): string;
34
- compileUpsert(_query: CompiledQuery, _values: Record<string, unknown>[], _uniqueBy: string[], _update: string[]): string;
35
- }
@@ -1,62 +0,0 @@
1
- /**
2
- * PostgreSQL Grammar
3
- * @description SQL grammar implementation for PostgreSQL
4
- */
5
- import type { CompiledQuery } from '../types';
6
- import { Grammar } from './Grammar';
7
- /**
8
- * PostgreSQL Grammar
9
- * Implements PostgreSQL-specific SQL syntax
10
- */
11
- export declare class PostgresGrammar extends Grammar {
12
- /**
13
- * PostgreSQL uses double quotes for identifiers
14
- */
15
- protected wrapChar: string;
16
- /**
17
- * Get placeholder for PostgreSQL ($1, $2, $3...)
18
- */
19
- getPlaceholder(index: number): string;
20
- /**
21
- * Compile INSERT and return ID using RETURNING clause
22
- */
23
- compileInsertGetId(query: CompiledQuery, values: Record<string, unknown>, primaryKey: string): string;
24
- /**
25
- * Compile INSERT with RETURNING clause for PostgreSQL
26
- */
27
- compileInsert(query: CompiledQuery, values: Record<string, unknown>[]): string;
28
- /**
29
- * Compile UPDATE with RETURNING clause for PostgreSQL
30
- */
31
- compileUpdate(query: CompiledQuery, values: Record<string, unknown>): string;
32
- /**
33
- * Compile TRUNCATE with CASCADE option for PostgreSQL
34
- */
35
- compileTruncate(query: CompiledQuery): string;
36
- /**
37
- * PostgreSQL-specific: Compile UPSERT using ON CONFLICT
38
- */
39
- compileUpsert(query: CompiledQuery, values: Record<string, unknown>[], uniqueBy: string[], update: string[]): string;
40
- /**
41
- * PostgreSQL-specific: Compile locking clause
42
- */
43
- compileLock(mode: 'update' | 'share'): string;
44
- /**
45
- * Override offset placeholders for PostgreSQL
46
- */
47
- protected offsetPlaceholders(sql: string, offset: number): string;
48
- /**
49
- * Compile a lateral eager load query for PostgreSQL
50
- */
51
- compileLateralEagerLoad(_table: string, foreignKey: string, parentKeys: unknown[], query: CompiledQuery): {
52
- sql: string;
53
- bindings: unknown[];
54
- };
55
- /**
56
- * Guess the PostgreSQL type for an array of values
57
- */
58
- protected guessType(values: unknown[]): string;
59
- compileJsonPath(column: string, path: string[]): string;
60
- compileJsonContains(column: string, _value: unknown): string;
61
- compileUpdateJson(query: CompiledQuery, column: string, _value: unknown): string;
62
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * SQLite Grammar
3
- * @description SQL grammar implementation for SQLite
4
- */
5
- import type { CompiledQuery } from '../types';
6
- import { Grammar } from './Grammar';
7
- /**
8
- * SQLite Grammar
9
- * Implements SQLite-specific SQL syntax
10
- */
11
- export declare class SQLiteGrammar extends Grammar {
12
- /**
13
- * SQLite uses double quotes for identifiers
14
- */
15
- protected wrapChar: string;
16
- /**
17
- * Get placeholder for SQLite (?)
18
- */
19
- getPlaceholder(_index: number): string;
20
- /**
21
- * Compile INSERT statement with RETURNING *
22
- */
23
- compileInsert(query: CompiledQuery, values: Record<string, unknown>[]): string;
24
- compileInsertGetId(query: CompiledQuery, values: Record<string, unknown>, primaryKey: string): string;
25
- /**
26
- * Compile TRUNCATE statement
27
- * SQLite doesn't have TRUNCATE, use DELETE FROM
28
- */
29
- compileTruncate(query: CompiledQuery): string;
30
- compileJsonPath(column: string, _value: unknown): string;
31
- compileJsonContains(_column: string, _value: unknown): string;
32
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * @gravito/atlas
3
- * @description The Standard Database Orbit - Custom Query Builder & ORM for Gravito
4
- *
5
- * @example
6
- * ```typescript
7
- * import { DB } from '@gravito/atlas'
8
- *
9
- * // Configure
10
- * DB.addConnection('default', {
11
- * driver: 'postgres',
12
- * host: 'localhost',
13
- * port: 5432,
14
- * database: 'myapp',
15
- * username: 'postgres',
16
- * password: 'secret'
17
- * })
18
- *
19
- * // Query
20
- * const users = await DB.table('users')
21
- * .where('status', 'active')
22
- * .orderBy('created_at', 'desc')
23
- * .limit(10)
24
- * .get()
25
- *
26
- * // Insert
27
- * const newUser = await DB.table('users').insert({
28
- * name: 'John Doe',
29
- * email: 'john@example.com'
30
- * })
31
- *
32
- * // Update
33
- * await DB.table('users')
34
- * .where('id', 1)
35
- * .update({ name: 'Jane Doe' })
36
- *
37
- * // Transaction
38
- * await DB.transaction(async (db) => {
39
- * await db.table('accounts').where('id', 1).decrement('balance', 100)
40
- * await db.table('accounts').where('id', 2).increment('balance', 100)
41
- * })
42
- * ```
43
- */
44
- export type { AtlasConfig } from './config';
45
- export { defineConfig, fromEnv, loadConfig, loadConfigFile } from './config';
46
- export { Connection } from './connection/Connection';
47
- export { ConnectionManager } from './connection/ConnectionManager';
48
- export { ReplicaConnectionPool } from './connection/ReplicaConnectionPool';
49
- export { DB } from './DB';
50
- import { DB } from './DB';
51
- export declare const autoConfigure: typeof DB.autoConfigure;
52
- export { BunSQLDriver } from './drivers/BunSQLDriver';
53
- export { PostgresDriver } from './drivers/PostgresDriver';
54
- export { SQLiteDriver } from './drivers/SQLiteDriver';
55
- export { ConnectionError, ConstraintViolationError, DatabaseError, ForeignKeyConstraintError, NotNullConstraintError, TableNotFoundError, UniqueConstraintError, } from './errors';
56
- export { Grammar } from './grammar/Grammar';
57
- export { PostgresGrammar } from './grammar/PostgresGrammar';
58
- export type { Migration, MigrationFile, MigrationRecord, MigrationResult, MigratorOptions, } from './migration';
59
- export { MigrationRepository, Migrator } from './migration';
60
- export { OrbitAtlas } from './OrbitAtlas';
61
- export type { ColumnSchema as OrmColumnSchema, ModelAttributes, ModelConstructor, ModelStatic, RelationshipMeta, RelationType, SchemaLock, SchemaMode, SchemaRegistryOptions, TableSchema, } from './orm';
62
- export { BelongsTo, BelongsToMany, ColumnNotFoundError, column, DirtyTracker, eagerLoad, eagerLoadMany, getRelationships, HasMany, HasOne, Model, ModelNotFoundError, ModelRegistry, ModelRepository, MorphMany, MorphOne, MorphTo, NullableConstraintError, SchemaRegistry, SchemaSniffer, SoftDeletes, TypeMismatchError, version, } from './orm';
63
- export { Expression, raw } from './query/Expression';
64
- export { QueryBuilder, QueryBuilderError, RecordNotFoundError } from './query/QueryBuilder';
65
- export type { ColumnType, ForeignKeyAction, ForeignKeyDefinition, IndexDefinition } from './schema';
66
- export { Blueprint, ColumnDefinition, Schema } from './schema';
67
- export { MySQLSchemaGrammar, PostgresSchemaGrammar, SchemaGrammar, SQLiteSchemaGrammar, } from './schema/grammars';
68
- export { MigrationGenerator } from './schema/MigrationGenerator';
69
- export type { ColumnDefinition as SchemaColumnDefinition, SchemaDiffResult, } from './schema/SchemaDiff';
70
- export { SchemaDiff } from './schema/SchemaDiff';
71
- export type { ModelTypeMap, TypeGeneratorOptions } from './schema/TypeGenerator';
72
- export { TypeGenerator } from './schema/TypeGenerator';
73
- export { TypeWriter } from './schema/TypeWriter';
74
- export type { FactoryDefinition, Seeder, SeederFile, SeederRunnerOptions } from './seed';
75
- export { Factory, factory, SeederRunner } from './seed';
76
- export { type ShardingConfig, ShardingManager } from './sharding/ShardingManager';
77
- export type { AtlasConnectionEntry, BooleanOperator, CompiledQuery, ConnectionConfig, ConnectionContract, CursorPaginateResult, DriverContract, DriverType, ExecuteResult, FieldInfo, GrammarContract, HavingClause, isReadWriteConfig, JoinClause, JoinType, MySQLConfig, Operator, OrderClause, OrderDirection, PaginateResult, PoolConfig, PostgresConfig, QueryBuilderContract, QueryResult, ReadWriteConnectionConfig, SQLiteConfig, SSLConfig, WhereClause, } from './types';
78
- export type { CursorPayload } from './utils/CursorEncoding';
79
- export { buildCursorWhereClause, decodeCursor, encodeCursor, } from './utils/CursorEncoding';
@@ -1,64 +0,0 @@
1
- /**
2
- * Migration Interface
3
- * @description Contract for database migration classes
4
- */
5
- /**
6
- * Migration Interface
7
- *
8
- * All database migration classes must implement this interface.
9
- * The `up` method is used to apply changes (e.g., create tables),
10
- * while the `down` method is used to reverse those changes.
11
- *
12
- * @example
13
- * ```typescript
14
- * import { Migration, Schema } from '@gravito/atlas'
15
- *
16
- * export default class CreateUsersTable implements Migration {
17
- * async up(): Promise<void> {
18
- * await Schema.create('users', (table) => {
19
- * table.id()
20
- * table.string('email').unique()
21
- * table.timestamps()
22
- * })
23
- * }
24
- *
25
- * async down(): Promise<void> {
26
- * await Schema.dropIfExists('users')
27
- * }
28
- * }
29
- * ```
30
- */
31
- export interface Migration {
32
- /**
33
- * Run the migration (create tables, add columns, etc.)
34
- */
35
- up(): Promise<void>;
36
- /**
37
- * Reverse the migration (drop tables, remove columns, etc.)
38
- */
39
- down(): Promise<void>;
40
- }
41
- /**
42
- * Migration constructor type
43
- */
44
- export type MigrationConstructor = new () => Migration;
45
- /**
46
- * Migration record stored in the database
47
- */
48
- export interface MigrationRecord {
49
- /** Migration ID */
50
- id: number;
51
- /** Migration file name (without path) */
52
- migration: string;
53
- /** Batch number when the migration was run */
54
- batch: number;
55
- }
56
- /**
57
- * Migration file info
58
- */
59
- export interface MigrationFile {
60
- /** Migration file name (without path) */
61
- name: string;
62
- /** Full file path */
63
- path: string;
64
- }
@@ -1,65 +0,0 @@
1
- /**
2
- * Migration Repository
3
- * @description Tracks migration execution state in the database
4
- */
5
- import type { MigrationRecord } from './Migration';
6
- /**
7
- * Migration Repository
8
- *
9
- * The MigrationRepository class manages the database table that tracks
10
- * which migrations have been executed. It provides methods for logging
11
- * migrations, retrieving the list of ran migrations, and managing batches.
12
- */
13
- export declare class MigrationRepository {
14
- private tableName;
15
- private connectionName;
16
- constructor(connectionName?: string);
17
- /**
18
- * Set the table name for migrations
19
- */
20
- setTable(table: string): this;
21
- /**
22
- * Create the migration repository table if it doesn't exist
23
- */
24
- createRepository(): Promise<void>;
25
- /**
26
- * Check if the migration repository exists
27
- */
28
- repositoryExists(): Promise<boolean>;
29
- /**
30
- * Delete the migration repository table
31
- */
32
- deleteRepository(): Promise<void>;
33
- /**
34
- * Get all ran migrations
35
- */
36
- getRan(): Promise<string[]>;
37
- /**
38
- * Get migrations for a specific batch
39
- */
40
- getMigrations(batch: number): Promise<MigrationRecord[]>;
41
- /**
42
- * Get the last batch number
43
- */
44
- getLastBatchNumber(): Promise<number>;
45
- /**
46
- * Get the next batch number
47
- */
48
- getNextBatchNumber(): Promise<number>;
49
- /**
50
- * Log that a migration was run
51
- */
52
- log(migration: string, batch: number): Promise<void>;
53
- /**
54
- * Remove a migration from the log
55
- */
56
- delete(migration: string): Promise<void>;
57
- /**
58
- * Get the last migrations (for rollback)
59
- */
60
- getLast(): Promise<MigrationRecord[]>;
61
- /**
62
- * Get the database connection
63
- */
64
- private getConnection;
65
- }
@@ -1,110 +0,0 @@
1
- /**
2
- * Migrator
3
- * @description Migration runner with support for running and rolling back migrations
4
- */
5
- /**
6
- * Migrator Options
7
- */
8
- export interface MigratorOptions {
9
- /** Path to migrations directory */
10
- path?: string;
11
- /** Database connection name */
12
- connection?: string;
13
- /** Migration table name */
14
- table?: string;
15
- }
16
- /**
17
- * Migration Result
18
- */
19
- export interface MigrationResult {
20
- /** Migrations that were run */
21
- migrations: string[];
22
- /** Batch number */
23
- batch?: number;
24
- }
25
- /**
26
- * Migrator
27
- *
28
- * The Migrator class is responsible for managing the database migration lifecycle.
29
- * It handles discovering migration files, tracking which migrations have been run
30
- * in the database, and executing the `up` or `down` methods of migration classes.
31
- *
32
- * @example
33
- * ```typescript
34
- * const migrator = new Migrator({ path: './migrations' })
35
- *
36
- * // Run all pending migrations
37
- * await migrator.run()
38
- *
39
- * // Rollback the last batch of migrations
40
- * await migrator.rollback()
41
- * ```
42
- */
43
- export declare class Migrator {
44
- private repository;
45
- private migrationsPath;
46
- private resolvedMigrations;
47
- constructor(options?: MigratorOptions);
48
- /**
49
- * Set migrations path
50
- */
51
- setPath(path: string): this;
52
- /**
53
- * Set database connection
54
- */
55
- connection(name: string): this;
56
- /**
57
- * Run all pending migrations.
58
- *
59
- * This method will identify all migration files that have not yet been
60
- * recorded in the migrations table and execute their `up` method.
61
- *
62
- * @returns A promise that resolves to the migration result.
63
- */
64
- run(): Promise<MigrationResult>;
65
- /**
66
- * Run a specific migration up
67
- */
68
- runUp(migrationName: string): Promise<void>;
69
- /**
70
- * Rollback the last batch of migrations.
71
- *
72
- * This method will identify the migrations that were part of the last
73
- * execution batch and execute their `down` method.
74
- *
75
- * @param steps The number of batches to rollback (defaults to 1).
76
- * @returns A promise that resolves to the migration result.
77
- */
78
- rollback(steps?: number): Promise<MigrationResult>;
79
- /**
80
- * Rollback all migrations
81
- */
82
- reset(): Promise<MigrationResult>;
83
- /**
84
- * Reset and re-run all migrations
85
- */
86
- fresh(): Promise<MigrationResult>;
87
- /**
88
- * Rollback and re-run the last batch
89
- */
90
- refresh(steps?: number): Promise<MigrationResult>;
91
- /**
92
- * Get migration status
93
- */
94
- status(): Promise<{
95
- ran: string[];
96
- pending: string[];
97
- }>;
98
- /**
99
- * Get all migration files from the migrations directory
100
- */
101
- private getMigrationFiles;
102
- /**
103
- * Run a single migration
104
- */
105
- private runMigration;
106
- /**
107
- * Resolve migration class from file
108
- */
109
- private resolveMigration;
110
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Migration Module Index
3
- */
4
- export type { Migration, MigrationConstructor, MigrationFile, MigrationRecord } from './Migration';
5
- export { MigrationRepository } from './MigrationRepository';
6
- export { type MigrationResult, Migrator, type MigratorOptions } from './Migrator';
@@ -1,33 +0,0 @@
1
- import { type Counter, type Histogram } from '@opentelemetry/api';
2
- export interface AtlasMetricsConfig {
3
- enabled: boolean;
4
- }
5
- export declare class AtlasMetrics {
6
- private meter;
7
- private config;
8
- private poolCallbacks;
9
- readonly operationDuration?: Histogram;
10
- readonly operationErrors?: Counter;
11
- readonly poolSize?: any;
12
- readonly poolUtilization?: any;
13
- readonly poolWaitTime?: Histogram;
14
- readonly poolAcquisitionErrors?: Counter;
15
- constructor(config: AtlasMetricsConfig);
16
- /**
17
- * Register pool statistics callback for ObservableGauge
18
- */
19
- registerPoolStatsCallback(connectionName: string, getStats: () => {
20
- idle: number;
21
- active: number;
22
- pending: number;
23
- max: number;
24
- } | null): void;
25
- /**
26
- * Record connection wait time
27
- */
28
- recordConnectionWaitTime(connectionName: string, duration: number): void;
29
- /**
30
- * Record connection acquisition error
31
- */
32
- recordConnectionAcquisitionError(connectionName: string, error: string): void;
33
- }
@@ -1,15 +0,0 @@
1
- import { AtlasMetrics, type AtlasMetricsConfig } from './AtlasMetrics';
2
- import { AtlasTracer, type AtlasTracingConfig } from './AtlasTracer';
3
- export declare class AtlasObservability {
4
- private static instance;
5
- tracer?: AtlasTracer;
6
- metrics?: AtlasMetrics;
7
- private constructor();
8
- static getInstance(): AtlasObservability;
9
- initialize(config: {
10
- tracing?: AtlasTracingConfig;
11
- metrics?: AtlasMetricsConfig;
12
- }): void;
13
- static getTracer(): AtlasTracer | undefined;
14
- static getMetrics(): AtlasMetrics | undefined;
15
- }
@@ -1,12 +0,0 @@
1
- import { type Context, type Span } from '@opentelemetry/api';
2
- export interface AtlasTracingConfig {
3
- enabled: boolean;
4
- serviceName?: string;
5
- }
6
- export declare class AtlasTracer {
7
- private tracer;
8
- private config;
9
- constructor(config: AtlasTracingConfig);
10
- startSpan(name: string, attributes?: Record<string, any>): Span | undefined;
11
- getActiveContext(): Context;
12
- }
@@ -1,9 +0,0 @@
1
- export * from './AtlasMetrics';
2
- export * from './AtlasObservability';
3
- export * from './AtlasTracer';
4
- export interface AtlasObservabilityConfig {
5
- enabled: boolean;
6
- tracing?: boolean;
7
- metrics?: boolean;
8
- serviceName?: string;
9
- }