@astrojs/db 0.14.11 → 0.14.12

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.
@@ -2,7 +2,7 @@ import type { ColumnBaseConfig, ColumnDataType } from 'drizzle-orm';
2
2
  import type { SQLiteColumn, SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core';
3
3
  import type { ColumnsConfig, DBColumn, OutputColumnsConfig } from '../core/types.js';
4
4
  type GeneratedConfig<T extends ColumnDataType = ColumnDataType> = Pick<ColumnBaseConfig<T, string>, 'name' | 'tableName' | 'notNull' | 'hasDefault'>;
5
- export type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
5
+ type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
6
6
  data: string;
7
7
  dataType: 'string';
8
8
  columnType: 'SQLiteText';
@@ -10,7 +10,7 @@ export type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
10
10
  enumValues: never;
11
11
  baseColumn: never;
12
12
  }>;
13
- export type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
13
+ type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
14
14
  data: Date;
15
15
  dataType: 'custom';
16
16
  columnType: 'SQLiteCustomColumn';
@@ -18,7 +18,7 @@ export type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
18
18
  enumValues: never;
19
19
  baseColumn: never;
20
20
  }>;
21
- export type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
21
+ type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
22
22
  data: boolean;
23
23
  dataType: 'boolean';
24
24
  columnType: 'SQLiteBoolean';
@@ -26,7 +26,7 @@ export type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T
26
26
  enumValues: never;
27
27
  baseColumn: never;
28
28
  }>;
29
- export type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
29
+ type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
30
30
  data: number;
31
31
  dataType: 'number';
32
32
  columnType: 'SQLiteInteger';
@@ -34,7 +34,7 @@ export type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T &
34
34
  enumValues: never;
35
35
  baseColumn: never;
36
36
  }>;
37
- export type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
37
+ type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
38
38
  data: unknown;
39
39
  dataType: 'custom';
40
40
  columnType: 'SQLiteCustomColumn';
@@ -42,7 +42,7 @@ export type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
42
42
  enumValues: never;
43
43
  baseColumn: never;
44
44
  }>;
45
- export 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;
45
+ 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
46
  export type Table<TTableName extends string, TColumns extends OutputColumnsConfig | ColumnsConfig> = SQLiteTableWithColumns<{
47
47
  name: TTableName;
48
48
  schema: undefined;
@@ -1,30 +1 @@
1
1
  export declare function cmd(): Promise<void>;
2
- export declare function createNewProject({ workspaceId, name, region, }: {
3
- workspaceId: string;
4
- name: string;
5
- region: string;
6
- }): Promise<{
7
- id: string;
8
- idName: string;
9
- }>;
10
- export declare function promptExistingProjectName({ workspaceId }: {
11
- workspaceId: string;
12
- }): Promise<{
13
- id: string;
14
- name: string;
15
- idName: string;
16
- }>;
17
- export declare function promptBegin(): Promise<void>;
18
- /**
19
- * Ask the user if they want to link to an existing Astro Studio project.
20
- * @returns A `Promise` for the user’s answer: `true` if they answer yes, otherwise `false`.
21
- */
22
- export declare function promptLinkExisting(): Promise<boolean>;
23
- /**
24
- * Ask the user if they want to link to a new Astro Studio Project.
25
- * **Exits the process if they answer no.**
26
- * @returns A `Promise` for the user’s answer: `true` if they answer yes.
27
- */
28
- export declare function promptLinkNew(): Promise<boolean>;
29
- export declare function promptNewProjectName(): Promise<string>;
30
- export declare function promptNewProjectRegion(): Promise<string>;
@@ -262,12 +262,5 @@ async function promptNewProjectRegion() {
262
262
  return newProjectRegion;
263
263
  }
264
264
  export {
265
- cmd,
266
- createNewProject,
267
- promptBegin,
268
- promptExistingProjectName,
269
- promptLinkExisting,
270
- promptLinkNew,
271
- promptNewProjectName,
272
- promptNewProjectRegion
265
+ cmd
273
266
  };
@@ -27,7 +27,7 @@ function printHelp({
27
27
  message.push(
28
28
  linebreak(),
29
29
  ` ${bgGreen(black(` ${commandName} `))} ${green(
30
- `v${"0.14.11"}`
30
+ `v${"0.14.12"}`
31
31
  )} ${headline}`
32
32
  );
33
33
  }
@@ -1,7 +1,5 @@
1
- export declare const PACKAGE_NAME: any;
2
1
  export declare const RUNTIME_IMPORT: string;
3
2
  export declare const RUNTIME_VIRTUAL_IMPORT: string;
4
- export declare const DB_TYPES_FILE = "db-types.d.ts";
5
3
  export declare const VIRTUAL_MODULE_ID = "astro:db";
6
4
  export declare const DB_PATH = ".astro/content.db";
7
5
  export declare const CONFIG_FILE_NAMES: string[];
@@ -4,7 +4,6 @@ const PACKAGE_NAME = JSON.parse(
4
4
  ).name;
5
5
  const RUNTIME_IMPORT = JSON.stringify(`${PACKAGE_NAME}/runtime`);
6
6
  const RUNTIME_VIRTUAL_IMPORT = JSON.stringify(`${PACKAGE_NAME}/dist/runtime/virtual.js`);
7
- const DB_TYPES_FILE = "db-types.d.ts";
8
7
  const VIRTUAL_MODULE_ID = "astro:db";
9
8
  const DB_PATH = ".astro/content.db";
10
9
  const CONFIG_FILE_NAMES = ["config.ts", "config.js", "config.mts", "config.mjs"];
@@ -12,9 +11,7 @@ const MIGRATION_VERSION = "2024-03-12";
12
11
  export {
13
12
  CONFIG_FILE_NAMES,
14
13
  DB_PATH,
15
- DB_TYPES_FILE,
16
14
  MIGRATION_VERSION,
17
- PACKAGE_NAME,
18
15
  RUNTIME_IMPORT,
19
16
  RUNTIME_VIRTUAL_IMPORT,
20
17
  VIRTUAL_MODULE_ID
@@ -1,10 +1,6 @@
1
1
  import type { AstroConfig, AstroIntegrationLogger } from 'astro';
2
2
  import type { DBTables } from '../types.js';
3
3
  import { type VitePlugin } from '../utils.js';
4
- export declare const resolved: {
5
- module: string;
6
- importedFromSeedFile: string;
7
- };
8
4
  export type LateTables = {
9
5
  get: () => DBTables;
10
6
  };
@@ -165,6 +165,5 @@ export {
165
165
  getConfigVirtualModContents,
166
166
  getLocalVirtualModContents,
167
167
  getStudioVirtualModContents,
168
- resolved,
169
168
  vitePluginDb
170
169
  };
@@ -3,7 +3,6 @@ export declare const SEED_DEV_FILE_NAME: string[];
3
3
  export declare function getDropTableIfExistsQuery(tableName: string): string;
4
4
  export declare function getCreateTableQuery(tableName: string, table: DBTable): string;
5
5
  export declare function getCreateIndexQueries(tableName: string, table: Pick<DBTable, 'indexes'>): string[];
6
- export declare function getCreateForeignKeyQueries(tableName: string, table: DBTable): string[];
7
6
  export declare function schemaTypeToSqlType(type: ColumnType): 'text' | 'integer';
8
7
  export declare function getModifiers(columnName: string, column: DBColumn): string;
9
8
  export declare function getReferencesConfig(column: DBColumn): {
@@ -156,7 +156,6 @@ function getDefaultValueSql(columnName, column) {
156
156
  }
157
157
  export {
158
158
  SEED_DEV_FILE_NAME,
159
- getCreateForeignKeyQueries,
160
159
  getCreateIndexQueries,
161
160
  getCreateTableQuery,
162
161
  getDropTableIfExistsQuery,
@@ -2,4 +2,3 @@ export declare const FOREIGN_KEY_DNE_ERROR: (tableName: string) => string;
2
2
  export declare const FOREIGN_KEY_REFERENCES_LENGTH_ERROR: (tableName: string) => string;
3
3
  export declare const FOREIGN_KEY_REFERENCES_EMPTY_ERROR: (tableName: string) => string;
4
4
  export declare const REFERENCE_DNE_ERROR: (columnName: string) => string;
5
- export declare const SEED_DEFAULT_EXPORT_ERROR: (fileName: string) => string;
@@ -19,13 +19,9 @@ const REFERENCE_DNE_ERROR = (columnName) => {
19
19
  columnName
20
20
  )} references a table that does not exist. Did you apply the referenced table to the \`tables\` object in your db config?`;
21
21
  };
22
- const SEED_DEFAULT_EXPORT_ERROR = (fileName) => {
23
- return `Missing default function export in ${bold(fileName)}`;
24
- };
25
22
  export {
26
23
  FOREIGN_KEY_DNE_ERROR,
27
24
  FOREIGN_KEY_REFERENCES_EMPTY_ERROR,
28
25
  FOREIGN_KEY_REFERENCES_LENGTH_ERROR,
29
- REFERENCE_DNE_ERROR,
30
- SEED_DEFAULT_EXPORT_ERROR
26
+ REFERENCE_DNE_ERROR
31
27
  };
@@ -2,7 +2,7 @@ import type { ColumnBaseConfig, ColumnDataType } from 'drizzle-orm';
2
2
  import type { SQLiteColumn, SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core';
3
3
  import type { ColumnsConfig, DBColumn, OutputColumnsConfig } from '../core/types.js';
4
4
  type GeneratedConfig<T extends ColumnDataType = ColumnDataType> = Pick<ColumnBaseConfig<T, string>, 'name' | 'tableName' | 'notNull' | 'hasDefault'>;
5
- export type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
5
+ type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
6
6
  data: string;
7
7
  dataType: 'string';
8
8
  columnType: 'SQLiteText';
@@ -10,7 +10,7 @@ export type AstroText<T extends GeneratedConfig<'string'>> = SQLiteColumn<T & {
10
10
  enumValues: never;
11
11
  baseColumn: never;
12
12
  }>;
13
- export type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
13
+ type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
14
14
  data: Date;
15
15
  dataType: 'custom';
16
16
  columnType: 'SQLiteCustomColumn';
@@ -18,7 +18,7 @@ export type AstroDate<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
18
18
  enumValues: never;
19
19
  baseColumn: never;
20
20
  }>;
21
- export type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
21
+ type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T & {
22
22
  data: boolean;
23
23
  dataType: 'boolean';
24
24
  columnType: 'SQLiteBoolean';
@@ -26,7 +26,7 @@ export type AstroBoolean<T extends GeneratedConfig<'boolean'>> = SQLiteColumn<T
26
26
  enumValues: never;
27
27
  baseColumn: never;
28
28
  }>;
29
- export type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
29
+ type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T & {
30
30
  data: number;
31
31
  dataType: 'number';
32
32
  columnType: 'SQLiteInteger';
@@ -34,7 +34,7 @@ export type AstroNumber<T extends GeneratedConfig<'number'>> = SQLiteColumn<T &
34
34
  enumValues: never;
35
35
  baseColumn: never;
36
36
  }>;
37
- export type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
37
+ type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
38
38
  data: unknown;
39
39
  dataType: 'custom';
40
40
  columnType: 'SQLiteCustomColumn';
@@ -42,7 +42,7 @@ export type AstroJson<T extends GeneratedConfig<'custom'>> = SQLiteColumn<T & {
42
42
  enumValues: never;
43
43
  baseColumn: never;
44
44
  }>;
45
- export 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;
45
+ 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
46
  export type Table<TTableName extends string, TColumns extends OutputColumnsConfig | ColumnsConfig> = SQLiteTableWithColumns<{
47
47
  name: TTableName;
48
48
  schema: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/db",
3
- "version": "0.14.11",
3
+ "version": "0.14.12",
4
4
  "description": "Add libSQL and Astro Studio support to your Astro site",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -74,7 +74,7 @@
74
74
  "yargs-parser": "^21.1.1",
75
75
  "yocto-spinner": "^0.2.1",
76
76
  "zod": "^3.24.2",
77
- "@astrojs/studio": "0.1.7"
77
+ "@astrojs/studio": "0.1.8"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/deep-diff": "^1.0.5",
@@ -83,7 +83,7 @@
83
83
  "cheerio": "1.0.0",
84
84
  "typescript": "^5.8.3",
85
85
  "vite": "^6.2.6",
86
- "astro": "5.6.2",
86
+ "astro": "5.7.5",
87
87
  "astro-scripts": "0.0.14"
88
88
  },
89
89
  "scripts": {
@@ -1,5 +0,0 @@
1
- export interface Arguments {
2
- _: Array<string | number>;
3
- '--'?: Array<string | number>;
4
- [argName: string]: any;
5
- }
File without changes