vite-plugin-smart-prefetch 0.3.8 → 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.
package/dist/index.cjs CHANGED
@@ -40,19 +40,24 @@ var import_bigquery = require("@google-cloud/bigquery");
40
40
  var import_fs = require("fs");
41
41
  var import_path = require("path");
42
42
  var BigQueryAnalyticsConnector = class {
43
- constructor(projectId, datasetId, location = "asia-south1", debug = false) {
43
+ constructor(projectId, datasetId, location = "asia-south1", debug = false, keyFilePath) {
44
44
  this.projectId = projectId;
45
45
  this.datasetId = datasetId;
46
46
  this.location = location && location !== "asia" ? location : "asia-south1";
47
47
  this.debug = debug;
48
- this.bigquery = new import_bigquery.BigQuery({
48
+ const bigqueryConfig = {
49
49
  projectId
50
- });
50
+ };
51
+ if (keyFilePath) {
52
+ bigqueryConfig.keyFilename = keyFilePath;
53
+ }
54
+ this.bigquery = new import_bigquery.BigQuery(bigqueryConfig);
51
55
  if (this.debug) {
52
56
  console.log("\u2705 BigQuery Analytics connector initialized");
53
57
  console.log(` Project ID: ${projectId}`);
54
58
  console.log(` Dataset ID: ${datasetId}`);
55
59
  console.log(` Location: ${this.location}`);
60
+ console.log(` Authentication: ${keyFilePath ? `Service Account (${keyFilePath})` : "Application Default Credentials"}`);
56
61
  console.log(` Querying daily events tables: ${projectId}.${datasetId}.events_*`);
57
62
  }
58
63
  }
@@ -1481,7 +1486,8 @@ function smartPrefetch(options = {}) {
1481
1486
  analytics.credentials.projectId,
1482
1487
  analytics.credentials.datasetId,
1483
1488
  analytics.credentials.region || "asia-south1",
1484
- debug
1489
+ debug,
1490
+ analytics.credentials.keyFilePath
1485
1491
  );
1486
1492
  console.log("\n\u{1F3AF} Using real navigation data from BigQuery GA4 export...");
1487
1493
  const navigationData = await bqConnector.fetchNavigationSequences(analytics.dataRange);