@gscdump/engine-sqlite 2.0.1 → 2.0.3
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/r2-manifest-store.d.mts +5 -2
- package/dist/runner.d.mts +7 -5
- package/dist/runner.mjs +4 -3
- package/package.json +4 -4
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { r2Locks, r2Manifest, r2SyncStates, r2Watermarks } from "./r2-manifest-schema.mjs";
|
|
2
|
+
import { ExtractTablesWithRelations, Schema } from "drizzle-orm/relations";
|
|
2
3
|
import { ManifestStore } from "@gscdump/engine";
|
|
3
4
|
import { DrizzleD1Database } from "drizzle-orm/d1";
|
|
4
|
-
|
|
5
|
+
interface AnalyticsManifestSchema extends Schema {
|
|
5
6
|
r2Manifest: typeof r2Manifest;
|
|
6
7
|
r2Locks: typeof r2Locks;
|
|
7
8
|
r2SyncStates: typeof r2SyncStates;
|
|
8
9
|
r2Watermarks: typeof r2Watermarks;
|
|
9
|
-
}
|
|
10
|
+
}
|
|
11
|
+
type AnalyticsManifestRelations = ExtractTablesWithRelations<Record<string, never>, AnalyticsManifestSchema>;
|
|
12
|
+
type AnalyticsManifestDb = DrizzleD1Database<AnalyticsManifestRelations>;
|
|
10
13
|
declare function createD1ManifestStore(db: AnalyticsManifestDb): ManifestStore;
|
|
11
14
|
export { AnalyticsManifestDb, createD1ManifestStore };
|
package/dist/runner.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Schema } from "./schema.mjs";
|
|
1
|
+
import { Schema as Schema$1 } from "./schema.mjs";
|
|
2
2
|
import { SQL } from "drizzle-orm";
|
|
3
3
|
import { ScopedRunnerOptions, TableScope } from "@gscdump/engine/scope";
|
|
4
|
+
import { ExtractTablesWithRelations, Schema } from "drizzle-orm/relations";
|
|
4
5
|
import { SqliteRemoteDatabase } from "drizzle-orm/sqlite-proxy";
|
|
6
|
+
type SchemaRelations<TSchema extends Schema> = ExtractTablesWithRelations<Record<string, never>, TSchema>;
|
|
5
7
|
declare function compileSqlite(query: SQL): {
|
|
6
8
|
sql: string;
|
|
7
9
|
params: unknown[];
|
|
@@ -9,7 +11,7 @@ declare function compileSqlite(query: SQL): {
|
|
|
9
11
|
type SqliteRowExecutor = (sql: string, params: unknown[], method: 'run' | 'all' | 'values' | 'get') => Promise<{
|
|
10
12
|
rows: unknown[];
|
|
11
13
|
}>;
|
|
12
|
-
interface SqliteInsightRunnerOptions<TSchema extends
|
|
14
|
+
interface SqliteInsightRunnerOptions<TSchema extends Schema = Schema$1> {
|
|
13
15
|
executor: SqliteRowExecutor;
|
|
14
16
|
logger?: boolean;
|
|
15
17
|
/**
|
|
@@ -25,10 +27,10 @@ interface SqliteInsightRunnerOptions<TSchema extends Record<string, unknown> = S
|
|
|
25
27
|
*/
|
|
26
28
|
schema?: TSchema;
|
|
27
29
|
}
|
|
28
|
-
interface SqliteInsightRunner<TSchema extends
|
|
29
|
-
db: SqliteRemoteDatabase<TSchema
|
|
30
|
+
interface SqliteInsightRunner<TSchema extends Schema = Schema$1> {
|
|
31
|
+
db: SqliteRemoteDatabase<SchemaRelations<TSchema>>;
|
|
30
32
|
}
|
|
31
|
-
declare function createSqliteInsightRunner<TSchema extends
|
|
33
|
+
declare function createSqliteInsightRunner<TSchema extends Schema = Schema$1>(opts: SqliteInsightRunnerOptions<TSchema>): SqliteInsightRunner<TSchema>;
|
|
32
34
|
declare const scopeFor: (table: "gsc_pages" | "gsc_keywords" | "gsc_countries" | "gsc_devices" | "gsc_page_keywords" | "gsc_search_appearance" | "gsc_search_appearance_pages" | "gsc_search_appearance_queries" | "gsc_search_appearance_page_queries" | "gsc_hourly_pages" | "gsc_query_dim", opts: ScopedRunnerOptions) => TableScope;
|
|
33
35
|
declare const mergeScope: typeof import("@gscdump/engine/scope").mergeScope;
|
|
34
36
|
export { type ScopedRunnerOptions, SqliteInsightRunner, SqliteInsightRunnerOptions, SqliteRowExecutor, type TableScope, compileSqlite, createSqliteInsightRunner, mergeScope, scopeFor };
|
package/dist/runner.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { schema } from "./schema.mjs";
|
|
2
2
|
import { createScopedHelpers } from "@gscdump/engine/scope";
|
|
3
|
-
import {
|
|
3
|
+
import { buildRelations } from "drizzle-orm/relations";
|
|
4
|
+
import { SQLiteDialect } from "drizzle-orm/sqlite-core";
|
|
4
5
|
import { drizzle } from "drizzle-orm/sqlite-proxy";
|
|
5
|
-
const sqliteDialect = new
|
|
6
|
+
const sqliteDialect = new SQLiteDialect();
|
|
6
7
|
function compileSqlite(query) {
|
|
7
8
|
const compiled = sqliteDialect.sqlToQuery(query);
|
|
8
9
|
return {
|
|
@@ -22,7 +23,7 @@ function createSqliteInsightRunner(opts) {
|
|
|
22
23
|
}) };
|
|
23
24
|
};
|
|
24
25
|
return { db: drizzle(callback, {
|
|
25
|
-
|
|
26
|
+
relations: buildRelations(schemaOverride ?? schema, {}),
|
|
26
27
|
logger
|
|
27
28
|
}) };
|
|
28
29
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine-sqlite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"description": "SQLite / D1 engine adapter for @gscdump/analysis — typed analytics over sqlite-proxy executors (Cloudflare D1, libsql).",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"node": ">=22"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"drizzle-orm": "1.0.0-rc.
|
|
44
|
+
"drizzle-orm": "1.0.0-rc.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@gscdump/engine": "^2.0.
|
|
47
|
+
"@gscdump/engine": "^2.0.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"drizzle-orm": "1.0.0-rc.
|
|
50
|
+
"drizzle-orm": "1.0.0-rc.4",
|
|
51
51
|
"vitest": "^4.1.10"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|