vite-plugin-smart-prefetch 0.3.2 → 0.3.4
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.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +1 -13
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1 -13
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/index.cjs +1 -13
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +1 -13
- package/dist/runtime/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -37,6 +37,8 @@ interface BigQueryCredentials {
|
|
|
37
37
|
projectId: string;
|
|
38
38
|
/** BigQuery dataset ID (usually analytics_XXXXXXXX) */
|
|
39
39
|
datasetId: string;
|
|
40
|
+
/** BigQuery dataset region (default: asia-south1 for Mumbai, also supports: US, EU, etc.) */
|
|
41
|
+
region?: string;
|
|
40
42
|
}
|
|
41
43
|
interface DataRangeConfig {
|
|
42
44
|
/** Number of days to analyze (default: 30) */
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ interface BigQueryCredentials {
|
|
|
37
37
|
projectId: string;
|
|
38
38
|
/** BigQuery dataset ID (usually analytics_XXXXXXXX) */
|
|
39
39
|
datasetId: string;
|
|
40
|
+
/** BigQuery dataset region (default: asia-south1 for Mumbai, also supports: US, EU, etc.) */
|
|
41
|
+
region?: string;
|
|
40
42
|
}
|
|
41
43
|
interface DataRangeConfig {
|
|
42
44
|
/** Number of days to analyze (default: 30) */
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import { BigQuery } from "@google-cloud/bigquery";
|
|
|
3
3
|
import { writeFileSync, mkdirSync } from "fs";
|
|
4
4
|
import { join } from "path";
|
|
5
5
|
var BigQueryAnalyticsConnector = class {
|
|
6
|
-
constructor(projectId, datasetId, debug = false) {
|
|
6
|
+
constructor(projectId, datasetId, location = "asia-south1", debug = false) {
|
|
7
7
|
this.projectId = projectId;
|
|
8
8
|
this.datasetId = datasetId;
|
|
9
|
+
this.location = location;
|
|
9
10
|
this.debug = debug;
|
|
10
11
|
this.bigquery = new BigQuery({
|
|
11
12
|
projectId
|
|
@@ -14,6 +15,7 @@ var BigQueryAnalyticsConnector = class {
|
|
|
14
15
|
console.log("\u2705 BigQuery Analytics connector initialized");
|
|
15
16
|
console.log(` Project ID: ${projectId}`);
|
|
16
17
|
console.log(` Dataset ID: ${datasetId}`);
|
|
18
|
+
console.log(` Location: ${location}`);
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
@@ -72,7 +74,7 @@ var BigQueryAnalyticsConnector = class {
|
|
|
72
74
|
}
|
|
73
75
|
const [rows] = await this.bigquery.query({
|
|
74
76
|
query,
|
|
75
|
-
location:
|
|
77
|
+
location: this.location
|
|
76
78
|
});
|
|
77
79
|
if (this.debug) {
|
|
78
80
|
console.log(`\u2705 Query executed successfully`);
|
|
@@ -325,7 +327,7 @@ var BigQueryAnalyticsConnector = class {
|
|
|
325
327
|
}
|
|
326
328
|
const [rows] = await this.bigquery.query({
|
|
327
329
|
query,
|
|
328
|
-
location:
|
|
330
|
+
location: this.location
|
|
329
331
|
});
|
|
330
332
|
if (this.debug) {
|
|
331
333
|
console.log(`\u2705 Query executed successfully`);
|
|
@@ -386,7 +388,7 @@ var BigQueryAnalyticsConnector = class {
|
|
|
386
388
|
const query = `SELECT 1 as test_value`;
|
|
387
389
|
await this.bigquery.query({
|
|
388
390
|
query,
|
|
389
|
-
location:
|
|
391
|
+
location: this.location
|
|
390
392
|
});
|
|
391
393
|
if (this.debug) {
|
|
392
394
|
console.log("\u2705 BigQuery connection test successful");
|
|
@@ -1543,6 +1545,7 @@ function smartPrefetch(options = {}) {
|
|
|
1543
1545
|
const bqConnector = new BigQueryAnalyticsConnector(
|
|
1544
1546
|
analytics.credentials.projectId,
|
|
1545
1547
|
analytics.credentials.datasetId,
|
|
1548
|
+
analytics.credentials.region || "asia-south1",
|
|
1546
1549
|
debug
|
|
1547
1550
|
);
|
|
1548
1551
|
console.log("\n\u{1F3AF} Using real navigation data from BigQuery GA4 export...");
|