@gravito/ripple 4.0.1 → 5.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 (226) 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 +31 -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/CircuitBreaker.d.ts +12 -0
  24. package/dist/core/src/events/EventPriorityQueue.d.ts +18 -256
  25. package/dist/core/src/events/index.d.ts +12 -11
  26. package/dist/core/src/events/queue-core.d.ts +77 -0
  27. package/dist/core/src/events/task-executor.d.ts +51 -0
  28. package/dist/core/src/exceptions/AuthException.d.ts +10 -0
  29. package/dist/core/src/exceptions/AuthenticationException.d.ts +2 -2
  30. package/dist/core/src/exceptions/AuthorizationException.d.ts +2 -2
  31. package/dist/core/src/exceptions/CacheException.d.ts +9 -0
  32. package/dist/core/src/exceptions/CircularDependencyException.d.ts +2 -1
  33. package/dist/core/src/exceptions/ConfigurationException.d.ts +9 -0
  34. package/dist/core/src/exceptions/DatabaseException.d.ts +9 -0
  35. package/dist/core/src/exceptions/DomainException.d.ts +9 -0
  36. package/dist/core/src/exceptions/InfrastructureException.d.ts +17 -0
  37. package/dist/core/src/exceptions/QueueException.d.ts +9 -0
  38. package/dist/core/src/exceptions/StorageException.d.ts +9 -0
  39. package/dist/core/src/exceptions/StreamException.d.ts +9 -0
  40. package/dist/core/src/exceptions/SystemException.d.ts +9 -0
  41. package/dist/core/src/exceptions/ValidationException.d.ts +2 -2
  42. package/dist/core/src/exceptions/index.d.ts +10 -0
  43. package/dist/core/src/ffi/NativeAccelerator.d.ts +62 -0
  44. package/dist/core/src/ffi/NativeHasher.d.ts +139 -0
  45. package/dist/core/src/ffi/cbor-fallback.d.ts +96 -0
  46. package/dist/core/src/ffi/hash-fallback.d.ts +33 -0
  47. package/dist/core/src/ffi/index.d.ts +10 -0
  48. package/dist/core/src/ffi/types.d.ts +135 -0
  49. package/dist/core/src/helpers/Str.d.ts +15 -0
  50. package/dist/core/src/hooks/ActionManager.d.ts +132 -0
  51. package/dist/core/src/hooks/AsyncDetector.d.ts +84 -0
  52. package/dist/core/src/hooks/FilterManager.d.ts +71 -0
  53. package/dist/core/src/hooks/MigrationWarner.d.ts +24 -0
  54. package/dist/core/src/hooks/dlq-operations.d.ts +60 -0
  55. package/dist/core/src/hooks/types.d.ts +107 -0
  56. package/dist/core/src/http/CookieJar.d.ts +2 -2
  57. package/dist/core/src/http/types.d.ts +24 -3
  58. package/dist/core/src/index.d.ts +491 -14
  59. package/dist/core/src/observability/contracts.d.ts +137 -0
  60. package/dist/core/src/reliability/DeadLetterQueueManager.d.ts +2 -3
  61. package/dist/core/src/runtime/adapter-bun.d.ts +12 -0
  62. package/dist/core/src/runtime/adapter-deno.d.ts +12 -0
  63. package/dist/core/src/runtime/adapter-node.d.ts +12 -0
  64. package/dist/core/src/runtime/adapter-unknown.d.ts +13 -0
  65. package/dist/core/src/runtime/archive.d.ts +17 -0
  66. package/dist/core/src/runtime/compression.d.ts +21 -0
  67. package/dist/core/src/runtime/deep-equals.d.ts +56 -0
  68. package/dist/core/src/runtime/detection.d.ts +22 -0
  69. package/dist/core/src/runtime/escape.d.ts +34 -0
  70. package/dist/core/src/runtime/index.d.ts +44 -0
  71. package/dist/core/src/runtime/markdown.d.ts +44 -0
  72. package/dist/core/src/runtime/types.d.ts +436 -0
  73. package/dist/core/src/runtime-helpers.d.ts +67 -0
  74. package/dist/core/src/runtime.d.ts +10 -118
  75. package/dist/core/src/testing/HttpTester.d.ts +1 -0
  76. package/dist/core/src/transpiler-utils.d.ts +170 -0
  77. package/dist/{ripple/src/engines → engines}/BunEngine.d.ts +11 -0
  78. package/dist/errors/RippleError.d.ts +66 -0
  79. package/dist/index.js +1 -7502
  80. package/dist/index.js.map +3 -71
  81. package/package.json +6 -2
  82. package/dist/atlas/src/DB.d.ts +0 -348
  83. package/dist/atlas/src/OrbitAtlas.d.ts +0 -9
  84. package/dist/atlas/src/config/defineConfig.d.ts +0 -14
  85. package/dist/atlas/src/config/index.d.ts +0 -7
  86. package/dist/atlas/src/config/loadConfig.d.ts +0 -41
  87. package/dist/atlas/src/connection/Connection.d.ts +0 -112
  88. package/dist/atlas/src/connection/ConnectionManager.d.ts +0 -180
  89. package/dist/atlas/src/connection/ReplicaConnectionPool.d.ts +0 -54
  90. package/dist/atlas/src/drivers/BunSQLDriver.d.ts +0 -32
  91. package/dist/atlas/src/drivers/BunSQLPreparedStatement.d.ts +0 -118
  92. package/dist/atlas/src/drivers/MongoDBDriver.d.ts +0 -36
  93. package/dist/atlas/src/drivers/MySQLDriver.d.ts +0 -79
  94. package/dist/atlas/src/drivers/PostgresDriver.d.ts +0 -96
  95. package/dist/atlas/src/drivers/RedisDriver.d.ts +0 -43
  96. package/dist/atlas/src/drivers/SQLiteDriver.d.ts +0 -45
  97. package/dist/atlas/src/drivers/types.d.ts +0 -260
  98. package/dist/atlas/src/errors/index.d.ts +0 -45
  99. package/dist/atlas/src/grammar/Grammar.d.ts +0 -342
  100. package/dist/atlas/src/grammar/MongoGrammar.d.ts +0 -47
  101. package/dist/atlas/src/grammar/MySQLGrammar.d.ts +0 -54
  102. package/dist/atlas/src/grammar/NullGrammar.d.ts +0 -35
  103. package/dist/atlas/src/grammar/PostgresGrammar.d.ts +0 -62
  104. package/dist/atlas/src/grammar/SQLiteGrammar.d.ts +0 -32
  105. package/dist/atlas/src/index.d.ts +0 -79
  106. package/dist/atlas/src/migration/Migration.d.ts +0 -64
  107. package/dist/atlas/src/migration/MigrationRepository.d.ts +0 -65
  108. package/dist/atlas/src/migration/Migrator.d.ts +0 -110
  109. package/dist/atlas/src/migration/index.d.ts +0 -6
  110. package/dist/atlas/src/observability/AtlasMetrics.d.ts +0 -33
  111. package/dist/atlas/src/observability/AtlasObservability.d.ts +0 -15
  112. package/dist/atlas/src/observability/AtlasTracer.d.ts +0 -12
  113. package/dist/atlas/src/observability/index.d.ts +0 -9
  114. package/dist/atlas/src/orm/Repository.d.ts +0 -247
  115. package/dist/atlas/src/orm/index.d.ts +0 -6
  116. package/dist/atlas/src/orm/model/DirtyTracker.d.ts +0 -121
  117. package/dist/atlas/src/orm/model/Model.d.ts +0 -458
  118. package/dist/atlas/src/orm/model/ModelRegistry.d.ts +0 -20
  119. package/dist/atlas/src/orm/model/concerns/HasAttributes.d.ts +0 -150
  120. package/dist/atlas/src/orm/model/concerns/HasEvents.d.ts +0 -36
  121. package/dist/atlas/src/orm/model/concerns/HasPersistence.d.ts +0 -92
  122. package/dist/atlas/src/orm/model/concerns/HasRelationships.d.ts +0 -117
  123. package/dist/atlas/src/orm/model/concerns/HasSerialization.d.ts +0 -64
  124. package/dist/atlas/src/orm/model/concerns/applyMixins.d.ts +0 -15
  125. package/dist/atlas/src/orm/model/concerns/index.d.ts +0 -12
  126. package/dist/atlas/src/orm/model/decorators.d.ts +0 -138
  127. package/dist/atlas/src/orm/model/errors.d.ts +0 -52
  128. package/dist/atlas/src/orm/model/index.d.ts +0 -10
  129. package/dist/atlas/src/orm/model/relationships.d.ts +0 -207
  130. package/dist/atlas/src/orm/model/types.d.ts +0 -12
  131. package/dist/atlas/src/orm/schema/SchemaRegistry.d.ts +0 -124
  132. package/dist/atlas/src/orm/schema/SchemaSniffer.d.ts +0 -54
  133. package/dist/atlas/src/orm/schema/index.d.ts +0 -6
  134. package/dist/atlas/src/orm/schema/types.d.ts +0 -85
  135. package/dist/atlas/src/pool/AdaptivePoolManager.d.ts +0 -98
  136. package/dist/atlas/src/pool/PoolHealthChecker.d.ts +0 -91
  137. package/dist/atlas/src/pool/PoolStrategy.d.ts +0 -129
  138. package/dist/atlas/src/pool/PoolWarmer.d.ts +0 -92
  139. package/dist/atlas/src/query/Expression.d.ts +0 -60
  140. package/dist/atlas/src/query/NPlusOneDetector.d.ts +0 -10
  141. package/dist/atlas/src/query/QueryBuilder.d.ts +0 -643
  142. package/dist/atlas/src/query/RelationshipResolver.d.ts +0 -23
  143. package/dist/atlas/src/query/clauses/GroupByClause.d.ts +0 -51
  144. package/dist/atlas/src/query/clauses/HavingClause.d.ts +0 -70
  145. package/dist/atlas/src/query/clauses/JoinClause.d.ts +0 -87
  146. package/dist/atlas/src/query/clauses/LimitClause.d.ts +0 -82
  147. package/dist/atlas/src/query/clauses/OrderByClause.d.ts +0 -69
  148. package/dist/atlas/src/query/clauses/SelectClause.d.ts +0 -71
  149. package/dist/atlas/src/query/clauses/WhereClause.d.ts +0 -167
  150. package/dist/atlas/src/query/clauses/index.d.ts +0 -11
  151. package/dist/atlas/src/schema/Blueprint.d.ts +0 -276
  152. package/dist/atlas/src/schema/ColumnDefinition.d.ts +0 -154
  153. package/dist/atlas/src/schema/ForeignKeyDefinition.d.ts +0 -37
  154. package/dist/atlas/src/schema/MigrationGenerator.d.ts +0 -45
  155. package/dist/atlas/src/schema/Schema.d.ts +0 -131
  156. package/dist/atlas/src/schema/SchemaDiff.d.ts +0 -73
  157. package/dist/atlas/src/schema/TypeGenerator.d.ts +0 -57
  158. package/dist/atlas/src/schema/TypeWriter.d.ts +0 -42
  159. package/dist/atlas/src/schema/grammars/MySQLSchemaGrammar.d.ts +0 -23
  160. package/dist/atlas/src/schema/grammars/PostgresSchemaGrammar.d.ts +0 -26
  161. package/dist/atlas/src/schema/grammars/SQLiteSchemaGrammar.d.ts +0 -28
  162. package/dist/atlas/src/schema/grammars/SchemaGrammar.d.ts +0 -97
  163. package/dist/atlas/src/schema/grammars/index.d.ts +0 -7
  164. package/dist/atlas/src/schema/index.d.ts +0 -8
  165. package/dist/atlas/src/seed/Factory.d.ts +0 -90
  166. package/dist/atlas/src/seed/Seeder.d.ts +0 -28
  167. package/dist/atlas/src/seed/SeederRunner.d.ts +0 -74
  168. package/dist/atlas/src/seed/index.d.ts +0 -6
  169. package/dist/atlas/src/sharding/ShardingManager.d.ts +0 -59
  170. package/dist/atlas/src/types/index.d.ts +0 -1182
  171. package/dist/atlas/src/utils/CursorEncoding.d.ts +0 -63
  172. package/dist/atlas/src/utils/levenshtein.d.ts +0 -9
  173. package/dist/core/src/adapters/PhotonAdapter.d.ts +0 -175
  174. package/dist/core/src/adapters/photon-types.d.ts +0 -73
  175. package/dist/core/src/http/middleware/BodySizeLimit.d.ts +0 -16
  176. package/dist/core/src/http/middleware/Cors.d.ts +0 -24
  177. package/dist/core/src/http/middleware/Csrf.d.ts +0 -23
  178. package/dist/core/src/http/middleware/HeaderTokenGate.d.ts +0 -28
  179. package/dist/core/src/http/middleware/SecurityHeaders.d.ts +0 -29
  180. package/dist/core/src/http/middleware/ThrottleRequests.d.ts +0 -18
  181. package/dist/core/src/instrumentation/index.d.ts +0 -35
  182. package/dist/core/src/instrumentation/opentelemetry.d.ts +0 -178
  183. package/dist/core/src/instrumentation/types.d.ts +0 -182
  184. package/dist/core/src/observability/Metrics.d.ts +0 -244
  185. package/dist/photon/src/index.d.ts +0 -89
  186. package/dist/photon/src/middleware/binary.d.ts +0 -31
  187. package/dist/photon/src/middleware/htmx.d.ts +0 -39
  188. package/dist/photon/src/middleware/ratelimit-redis.d.ts +0 -50
  189. package/dist/photon/src/middleware/ratelimit.d.ts +0 -161
  190. package/dist/photon/src/openapi.d.ts +0 -19
  191. package/dist/ripple/src/errors/RippleError.d.ts +0 -48
  192. /package/dist/{ripple/src/channels → channels}/Channel.d.ts +0 -0
  193. /package/dist/{ripple/src/channels → channels}/ChannelManager.d.ts +0 -0
  194. /package/dist/{ripple/src/channels → channels}/index.d.ts +0 -0
  195. /package/dist/{ripple/src/drivers → drivers}/LocalDriver.d.ts +0 -0
  196. /package/dist/{ripple/src/drivers → drivers}/NATSDriver.d.ts +0 -0
  197. /package/dist/{ripple/src/drivers → drivers}/RedisDriver.d.ts +0 -0
  198. /package/dist/{ripple/src/drivers → drivers}/index.d.ts +0 -0
  199. /package/dist/{ripple/src/engines → engines}/IRippleEngine.d.ts +0 -0
  200. /package/dist/{ripple/src/engines → engines}/UWebSocketsEngine.d.ts +0 -0
  201. /package/dist/{ripple/src/engines → engines}/WsEngine.d.ts +0 -0
  202. /package/dist/{ripple/src/engines → engines}/index.d.ts +0 -0
  203. /package/dist/{ripple/src/errors → errors}/index.d.ts +0 -0
  204. /package/dist/{ripple/src/events → events}/BroadcastEvent.d.ts +0 -0
  205. /package/dist/{ripple/src/events → events}/BroadcastManager.d.ts +0 -0
  206. /package/dist/{ripple/src/events → events}/Broadcaster.d.ts +0 -0
  207. /package/dist/{ripple/src/events → events}/index.d.ts +0 -0
  208. /package/dist/{ripple/src/health → health}/HealthChecker.d.ts +0 -0
  209. /package/dist/{ripple/src/health → health}/index.d.ts +0 -0
  210. /package/dist/{ripple/src/index.d.ts → index.d.ts} +0 -0
  211. /package/dist/{ripple/src/logging → logging}/Logger.d.ts +0 -0
  212. /package/dist/{ripple/src/logging → logging}/index.d.ts +0 -0
  213. /package/dist/{ripple/src/middleware → middleware}/InterceptorManager.d.ts +0 -0
  214. /package/dist/{ripple/src/observability → observability}/RippleMetrics.d.ts +0 -0
  215. /package/dist/{ripple/src/reliability → reliability}/AckManager.d.ts +0 -0
  216. /package/dist/{ripple/src/serializers → serializers}/ISerializer.d.ts +0 -0
  217. /package/dist/{ripple/src/serializers → serializers}/JsonSerializer.d.ts +0 -0
  218. /package/dist/{ripple/src/serializers → serializers}/ProtobufSerializer.d.ts +0 -0
  219. /package/dist/{ripple/src/serializers → serializers}/index.d.ts +0 -0
  220. /package/dist/{ripple/src/tracking → tracking}/ConnectionTracker.d.ts +0 -0
  221. /package/dist/{ripple/src/tracking → tracking}/SessionManager.d.ts +0 -0
  222. /package/dist/{ripple/src/tracking → tracking}/index.d.ts +0 -0
  223. /package/dist/{ripple/src/types.d.ts → types.d.ts} +0 -0
  224. /package/dist/{ripple/src/utils → utils}/MessageSerializer.d.ts +0 -0
  225. /package/dist/{ripple/src/utils → utils}/TokenBucket.d.ts +0 -0
  226. /package/dist/{ripple/src/utils → utils}/index.d.ts +0 -0
@@ -1,73 +0,0 @@
1
- /**
2
- * @gravito/atlas - Schema Differ
3
- * @description Compares Atlas Model decorator metadata against the live database
4
- * schema (information_schema) and produces a structured diff.
5
- *
6
- * This powers the `db:push` and `migrate:generate` CLI commands.
7
- */
8
- import type { ConnectionContract } from '../types';
9
- /**
10
- * A single column definition from information_schema or decorator meta.
11
- */
12
- export interface ColumnDefinition {
13
- name: string;
14
- type: string;
15
- nullable: boolean;
16
- defaultValue: string | null;
17
- isPrimary: boolean;
18
- isUnique: boolean;
19
- }
20
- /**
21
- * The result of comparing two schema states.
22
- */
23
- export interface SchemaDiffResult {
24
- /** Table name */
25
- table: string;
26
- /** Columns that exist in models but not in the DB */
27
- added: ColumnDefinition[];
28
- /** Columns that exist in the DB but not in models */
29
- removed: ColumnDefinition[];
30
- /** Columns where the type or nullability has changed */
31
- modified: Array<{
32
- name: string;
33
- from: ColumnDefinition;
34
- to: ColumnDefinition;
35
- }>;
36
- /** Whether any changes were detected */
37
- hasChanges: boolean;
38
- }
39
- export interface SchemaDiffOptions {
40
- /** Database connection to compare against */
41
- connection: ConnectionContract;
42
- /** Table name */
43
- table: string;
44
- /** Desired column definitions (from Model decorators) */
45
- desired: ColumnDefinition[];
46
- }
47
- /**
48
- * SchemaDiff
49
- *
50
- * Compares the desired schema (from Model @Column decorators) against the
51
- * current live database schema and produces a structured diff result.
52
- *
53
- * @example
54
- * ```typescript
55
- * const differ = new SchemaDiff({ connection, table: 'users', desired: userColumns })
56
- * const diff = await differ.compare()
57
- * if (diff.hasChanges) console.log('Schema is out of sync!')
58
- * ```
59
- */
60
- export declare class SchemaDiff {
61
- private readonly connection;
62
- private readonly table;
63
- private readonly desired;
64
- constructor(options: SchemaDiffOptions);
65
- /**
66
- * Perform the schema comparison and return the diff result.
67
- */
68
- compare(): Promise<SchemaDiffResult>;
69
- /**
70
- * Normalize DB type strings for comparison (e.g. 'character varying' → 'varchar').
71
- */
72
- private normalizeType;
73
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * @gravito/atlas - Schema Type Generator
3
- * @description Reads @Column decorator metadata from Model classes and builds a
4
- * type map for generating TypeScript declaration files.
5
- *
6
- * Eliminates "Type Drift" by deriving types 100% from decorator metadata.
7
- */
8
- export declare const COLUMN_METADATA_KEY = "atlas:columns";
9
- /**
10
- * Column metadata stored by @Column decorator
11
- */
12
- export interface ColumnMeta {
13
- name: string;
14
- type: string;
15
- nullable?: boolean;
16
- primary?: boolean;
17
- unique?: boolean;
18
- default?: unknown;
19
- }
20
- /**
21
- * Generated type map for a single Model class
22
- */
23
- export interface ModelTypeMap {
24
- /** Model class name (e.g. 'User') */
25
- modelName: string;
26
- /** Table name the model maps to */
27
- tableName: string;
28
- /** Column-to-TypeScript type mapping */
29
- columns: Record<string, string>;
30
- }
31
- export interface TypeGeneratorOptions {
32
- /** Root directory to scan for Model files */
33
- modelsDir: string;
34
- /** Whether to log progress */
35
- verbose?: boolean;
36
- }
37
- /**
38
- * TypeGenerator
39
- *
40
- * Scans a directory for Atlas Model files and extracts @Column decorator
41
- * metadata to produce a complete type map.
42
- *
43
- * @example
44
- * ```typescript
45
- * const gen = new TypeGenerator({ modelsDir: './src/models' })
46
- * const result = await gen.generate()
47
- * ```
48
- */
49
- export declare class TypeGenerator {
50
- private readonly modelsDir;
51
- private readonly verbose;
52
- constructor(options: TypeGeneratorOptions);
53
- /**
54
- * Scan models directory and extract type maps from all Model files.
55
- */
56
- generate(): Promise<ModelTypeMap[]>;
57
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * @gravito/atlas - Type Writer
3
- * @description Writes TypeScript declaration files from generated Model type maps.
4
- *
5
- * Outputs interface declarations that can be merged into Model classes via
6
- * Declaration Merging for zero type-drift DX.
7
- */
8
- import type { ModelTypeMap } from './TypeGenerator';
9
- export interface TypeWriterOptions {
10
- /** Output file path (e.g., '.orbit/generated.d.ts') */
11
- outputPath: string;
12
- /** Optional banner comment */
13
- banner?: string;
14
- }
15
- /**
16
- * TypeWriter
17
- *
18
- * Converts a list of ModelTypeMap objects into a `.d.ts` declaration file.
19
- *
20
- * @example
21
- * ```typescript
22
- * const writer = new TypeWriter({ outputPath: '.orbit/generated.d.ts' })
23
- * await writer.write(typeMaps)
24
- * // Emits:
25
- * // export interface GeneratedUser { id: number; name: string; ... }
26
- * ```
27
- */
28
- export declare class TypeWriter {
29
- private readonly outputPath;
30
- private readonly banner;
31
- constructor(options: TypeWriterOptions);
32
- /**
33
- * Write the declaration file to disk.
34
- *
35
- * @param typeMaps - Array of model type maps from TypeGenerator
36
- */
37
- write(typeMaps: ModelTypeMap[]): Promise<void>;
38
- /**
39
- * Build the .d.ts file content string.
40
- */
41
- buildContent(typeMaps: ModelTypeMap[]): string;
42
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * MySQL Schema Grammar
3
- * @description DDL generation for MySQL/MariaDB
4
- */
5
- import type { ColumnDefinition } from '../ColumnDefinition';
6
- import type { IndexDefinition } from '../ForeignKeyDefinition';
7
- import { SchemaGrammar } from './SchemaGrammar';
8
- /**
9
- * MySQL Schema Grammar
10
- */
11
- export declare class MySQLSchemaGrammar extends SchemaGrammar {
12
- protected compileType(column: ColumnDefinition): string;
13
- protected compileAutoIncrement(): string;
14
- protected supportsUnsigned(): boolean;
15
- protected compileFullTextIndex(table: string, index: IndexDefinition): string;
16
- protected compileSpatialIndex(table: string, index: IndexDefinition): string;
17
- compileDropIndex(table: string, name: string): string;
18
- wrapTable(table: string): string;
19
- wrapColumn(column: string): string;
20
- compileTableExists(table: string): string;
21
- compileColumnExists(table: string, column: string): string;
22
- compileListTables(): string;
23
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * PostgreSQL Schema Grammar
3
- * @description DDL generation for PostgreSQL
4
- */
5
- import type { Blueprint } from '../Blueprint';
6
- import type { ColumnDefinition } from '../ColumnDefinition';
7
- import type { IndexDefinition } from '../ForeignKeyDefinition';
8
- import { SchemaGrammar } from './SchemaGrammar';
9
- /**
10
- * PostgreSQL Schema Grammar
11
- */
12
- export declare class PostgresSchemaGrammar extends SchemaGrammar {
13
- protected wrapChar: string;
14
- protected compileType(column: ColumnDefinition): string;
15
- protected compileAutoIncrement(): string;
16
- protected compileColumn(column: ColumnDefinition, blueprint: Blueprint): string;
17
- protected supportsUnsigned(): boolean;
18
- protected compileFullTextIndex(table: string, index: IndexDefinition): string;
19
- protected compileSpatialIndex(table: string, index: IndexDefinition): string;
20
- compileDropIndex(_table: string, name: string): string;
21
- wrapTable(table: string): string;
22
- wrapColumn(column: string): string;
23
- compileTableExists(table: string): string;
24
- compileColumnExists(table: string, column: string): string;
25
- compileListTables(): string;
26
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * SQLite Schema Grammar
3
- * @description DDL generation for SQLite
4
- */
5
- import type { Blueprint } from '../Blueprint';
6
- import type { ColumnDefinition } from '../ColumnDefinition';
7
- import type { IndexDefinition } from '../ForeignKeyDefinition';
8
- import { SchemaGrammar } from './SchemaGrammar';
9
- /**
10
- * SQLite Schema Grammar
11
- * Generates SQL DDL statements specifically for SQLite databases.
12
- * @internal
13
- */
14
- export declare class SQLiteSchemaGrammar extends SchemaGrammar {
15
- protected wrapChar: string;
16
- compileCreate(blueprint: Blueprint): string;
17
- wrapTable(table: string): string;
18
- wrapColumn(column: string): string;
19
- compileTableExists(table: string): string;
20
- compileColumnExists(table: string, column: string): string;
21
- compileListTables(): string;
22
- protected compileType(column: ColumnDefinition): string;
23
- protected compileAutoIncrement(): string;
24
- protected supportsUnsigned(): boolean;
25
- protected compileFullTextIndex(_table: string, _index: IndexDefinition): string;
26
- protected compileSpatialIndex(_table: string, _index: IndexDefinition): string;
27
- compileDropIndex(_table: string, name: string): string;
28
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * Schema Grammar
3
- * @description Base class for generating DDL SQL statements
4
- */
5
- import type { Blueprint } from '../Blueprint';
6
- import type { ColumnDefinition } from '../ColumnDefinition';
7
- import type { ForeignKeyDefinition, IndexDefinition } from '../ForeignKeyDefinition';
8
- /**
9
- * Schema Grammar
10
- * Generates DDL SQL statements from Blueprint definitions
11
- */
12
- export declare abstract class SchemaGrammar {
13
- /**
14
- * Compile CREATE TABLE statement
15
- */
16
- compileCreate(blueprint: Blueprint): string;
17
- /**
18
- * Compile DROP TABLE statement
19
- */
20
- compileDrop(table: string): string;
21
- /**
22
- * Compile DROP TABLE IF EXISTS statement
23
- */
24
- compileDropIfExists(table: string): string;
25
- /**
26
- * Compile ALTER TABLE statement
27
- */
28
- compileAlter(blueprint: Blueprint): string[];
29
- /**
30
- * Determine if primary key should be added at the bottom of the statement
31
- */
32
- protected shouldAddPrimaryAtBottom(blueprint: Blueprint): boolean;
33
- /**
34
- * Compile a column definition
35
- */
36
- protected compileColumn(column: ColumnDefinition, _blueprint: Blueprint): string;
37
- /**
38
- * Compile column type
39
- */
40
- protected abstract compileType(column: ColumnDefinition): string;
41
- /**
42
- * Compile auto increment syntax
43
- */
44
- protected abstract compileAutoIncrement(): string;
45
- /**
46
- * Check if database supports UNSIGNED
47
- */
48
- protected abstract supportsUnsigned(): boolean;
49
- /**
50
- * Compile default value
51
- */
52
- protected compileDefault(value: unknown): string;
53
- /**
54
- * Compile CREATE INDEX statement
55
- */
56
- compileIndex(table: string, index: IndexDefinition): string;
57
- /**
58
- * Compile fulltext index (override in subclasses)
59
- */
60
- protected abstract compileFullTextIndex(table: string, index: IndexDefinition): string;
61
- /**
62
- * Compile spatial index (override in subclasses)
63
- */
64
- protected abstract compileSpatialIndex(table: string, index: IndexDefinition): string;
65
- /**
66
- * Compile DROP INDEX statement
67
- */
68
- abstract compileDropIndex(table: string, name: string): string;
69
- /**
70
- * Compile FOREIGN KEY constraint
71
- */
72
- protected compileForeignKey(fk: ForeignKeyDefinition): string;
73
- /**
74
- * Wrap table name with quotes
75
- */
76
- abstract wrapTable(table: string): string;
77
- /**
78
- * Wrap column name with quotes
79
- */
80
- abstract wrapColumn(column: string): string;
81
- /**
82
- * Quote a string value
83
- */
84
- protected quoteString(value: string): string;
85
- /**
86
- * Compile query to check if table exists
87
- */
88
- abstract compileTableExists(table: string): string;
89
- /**
90
- * Compile query to check if column exists
91
- */
92
- abstract compileColumnExists(table: string, column: string): string;
93
- /**
94
- * Compile query to list all tables
95
- */
96
- abstract compileListTables(): string;
97
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Schema Grammars Index
3
- */
4
- export { MySQLSchemaGrammar } from './MySQLSchemaGrammar';
5
- export { PostgresSchemaGrammar } from './PostgresSchemaGrammar';
6
- export { SchemaGrammar } from './SchemaGrammar';
7
- export { SQLiteSchemaGrammar } from './SQLiteSchemaGrammar';
@@ -1,8 +0,0 @@
1
- /**
2
- * Schema Module Index
3
- */
4
- export { Blueprint } from './Blueprint';
5
- export { ColumnDefinition, type ColumnType, type ForeignKeyAction } from './ColumnDefinition';
6
- export type { ForeignKeyDefinition, IndexDefinition } from './ForeignKeyDefinition';
7
- export { MySQLSchemaGrammar, PostgresSchemaGrammar, SchemaGrammar } from './grammars';
8
- export { Schema } from './Schema';
@@ -1,90 +0,0 @@
1
- import type { Model } from '../orm/model/Model';
2
- /**
3
- * Factory State
4
- */
5
- type FactoryState<T> = Partial<T>;
6
- /**
7
- * Factory Definition Function
8
- */
9
- export type FactoryDefinition<T> = () => T;
10
- /**
11
- * Factory Options
12
- */
13
- export interface FactoryOptions {
14
- model?: typeof Model;
15
- table?: string;
16
- }
17
- /**
18
- * Factory
19
- * Generate fake records for seeding
20
- *
21
- * @example
22
- * ```typescript
23
- * const userFactory = new Factory<User>(() => ({
24
- * name: faker.person.fullName(),
25
- * email: faker.internet.email(),
26
- * password: 'hashed_password',
27
- * }), { table: 'users' })
28
- *
29
- * // Create 10 users
30
- * const users = await userFactory.count(10).create()
31
- * ```
32
- */
33
- export declare class Factory<T extends Record<string, unknown>> {
34
- private definition;
35
- private _count;
36
- private _states;
37
- private model?;
38
- private tableName?;
39
- constructor(definition: FactoryDefinition<T>, options?: FactoryOptions);
40
- private static registry;
41
- /**
42
- * Define a factory for a model
43
- */
44
- static define<T extends Record<string, unknown>>(modelOrTable: typeof Model | string, definition: FactoryDefinition<T>): Factory<T>;
45
- /**
46
- * Create a factory for a specific model
47
- */
48
- static model<T extends Record<string, unknown>>(model: typeof Model): Factory<T>;
49
- /**
50
- * Create and insert multiple records
51
- */
52
- createMany(n: number, attributes?: FactoryState<T>): Promise<T[]>;
53
- /**
54
- * Set the number of records to generate
55
- */
56
- count(n: number): this;
57
- /**
58
- * Apply state overrides
59
- */
60
- state(state: FactoryState<T>): this;
61
- /**
62
- * Generate records without inserting
63
- */
64
- make(): T[];
65
- /**
66
- * Generate a single record
67
- */
68
- makeOne(): T;
69
- /**
70
- * Generate records as raw objects (alias for make)
71
- */
72
- raw(): T[];
73
- /**
74
- * Generate a single raw record
75
- */
76
- rawOne(): T;
77
- /**
78
- * Create and insert records into the database
79
- */
80
- create(attributes?: FactoryState<T>): Promise<T[]>;
81
- /**
82
- * Create a sequence generator
83
- */
84
- sequence<K extends keyof T>(key: K, generator: (index: number) => T[K]): this;
85
- }
86
- /**
87
- * Helper to create a factory
88
- */
89
- export declare function factory<T extends Record<string, unknown>>(definition: FactoryDefinition<T>, options?: FactoryOptions): Factory<T>;
90
- export {};
@@ -1,28 +0,0 @@
1
- /**
2
- * Seeder constructor type
3
- */
4
- export type SeederConstructor = new () => Seeder;
5
- /**
6
- * Seeder file info
7
- */
8
- export interface SeederFile {
9
- /** Seeder class name */
10
- name: string;
11
- /** Full file path */
12
- path: string;
13
- }
14
- /**
15
- * Base Seeder Class
16
- * @description All database seeders should extend this class
17
- */
18
- export declare abstract class Seeder {
19
- /**
20
- * Run the seeder logic
21
- */
22
- abstract run(): Promise<void>;
23
- /**
24
- * Run other seeders from within this seeder
25
- * @example await this.call([UserSeeder, PostSeeder])
26
- */
27
- call(seeders: SeederConstructor | SeederConstructor[]): Promise<void>;
28
- }
@@ -1,74 +0,0 @@
1
- /**
2
- * Seeder Runner
3
- * @description Runs database seeders
4
- */
5
- /**
6
- * Seeder Runner Options
7
- */
8
- export interface SeederRunnerOptions {
9
- /** Path to seeders directory */
10
- path?: string;
11
- /** Database connection name */
12
- connection?: string;
13
- }
14
- /**
15
- * Seeder Runner
16
- * Discovers and runs database seeders
17
- *
18
- * @example
19
- * ```typescript
20
- * const runner = new SeederRunner({ path: './seeders' })
21
- *
22
- * // Run all seeders
23
- * await runner.run()
24
- *
25
- * // Run specific seeder
26
- * await runner.call('UserSeeder')
27
- * ```
28
- */
29
- export declare class SeederRunner {
30
- private seedersPath;
31
- private _connectionName;
32
- private resolvedSeeders;
33
- constructor(options?: SeederRunnerOptions);
34
- /**
35
- * Set seeders path
36
- */
37
- setPath(path: string): this;
38
- /**
39
- * Set database connection
40
- */
41
- connection(name: string): this;
42
- /**
43
- * Run all seeders in the directory
44
- */
45
- run(): Promise<string[]>;
46
- /**
47
- * Run a specific seeder by name
48
- */
49
- call(seederName: string): Promise<void>;
50
- /**
51
- * Run multiple specific seeders
52
- */
53
- callMultiple(seederNames: string[]): Promise<void>;
54
- /**
55
- * Check if a seeder exists
56
- */
57
- has(seederName: string): Promise<boolean>;
58
- /**
59
- * List all available seeders
60
- */
61
- list(): Promise<string[]>;
62
- /**
63
- * Get all seeder files from the seeders directory
64
- */
65
- private getSeederFiles;
66
- /**
67
- * Run a single seeder
68
- */
69
- private runSeeder;
70
- /**
71
- * Resolve seeder class from file
72
- */
73
- private resolveSeeder;
74
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Seed Module Index
3
- */
4
- export { Factory, type FactoryDefinition, factory } from './Factory';
5
- export type { Seeder, SeederConstructor, SeederFile } from './Seeder';
6
- export { SeederRunner, type SeederRunnerOptions } from './SeederRunner';
@@ -1,59 +0,0 @@
1
- import type { ConnectionConfig, ConnectionContract } from '../types';
2
- /**
3
- * Sharding Configuration
4
- */
5
- export interface ShardingConfig {
6
- /**
7
- * Number of shards
8
- */
9
- shardCount: number;
10
- /**
11
- * List of shard connection configurations
12
- */
13
- shards: (ConnectionConfig & {
14
- id: number;
15
- })[];
16
- /**
17
- * Sharding algorithm (default: 'consistent-hashing')
18
- */
19
- algorithm?: 'consistent-hashing' | 'modulo' | 'range';
20
- }
21
- /**
22
- * Sharding Manager
23
- *
24
- * Manages database sharding, connection routing, and distributed queries.
25
- * Supports horizontal scaling by partitioning data across multiple database instances.
26
- */
27
- export declare class ShardingManager {
28
- private connections;
29
- private shardCount;
30
- private algorithm;
31
- constructor(config: ShardingConfig);
32
- /**
33
- * Initialize all shard connections
34
- */
35
- private initializeShards;
36
- /**
37
- * Get a shard connection by distribution key (e.g., userId, tenantId)
38
- *
39
- * @param key - The distribution key
40
- * @returns The connection instance for the calculated shard
41
- */
42
- getShard(key: string | number): ConnectionContract;
43
- /**
44
- * Calculate Shard ID based on the key and selected algorithm
45
- */
46
- private calculateShardId;
47
- /**
48
- * Execute a query across all shards and aggregate the results.
49
- * Useful for reports, analytics, or global searches.
50
- *
51
- * @param callback - The operation to perform on each shard
52
- * @returns Aggregated results from all shards
53
- */
54
- mapReduce<T>(callback: (connection: ConnectionContract, shardId: number) => Promise<T[]>): Promise<T[]>;
55
- /**
56
- * Get all active shard connections
57
- */
58
- getAllShards(): Map<number, ConnectionContract>;
59
- }