@housekit/kit 0.1.18 → 0.1.20
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.
- package/README.md +11 -2
- package/dist/config.d.ts +2 -25
- package/dist/index.js +2520 -68
- package/dist/loader.d.ts +1 -1
- package/dist/ui.d.ts +3 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -105,8 +105,14 @@ export default {
|
|
|
105
105
|
HouseKit simplifies managing Replicated and Distributed tables across a cluster.
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
import { defineTable, t, Engine } from '@housekit/orm';
|
|
109
|
+
|
|
110
|
+
// Define a table that lives on a cluster (object syntax still supported)
|
|
111
|
+
export const events = defineTable('events', {
|
|
112
|
+
id: t.uuid('id').primaryKey(),
|
|
113
|
+
userId: t.uuid('user_id'),
|
|
114
|
+
createdAt: t.timestamp('created_at').default('now()'),
|
|
115
|
+
}, {
|
|
110
116
|
engine: Engine.ReplicatedMergeTree(),
|
|
111
117
|
|
|
112
118
|
// High Portability: Using '{cluster}' tells ClickHouse to use the
|
|
@@ -117,6 +123,9 @@ export const events = defineTable('events', (t) => ({ ... }), {
|
|
|
117
123
|
shardKey: 'user_id',
|
|
118
124
|
orderBy: 'id'
|
|
119
125
|
});
|
|
126
|
+
|
|
127
|
+
// Callback syntax is also available when you want presets or composition:
|
|
128
|
+
// defineTable('events', (t) => ({ ... }), { ... })
|
|
120
129
|
```
|
|
121
130
|
When you run `housekit push`, the CLI automatically detects the cluster configuration and executes the `ALTER` or `CREATE` statements across all nodes using the specified macro.
|
|
122
131
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
port?: number;
|
|
4
|
-
database: string;
|
|
5
|
-
username?: string;
|
|
6
|
-
password?: string;
|
|
7
|
-
url?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface HouseKitConfig {
|
|
10
|
-
/**
|
|
11
|
-
* Path to the directory containing your schema files (.ts or .js).
|
|
12
|
-
* Can be a single path or a mapping for multiple databases.
|
|
13
|
-
*/
|
|
14
|
-
schema: string | Record<string, string>;
|
|
15
|
-
/**
|
|
16
|
-
* Directory where SQL migrations and snapshots will be generated.
|
|
17
|
-
*/
|
|
18
|
-
out: string;
|
|
19
|
-
language?: 'ts' | 'js';
|
|
20
|
-
/**
|
|
21
|
-
* ClickHouse connection configuration.
|
|
22
|
-
* Each key represents the database name you will use in the CLI with `--database`.
|
|
23
|
-
*/
|
|
24
|
-
databases: Record<string, DatabaseConnection>;
|
|
25
|
-
}
|
|
1
|
+
import type { DatabaseConnection, HouseKitConfig } from '@housekit/orm';
|
|
2
|
+
export type { DatabaseConnection, HouseKitConfig };
|
|
26
3
|
export type { HouseKitConfig as default };
|
|
27
4
|
/**
|
|
28
5
|
* Helper to get all database configurations
|