@astrojs/db 0.11.7 → 0.12.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.
- package/dist/_internal/core/types.d.ts +12 -11
- package/dist/_internal/core/utils.d.ts +2 -2
- package/dist/core/cli/print-help.js +1 -1
- package/dist/core/load-file.d.ts +1 -0
- package/dist/core/load-file.js +1 -3
- package/dist/core/types.d.ts +12 -11
- package/dist/core/utils.d.ts +2 -2
- package/dist/core/utils.js +1 -0
- package/package.json +5 -5
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AstroIntegration } from 'astro';
|
|
2
1
|
import type { z } from 'zod';
|
|
3
2
|
import type { MaybeArray, booleanColumnSchema, columnSchema, columnsSchema, dateColumnSchema, dbConfigSchema, indexSchema, jsonColumnSchema, numberColumnOptsSchema, numberColumnSchema, referenceableColumnSchema, resolvedIndexSchema, tableSchema, textColumnOptsSchema, textColumnSchema } from './schemas.js';
|
|
4
3
|
export type ResolvedIndexes = z.output<typeof dbConfigSchema>['tables'][string]['indexes'];
|
|
@@ -46,14 +45,16 @@ interface LegacyIndexConfig<TColumns extends ColumnsConfig> extends z.input<type
|
|
|
46
45
|
}
|
|
47
46
|
export type NumberColumnOpts = z.input<typeof numberColumnOptsSchema>;
|
|
48
47
|
export type TextColumnOpts = z.input<typeof textColumnOptsSchema>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
48
|
+
declare global {
|
|
49
|
+
namespace Astro {
|
|
50
|
+
interface IntegrationHooks {
|
|
51
|
+
'astro:db:setup'?: (options: {
|
|
52
|
+
extendDb: (options: {
|
|
53
|
+
configEntrypoint?: URL | string;
|
|
54
|
+
seedEntrypoint?: URL | string;
|
|
55
|
+
}) => void;
|
|
56
|
+
}) => void | Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
59
60
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AstroConfig, AstroIntegration } from 'astro';
|
|
2
|
-
import
|
|
2
|
+
import './types.js';
|
|
3
3
|
export type VitePlugin = Required<AstroConfig['vite']>['plugins'][number];
|
|
4
4
|
export declare function getAstroEnv(envMode?: string): Record<`ASTRO_${string}`, string>;
|
|
5
5
|
export declare function getRemoteDatabaseUrl(): string;
|
|
6
6
|
export declare function getDbDirectoryUrl(root: URL | string): URL;
|
|
7
|
-
export declare function defineDbIntegration(integration:
|
|
7
|
+
export declare function defineDbIntegration(integration: AstroIntegration): AstroIntegration;
|
|
8
8
|
export type Result<T> = {
|
|
9
9
|
success: true;
|
|
10
10
|
data: T;
|
package/dist/core/load-file.d.ts
CHANGED
package/dist/core/load-file.js
CHANGED
|
@@ -8,9 +8,8 @@ import { INTEGRATION_TABLE_CONFLICT_ERROR } from "./errors.js";
|
|
|
8
8
|
import { errorMap } from "./integration/error-map.js";
|
|
9
9
|
import { getConfigVirtualModContents } from "./integration/vite-plugin-db.js";
|
|
10
10
|
import { dbConfigSchema } from "./schemas.js";
|
|
11
|
-
import
|
|
11
|
+
import "./types.js";
|
|
12
12
|
import { getAstroEnv, getDbDirectoryUrl } from "./utils.js";
|
|
13
|
-
const isDbIntegration = (integration) => "astro:db:setup" in integration.hooks;
|
|
14
13
|
async function resolveDbConfig({
|
|
15
14
|
root,
|
|
16
15
|
integrations
|
|
@@ -21,7 +20,6 @@ async function resolveDbConfig({
|
|
|
21
20
|
const integrationDbConfigPaths = [];
|
|
22
21
|
const integrationSeedPaths = [];
|
|
23
22
|
for (const integration of integrations) {
|
|
24
|
-
if (!isDbIntegration(integration)) continue;
|
|
25
23
|
const { name, hooks } = integration;
|
|
26
24
|
if (hooks["astro:db:setup"]) {
|
|
27
25
|
hooks["astro:db:setup"]({
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AstroIntegration } from 'astro';
|
|
2
1
|
import type { z } from 'zod';
|
|
3
2
|
import type { MaybeArray, booleanColumnSchema, columnSchema, columnsSchema, dateColumnSchema, dbConfigSchema, indexSchema, jsonColumnSchema, numberColumnOptsSchema, numberColumnSchema, referenceableColumnSchema, resolvedIndexSchema, tableSchema, textColumnOptsSchema, textColumnSchema } from './schemas.js';
|
|
4
3
|
export type ResolvedIndexes = z.output<typeof dbConfigSchema>['tables'][string]['indexes'];
|
|
@@ -46,14 +45,16 @@ interface LegacyIndexConfig<TColumns extends ColumnsConfig> extends z.input<type
|
|
|
46
45
|
}
|
|
47
46
|
export type NumberColumnOpts = z.input<typeof numberColumnOptsSchema>;
|
|
48
47
|
export type TextColumnOpts = z.input<typeof textColumnOptsSchema>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
48
|
+
declare global {
|
|
49
|
+
namespace Astro {
|
|
50
|
+
interface IntegrationHooks {
|
|
51
|
+
'astro:db:setup'?: (options: {
|
|
52
|
+
extendDb: (options: {
|
|
53
|
+
configEntrypoint?: URL | string;
|
|
54
|
+
seedEntrypoint?: URL | string;
|
|
55
|
+
}) => void;
|
|
56
|
+
}) => void | Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
59
60
|
export {};
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AstroConfig, AstroIntegration } from 'astro';
|
|
2
|
-
import
|
|
2
|
+
import './types.js';
|
|
3
3
|
export type VitePlugin = Required<AstroConfig['vite']>['plugins'][number];
|
|
4
4
|
export declare function getAstroEnv(envMode?: string): Record<`ASTRO_${string}`, string>;
|
|
5
5
|
export declare function getRemoteDatabaseUrl(): string;
|
|
6
6
|
export declare function getDbDirectoryUrl(root: URL | string): URL;
|
|
7
|
-
export declare function defineDbIntegration(integration:
|
|
7
|
+
export declare function defineDbIntegration(integration: AstroIntegration): AstroIntegration;
|
|
8
8
|
export type Result<T> = {
|
|
9
9
|
success: true;
|
|
10
10
|
data: T;
|
package/dist/core/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Add libSQL and Astro Studio support to your Astro site",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"astro-integration"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@libsql/client": "^0.
|
|
65
|
+
"@libsql/client": "^0.7.0",
|
|
66
66
|
"async-listen": "^3.0.1",
|
|
67
67
|
"ci-info": "^4.0.0",
|
|
68
68
|
"deep-diff": "^1.0.2",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"@types/prompts": "^2.4.9",
|
|
86
86
|
"@types/yargs-parser": "^21.0.3",
|
|
87
87
|
"cheerio": "1.0.0-rc.12",
|
|
88
|
-
"typescript": "^5.5.
|
|
89
|
-
"vite": "^5.3.
|
|
90
|
-
"astro": "4.
|
|
88
|
+
"typescript": "^5.5.3",
|
|
89
|
+
"vite": "^5.3.4",
|
|
90
|
+
"astro": "4.12.0",
|
|
91
91
|
"astro-scripts": "0.0.14"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|