@@ -44,31 +44,9 @@ import { initializeLatestView } from "./initializeLatestView";
4444import { logger , LogLevel } from "../logger" ;
4545
4646export { RawChangelogSchema , RawChangelogViewSchema } from "./schema" ;
47-
48- export interface FirestoreBigQueryEventHistoryTrackerConfig {
49- datasetId : string ;
50- tableId : string ;
51- firestoreInstanceId ?: string ;
52- datasetLocation ?: string | undefined ;
53- transformFunction ?: string | undefined ;
54- timePartitioning ?: string | undefined ;
55- timePartitioningField ?: string | undefined ;
56- timePartitioningFieldType ?: string | undefined ;
57- timePartitioningFirestoreField ?: string | undefined ;
58- clustering : string [ ] | null ;
59- databaseId ?: string | undefined ;
60- wildcardIds ?: boolean ;
61- bqProjectId ?: string | undefined ;
62- backupTableId ?: string | undefined ;
63- useNewSnapshotQuerySyntax ?: boolean ;
64- skipInit ?: boolean ;
65- kmsKeyName ?: string | undefined ;
66- useMaterializedView ?: boolean ;
67- useIncrementalMaterializedView ?: boolean ;
68- maxStaleness ?: string ;
69- refreshIntervalMinutes ?: number ;
70- logLevel ?: LogLevel | string ;
71- }
47+ import type { Config } from "./types" ;
48+ import { PartitioningConfig } from "./partitioning/config" ;
49+ export type { Config } from "./types" ;
7250
7351/**
7452 * An FirestoreEventHistoryTracker that exports data to BigQuery.
@@ -85,12 +63,15 @@ export class FirestoreBigQueryEventHistoryTracker
8563{
8664 bq : bigquery . BigQuery ;
8765 _initialized : boolean = false ;
66+ partitioningConfig : PartitioningConfig ;
8867
89- constructor ( public config : FirestoreBigQueryEventHistoryTrackerConfig ) {
68+ constructor ( public config : Config ) {
9069 this . bq = new bigquery . BigQuery ( ) ;
9170
9271 this . bq . projectId = config . bqProjectId || process . env . PROJECT_ID ;
9372
73+ this . partitioningConfig = new PartitioningConfig ( this . config . partitioning ) ;
74+
9475 if ( ! this . config . datasetLocation ) {
9576 this . config . datasetLocation = "us" ;
9677 }
@@ -106,7 +87,7 @@ export class FirestoreBigQueryEventHistoryTracker
10687 await this . initialize ( ) ;
10788 }
10889
109- const partitionHandler = new Partitioning ( this . config ) ;
90+ const partitionHandler = new Partitioning ( this . partitioningConfig ) ;
11091
11192 const rows = events . map ( ( event ) => {
11293 const partitionValue = partitionHandler . getPartitionValue ( event ) ;
@@ -348,7 +329,7 @@ export class FirestoreBigQueryEventHistoryTracker
348329 const dataset = this . bigqueryDataset ( ) ;
349330 const table = dataset . table ( changelogName ) ;
350331 const [ tableExists ] = await table . exists ( ) ;
351- const partitioning = new Partitioning ( this . config , table ) ;
332+ const partitioning = new Partitioning ( this . partitioningConfig , table ) ;
352333 const clustering = new Clustering ( this . config , table ) ;
353334
354335 if ( tableExists ) {
0 commit comments