@astrojs/db 0.3.5 → 0.4.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 (61) hide show
  1. package/dist/core/cli/commands/link/index.js +7 -3
  2. package/dist/core/cli/commands/push/index.js +3 -3
  3. package/dist/core/cli/migration-queries.d.ts +4 -4
  4. package/dist/core/cli/migration-queries.js +73 -73
  5. package/dist/core/cli/migrations.js +15 -7
  6. package/dist/core/errors.js +7 -3
  7. package/dist/core/integration/file-url.js +2 -1
  8. package/dist/core/integration/index.js +106 -57
  9. package/dist/core/integration/typegen.d.ts +3 -3
  10. package/dist/core/integration/typegen.js +8 -8
  11. package/dist/core/integration/vite-plugin-db.d.ts +14 -9
  12. package/dist/core/integration/vite-plugin-db.js +15 -12
  13. package/dist/core/integration/vite-plugin-inject-env-ts.d.ts +4 -2
  14. package/dist/core/integration/vite-plugin-inject-env-ts.js +8 -4
  15. package/dist/core/queries.d.ts +12 -12
  16. package/dist/core/queries.js +49 -46
  17. package/dist/core/types.d.ts +232 -231
  18. package/dist/core/types.js +56 -55
  19. package/dist/core/utils.js +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +4 -4
  22. package/dist/runtime/db-client.d.ts +9 -4
  23. package/dist/runtime/db-client.js +11 -7
  24. package/dist/runtime/index.d.ts +7 -7
  25. package/dist/runtime/index.js +27 -29
  26. package/dist/runtime/types.d.ts +7 -7
  27. package/package.json +3 -5
  28. package/components/Renderer.astro +0 -14
  29. package/components/astro-env.d.ts +0 -1
  30. package/components/index.ts +0 -2
  31. package/components/tsconfig.json +0 -7
  32. package/dist/cli/commands/push/index.d.ts +0 -6
  33. package/dist/cli/commands/shell/index.d.ts +0 -6
  34. package/dist/cli/commands/sync/index.d.ts +0 -6
  35. package/dist/cli/commands/verify/index.d.ts +0 -6
  36. package/dist/cli/index.d.ts +0 -6
  37. package/dist/cli/queries.d.ts +0 -18
  38. package/dist/cli/seed.d.ts +0 -6
  39. package/dist/cli/sync/admin.d.ts +0 -33
  40. package/dist/cli/sync/index.d.ts +0 -1
  41. package/dist/cli/sync/migrate.d.ts +0 -1
  42. package/dist/cli/sync/queries.d.ts +0 -19
  43. package/dist/cli/sync/remote-db.d.ts +0 -1
  44. package/dist/config.d.ts +0 -1374
  45. package/dist/consts.d.ts +0 -7
  46. package/dist/core/cli/commands/sync/index.d.ts +0 -6
  47. package/dist/error-map.d.ts +0 -6
  48. package/dist/errors.d.ts +0 -3
  49. package/dist/file-url-integration.d.ts +0 -2
  50. package/dist/integration.d.ts +0 -2
  51. package/dist/internal-drizzle.d.ts +0 -1
  52. package/dist/internal.d.ts +0 -47
  53. package/dist/load-astro-config.d.ts +0 -6
  54. package/dist/migrations.d.ts +0 -12
  55. package/dist/root.d.ts +0 -3
  56. package/dist/typegen.d.ts +0 -5
  57. package/dist/types.d.ts +0 -1604
  58. package/dist/utils-runtime.d.ts +0 -1
  59. package/dist/utils.d.ts +0 -59
  60. package/dist/vite-plugin-db.d.ts +0 -19
  61. package/dist/vite-plugin-inject-env-ts.d.ts +0 -9
package/dist/consts.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export declare const PACKAGE_NAME: any;
2
- export declare const INTERNAL_MOD_IMPORT: string;
3
- export declare const DRIZZLE_MOD_IMPORT: string;
4
- export declare const DB_TYPES_FILE = "db-types.d.ts";
5
- export declare const VIRTUAL_MODULE_ID = "astro:db";
6
- export declare const DB_PATH = ".astro/content.db";
7
- export declare function getLocalDbUrl(root: URL): URL;
@@ -1,6 +0,0 @@
1
- import type { AstroConfig } from 'astro';
2
- import type { Arguments } from 'yargs-parser';
3
- export declare function cmd({ config }: {
4
- config: AstroConfig;
5
- flags: Arguments;
6
- }): Promise<void>;
@@ -1,6 +0,0 @@
1
- /**
2
- * This is a modified version of Astro's error map. source:
3
- * https://github.com/withastro/astro/blob/main/packages/astro/src/content/error-map.ts
4
- */
5
- import type { z } from 'astro/zod';
6
- export declare const errorMap: z.ZodErrorMap;
package/dist/errors.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const unexpectedAstroAdminError: string;
2
- export declare const authenticationError: string;
3
- export declare const appTokenError: string;
@@ -1,2 +0,0 @@
1
- import type { AstroIntegration } from 'astro';
2
- export declare function fileURLIntegration(): AstroIntegration;
@@ -1,2 +0,0 @@
1
- import type { AstroIntegration } from 'astro';
2
- export declare function integration(): AstroIntegration[];
@@ -1 +0,0 @@
1
- export { sql, eq, gt, gte, lt, lte, ne, isNull, isNotNull, inArray, notInArray, exists, notExists, between, notBetween, like, notIlike, not, asc, desc, and, or, } from 'drizzle-orm';
@@ -1,47 +0,0 @@
1
- import type { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
2
- import { type BooleanColumn, type DBCollection, type DBCollections, type DBColumn, type DateColumn, type ColumnType, type JsonColumn, type NumberColumn, type TextColumn } from './types.js';
3
- import { type SQL, type ColumnDataType } from 'drizzle-orm';
4
- import type { AstroIntegrationLogger } from 'astro';
5
- import type { DBUserConfig } from './config.js';
6
- export type SqliteDB = SqliteRemoteDatabase;
7
- export type { Table } from './types.js';
8
- export { createRemoteDatabaseClient } from './utils-runtime.js';
9
- export declare function hasPrimaryKey(column: DBColumn): boolean;
10
- export declare function createLocalDatabaseClient({ collections, dbUrl, seeding, }: {
11
- dbUrl: string;
12
- collections: DBCollections;
13
- seeding: boolean;
14
- }): Promise<import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>>>;
15
- export declare function setupDbTables({ db, data, collections, logger, mode, }: {
16
- db: SqliteRemoteDatabase;
17
- data?: DBUserConfig['data'];
18
- collections: DBCollections;
19
- logger?: AstroIntegrationLogger;
20
- mode: 'dev' | 'build';
21
- }): Promise<void>;
22
- export declare function getCreateTableQuery(collectionName: string, collection: DBCollection): string;
23
- export declare function getTableIndexQueries(collectionName: string, collection: DBCollection): SQL<unknown>[];
24
- export declare function schemaTypeToSqlType(type: ColumnType): 'text' | 'integer';
25
- export declare function getModifiers(columnName: string, column: DBColumn): string;
26
- type WithDefaultDefined<T extends DBColumn> = T & Required<Pick<T, 'default'>>;
27
- type DBColumnWithDefault = WithDefaultDefined<TextColumn> | WithDefaultDefined<DateColumn> | WithDefaultDefined<NumberColumn> | WithDefaultDefined<BooleanColumn> | WithDefaultDefined<JsonColumn>;
28
- export declare function hasDefault(column: DBColumn): column is DBColumnWithDefault;
29
- export declare function collectionToTable(name: string, collection: DBCollection, isJsonSerializable?: boolean): import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
30
- name: string;
31
- schema: undefined;
32
- columns: {
33
- [x: string]: import("drizzle-orm/sqlite-core").SQLiteColumn<{
34
- name: string;
35
- tableName: string;
36
- dataType: ColumnDataType;
37
- columnType: string;
38
- data: unknown;
39
- driverParam: unknown;
40
- notNull: false;
41
- hasDefault: false;
42
- enumValues: string[] | undefined;
43
- baseColumn: never;
44
- }, object>;
45
- };
46
- dialect: "sqlite";
47
- }>;
@@ -1,6 +0,0 @@
1
- /**
2
- * Pulled from the mothership, Astro core ❤️
3
- *
4
- * @see https://github.com/withastro/astro/blob/main/packages/astro/src/core/config/config.ts#L121
5
- */
6
- export declare function loadAstroConfig(root: string): Promise<Record<string, unknown>>;
@@ -1,12 +0,0 @@
1
- import type { DBSnapshot } from './types.js';
2
- import type { AstroConfig } from 'astro';
3
- export declare function getMigrations(): Promise<string[]>;
4
- export declare function loadMigration(migration: string): Promise<{
5
- diff: any[];
6
- db: string[];
7
- }>;
8
- export declare function loadInitialSnapshot(): Promise<DBSnapshot>;
9
- export declare function initializeMigrationsDirectory(currentSnapshot: DBSnapshot): Promise<void>;
10
- export declare function initializeFromMigrations(allMigrationFiles: string[]): Promise<DBSnapshot>;
11
- export declare function createCurrentSnapshot(config: AstroConfig): DBSnapshot;
12
- export declare function createEmptySnapshot(): DBSnapshot;
package/dist/root.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { AstroConfig } from 'astro';
2
- export declare function findRoot(): URL;
3
- export declare function findLocalDatabase(localDbURL: string, output: AstroConfig['output']): string;
package/dist/typegen.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { DBCollections } from './types.js';
2
- export declare function typegen({ collections, root }: {
3
- collections: DBCollections;
4
- root: URL;
5
- }): Promise<void>;