@gscdump/engine-sqlite 1.4.0 → 1.4.1
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/index.d.mts +8 -4402
- package/dist/index.mjs +8 -561
- package/dist/metrics.d.mts +8 -0
- package/dist/metrics.mjs +14 -0
- package/dist/query-source.d.mts +11 -0
- package/dist/query-source.mjs +15 -0
- package/dist/r2-manifest-schema.d.mts +775 -0
- package/dist/r2-manifest-schema.mjs +81 -0
- package/dist/r2-manifest-store.d.mts +11 -0
- package/dist/r2-manifest-store.mjs +282 -0
- package/dist/resolver-adapter.d.mts +27 -0
- package/dist/resolver-adapter.mjs +41 -0
- package/dist/runner.d.mts +42 -0
- package/dist/runner.mjs +30 -0
- package/dist/schema.d.mts +3542 -0
- package/dist/schema.mjs +112 -0
- package/package.json +2 -2
package/dist/schema.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { index, integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
3
|
+
function metricCols() {
|
|
4
|
+
return {
|
|
5
|
+
clicks: integer("clicks").notNull().default(0),
|
|
6
|
+
impressions: integer("impressions").notNull().default(0),
|
|
7
|
+
ctr: real("ctr").notNull().default(0),
|
|
8
|
+
position: real("position").notNull().default(0),
|
|
9
|
+
sum_position: real("sum_position").notNull().default(0)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function baseCols() {
|
|
13
|
+
return {
|
|
14
|
+
id: text("id").primaryKey(),
|
|
15
|
+
site_id: text("site_id").notNull(),
|
|
16
|
+
date: text("date").notNull(),
|
|
17
|
+
created_at: integer("created_at").default(sql`(unixepoch())`)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const gsc_pages = sqliteTable("gsc_pages", {
|
|
21
|
+
...baseCols(),
|
|
22
|
+
url: text("url").notNull(),
|
|
23
|
+
...metricCols()
|
|
24
|
+
}, (t) => [index("idx_gsc_pages_site_date").on(t.site_id, t.date)]);
|
|
25
|
+
const gsc_keywords = sqliteTable("gsc_keywords", {
|
|
26
|
+
...baseCols(),
|
|
27
|
+
query: text("query").notNull(),
|
|
28
|
+
...metricCols()
|
|
29
|
+
}, (t) => [index("idx_gsc_keywords_site_date").on(t.site_id, t.date)]);
|
|
30
|
+
const gsc_countries = sqliteTable("gsc_countries", {
|
|
31
|
+
...baseCols(),
|
|
32
|
+
country: text("country").notNull(),
|
|
33
|
+
...metricCols()
|
|
34
|
+
}, (t) => [index("idx_gsc_countries_site_date").on(t.site_id, t.date)]);
|
|
35
|
+
const gsc_devices = sqliteTable("gsc_devices", {
|
|
36
|
+
...baseCols(),
|
|
37
|
+
device: text("device").notNull(),
|
|
38
|
+
...metricCols()
|
|
39
|
+
}, (t) => [index("idx_gsc_devices_site_date").on(t.site_id, t.date)]);
|
|
40
|
+
const gsc_page_keywords = sqliteTable("gsc_page_keywords", {
|
|
41
|
+
...baseCols(),
|
|
42
|
+
url: text("url").notNull(),
|
|
43
|
+
query: text("query").notNull(),
|
|
44
|
+
...metricCols()
|
|
45
|
+
}, (t) => [index("idx_gsc_page_keywords_site_date").on(t.site_id, t.date)]);
|
|
46
|
+
const gsc_search_appearance = sqliteTable("gsc_search_appearance", {
|
|
47
|
+
...baseCols(),
|
|
48
|
+
searchAppearance: text("searchAppearance").notNull(),
|
|
49
|
+
...metricCols()
|
|
50
|
+
}, (t) => [index("idx_gsc_search_appearance_site_date").on(t.site_id, t.date)]);
|
|
51
|
+
const gsc_search_appearance_pages = sqliteTable("gsc_search_appearance_pages", {
|
|
52
|
+
...baseCols(),
|
|
53
|
+
searchAppearance: text("searchAppearance").notNull(),
|
|
54
|
+
url: text("url").notNull(),
|
|
55
|
+
...metricCols()
|
|
56
|
+
}, (t) => [index("idx_gsc_search_appearance_pages_site_date").on(t.site_id, t.date)]);
|
|
57
|
+
const gsc_search_appearance_queries = sqliteTable("gsc_search_appearance_queries", {
|
|
58
|
+
...baseCols(),
|
|
59
|
+
searchAppearance: text("searchAppearance").notNull(),
|
|
60
|
+
query: text("query").notNull(),
|
|
61
|
+
...metricCols()
|
|
62
|
+
}, (t) => [index("idx_gsc_search_appearance_queries_site_date").on(t.site_id, t.date)]);
|
|
63
|
+
const gsc_search_appearance_page_queries = sqliteTable("gsc_search_appearance_page_queries", {
|
|
64
|
+
...baseCols(),
|
|
65
|
+
searchAppearance: text("searchAppearance").notNull(),
|
|
66
|
+
url: text("url").notNull(),
|
|
67
|
+
query: text("query").notNull(),
|
|
68
|
+
...metricCols()
|
|
69
|
+
}, (t) => [index("idx_gsc_search_appearance_page_queries_site_date").on(t.site_id, t.date)]);
|
|
70
|
+
const gsc_query_dim = sqliteTable("gsc_query_dim", {
|
|
71
|
+
site_id: text("site_id").notNull(),
|
|
72
|
+
query: text("query").notNull(),
|
|
73
|
+
query_canonical: text("query_canonical").notNull(),
|
|
74
|
+
normalizer_version: integer("normalizer_version").notNull(),
|
|
75
|
+
intent_code: integer("intent_code"),
|
|
76
|
+
intent_version: integer("intent_version"),
|
|
77
|
+
built_at: integer("built_at")
|
|
78
|
+
}, (t) => [index("idx_gsc_query_dim_site_query").on(t.site_id, t.query)]);
|
|
79
|
+
const gsc_hourly_pages = sqliteTable("gsc_hourly_pages", {
|
|
80
|
+
...baseCols(),
|
|
81
|
+
url: text("url").notNull(),
|
|
82
|
+
hour: integer("hour").notNull(),
|
|
83
|
+
...metricCols()
|
|
84
|
+
}, (t) => [index("idx_gsc_hourly_pages_site_date").on(t.site_id, t.date)]);
|
|
85
|
+
const schema = {
|
|
86
|
+
gsc_pages,
|
|
87
|
+
gsc_keywords,
|
|
88
|
+
gsc_countries,
|
|
89
|
+
gsc_devices,
|
|
90
|
+
gsc_page_keywords,
|
|
91
|
+
gsc_search_appearance,
|
|
92
|
+
gsc_search_appearance_pages,
|
|
93
|
+
gsc_search_appearance_queries,
|
|
94
|
+
gsc_search_appearance_page_queries,
|
|
95
|
+
gsc_hourly_pages,
|
|
96
|
+
gsc_query_dim
|
|
97
|
+
};
|
|
98
|
+
const GSC_TABLE_TO_LOGICAL = {
|
|
99
|
+
gsc_pages: "pages",
|
|
100
|
+
gsc_keywords: "queries",
|
|
101
|
+
gsc_countries: "countries",
|
|
102
|
+
gsc_devices: null,
|
|
103
|
+
gsc_page_keywords: "page_queries",
|
|
104
|
+
gsc_search_appearance: "search_appearance",
|
|
105
|
+
gsc_search_appearance_pages: "search_appearance_pages",
|
|
106
|
+
gsc_search_appearance_queries: "search_appearance_queries",
|
|
107
|
+
gsc_search_appearance_page_queries: "search_appearance_page_queries",
|
|
108
|
+
gsc_hourly_pages: "hourly_pages",
|
|
109
|
+
gsc_query_dim: null
|
|
110
|
+
};
|
|
111
|
+
Object.fromEntries(Object.entries(schema).filter(([k]) => GSC_TABLE_TO_LOGICAL[k] !== null));
|
|
112
|
+
export { gsc_countries, gsc_devices, gsc_hourly_pages, gsc_keywords, gsc_page_keywords, gsc_pages, gsc_query_dim, gsc_search_appearance, gsc_search_appearance_page_queries, gsc_search_appearance_pages, gsc_search_appearance_queries, schema };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine-sqlite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.1",
|
|
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",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"drizzle-orm": "1.0.0-rc.3"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@gscdump/engine": "^1.4.
|
|
42
|
+
"@gscdump/engine": "^1.4.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"drizzle-orm": "1.0.0-rc.3",
|