@astrojs/db 0.14.14 → 0.15.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.
@@ -9,6 +9,9 @@ type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
9
9
  driverParam: string;
10
10
  enumValues: never;
11
11
  baseColumn: never;
12
+ isPrimaryKey: boolean;
13
+ isAutoincrement: boolean;
14
+ hasRuntimeDefault: boolean;
12
15
  }>;
13
16
  type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
14
17
  data: Date;
@@ -17,6 +20,9 @@ type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
17
20
  driverParam: string;
18
21
  enumValues: never;
19
22
  baseColumn: never;
23
+ isPrimaryKey: boolean;
24
+ isAutoincrement: boolean;
25
+ hasRuntimeDefault: boolean;
20
26
  }>;
21
27
  type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
22
28
  data: boolean;
@@ -25,6 +31,9 @@ type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
25
31
  driverParam: number;
26
32
  enumValues: never;
27
33
  baseColumn: never;
34
+ isPrimaryKey: boolean;
35
+ isAutoincrement: boolean;
36
+ hasRuntimeDefault: boolean;
28
37
  }>;
29
38
  type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
30
39
  data: number;
@@ -33,6 +42,9 @@ type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
33
42
  driverParam: number;
34
43
  enumValues: never;
35
44
  baseColumn: never;
45
+ isPrimaryKey: boolean;
46
+ isAutoincrement: boolean;
47
+ hasRuntimeDefault: boolean;
36
48
  }>;
37
49
  type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
38
50
  data: unknown;
@@ -41,6 +53,9 @@ type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
41
53
  driverParam: string;
42
54
  enumValues: never;
43
55
  baseColumn: never;
56
+ isPrimaryKey: boolean;
57
+ isAutoincrement: boolean;
58
+ hasRuntimeDefault: boolean;
44
59
  }>;
45
60
  type Column<T extends DBColumn['type'], S extends GeneratedConfig> = T extends 'boolean' ? AstroBoolean<S> : T extends 'number' ? AstroNumber<S> : T extends 'text' ? AstroText<S> : T extends 'date' ? AstroDate<S> : T extends 'json' ? AstroJson<S> : never;
46
61
  export type Table<TTableName extends string, TColumns extends OutputColumnsConfig | ColumnsConfig> = SQLiteTableWithColumns<{
@@ -27,7 +27,7 @@ function printHelp({
27
27
  message.push(
28
28
  linebreak(),
29
29
  ` ${bgGreen(black(` ${commandName} `))} ${green(
30
- `v${"0.14.14"}`
30
+ `v${"0.15.0"}`
31
31
  )} ${headline}`
32
32
  );
33
33
  }
@@ -11,6 +11,6 @@ type RemoteDbClientOptions = {
11
11
  appToken: string;
12
12
  remoteUrl: string | URL;
13
13
  };
14
- export declare function createRemoteDatabaseClient(options: RemoteDbClientOptions): SqliteRemoteDatabase<Record<string, never>> | LibSQLDatabase<Record<string, never>>;
14
+ export declare function createRemoteDatabaseClient(options: RemoteDbClientOptions): SqliteRemoteDatabase<Record<string, never>>;
15
15
  export declare function parseOpts(config: Record<string, string>): Partial<LibSQLConfig>;
16
16
  export {};
@@ -18,9 +18,14 @@ export declare function asDrizzleTable(name: string, table: DBTable): import("dr
18
18
  driverParam: unknown;
19
19
  notNull: false;
20
20
  hasDefault: false;
21
+ isPrimaryKey: false;
22
+ isAutoincrement: false;
23
+ hasRuntimeDefault: false;
21
24
  enumValues: string[] | undefined;
22
25
  baseColumn: never;
23
- }, object>;
26
+ identity: undefined;
27
+ generated: undefined;
28
+ }, {}, {}>;
24
29
  };
25
30
  dialect: "sqlite";
26
31
  }>;
@@ -47,12 +47,12 @@ function asDrizzleTable(name, table) {
47
47
  columns[columnName] = columnMapper(columnName, column);
48
48
  }
49
49
  const drizzleTable = sqliteTable(name, columns, (ormTable) => {
50
- const indexes = {};
50
+ const indexes = [];
51
51
  for (const [indexName, indexProps] of Object.entries(table.indexes ?? {})) {
52
52
  const onColNames = Array.isArray(indexProps.on) ? indexProps.on : [indexProps.on];
53
53
  const onCols = onColNames.map((colName) => ormTable[colName]);
54
54
  if (!atLeastOne(onCols)) continue;
55
- indexes[indexName] = index(indexName).on(...onCols);
55
+ indexes.push(index(indexName).on(...onCols));
56
56
  }
57
57
  return indexes;
58
58
  });
@@ -9,6 +9,9 @@ type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
9
9
  driverParam: string;
10
10
  enumValues: never;
11
11
  baseColumn: never;
12
+ isPrimaryKey: boolean;
13
+ isAutoincrement: boolean;
14
+ hasRuntimeDefault: boolean;
12
15
  }>;
13
16
  type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
14
17
  data: Date;
@@ -17,6 +20,9 @@ type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
17
20
  driverParam: string;
18
21
  enumValues: never;
19
22
  baseColumn: never;
23
+ isPrimaryKey: boolean;
24
+ isAutoincrement: boolean;
25
+ hasRuntimeDefault: boolean;
20
26
  }>;
21
27
  type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
22
28
  data: boolean;
@@ -25,6 +31,9 @@ type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
25
31
  driverParam: number;
26
32
  enumValues: never;
27
33
  baseColumn: never;
34
+ isPrimaryKey: boolean;
35
+ isAutoincrement: boolean;
36
+ hasRuntimeDefault: boolean;
28
37
  }>;
29
38
  type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
30
39
  data: number;
@@ -33,6 +42,9 @@ type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
33
42
  driverParam: number;
34
43
  enumValues: never;
35
44
  baseColumn: never;
45
+ isPrimaryKey: boolean;
46
+ isAutoincrement: boolean;
47
+ hasRuntimeDefault: boolean;
36
48
  }>;
37
49
  type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
38
50
  data: unknown;
@@ -41,6 +53,9 @@ type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
41
53
  driverParam: string;
42
54
  enumValues: never;
43
55
  baseColumn: never;
56
+ isPrimaryKey: boolean;
57
+ isAutoincrement: boolean;
58
+ hasRuntimeDefault: boolean;
44
59
  }>;
45
60
  type Column<T extends DBColumn['type'], S extends GeneratedConfig> = T extends 'boolean' ? AstroBoolean<S> : T extends 'number' ? AstroNumber<S> : T extends 'text' ? AstroText<S> : T extends 'date' ? AstroDate<S> : T extends 'json' ? AstroJson<S> : never;
46
61
  export type Table<TTableName extends string, TColumns extends OutputColumnsConfig | ColumnsConfig> = SQLiteTableWithColumns<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/db",
3
- "version": "0.14.14",
3
+ "version": "0.15.0",
4
4
  "description": "Add libSQL and Astro Studio support to your Astro site",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -65,7 +65,7 @@
65
65
  "@libsql/client": "^0.15.2",
66
66
  "async-listen": "^3.1.0",
67
67
  "deep-diff": "^1.0.2",
68
- "drizzle-orm": "^0.31.2",
68
+ "drizzle-orm": "^0.42.0",
69
69
  "github-slugger": "^2.0.0",
70
70
  "kleur": "^4.1.5",
71
71
  "nanoid": "^5.1.5",
@@ -83,7 +83,7 @@
83
83
  "cheerio": "1.0.0",
84
84
  "typescript": "^5.8.3",
85
85
  "vite": "^6.3.4",
86
- "astro": "5.7.12",
86
+ "astro": "5.8.1",
87
87
  "astro-scripts": "0.0.14"
88
88
  },
89
89
  "scripts": {