@gscdump/lakehouse 0.1.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/THIRD-PARTY-LICENSES.md +474 -0
- package/dist/_chunks/catalog.d.mts +236 -0
- package/dist/_chunks/catalog.mjs +331 -0
- package/dist/_chunks/libs/@netlify/blobs.d.mts +6 -0
- package/dist/_chunks/libs/chokidar.d.mts +1 -0
- package/dist/_chunks/libs/db0.d.mts +1 -0
- package/dist/_chunks/libs/denque.d.mts +1 -0
- package/dist/_chunks/libs/fzstd.mjs +545 -0
- package/dist/_chunks/libs/hyparquet-compressors.mjs +2796 -0
- package/dist/_chunks/libs/hyparquet-writer.mjs +2516 -0
- package/dist/_chunks/libs/hyparquet.d.mts +10 -0
- package/dist/_chunks/libs/hyparquet.mjs +460 -0
- package/dist/_chunks/libs/icebird.d.mts +549 -0
- package/dist/_chunks/libs/icebird.mjs +3723 -0
- package/dist/_chunks/libs/ioredis.d.mts +1 -0
- package/dist/_chunks/libs/lru-cache.d.mts +1 -0
- package/dist/_chunks/libs/unstorage.d.mts +120 -0
- package/dist/_chunks/schema.d.mts +74 -0
- package/dist/index.d.mts +159 -0
- package/dist/index.mjs +356 -0
- package/dist/provisioning/index.d.mts +124 -0
- package/dist/provisioning/index.mjs +141 -0
- package/dist/unsafe-raw.d.mts +3 -0
- package/dist/unsafe-raw.mjs +3 -0
- package/dist/vendor/hysnappy-purejs.d.mts +29 -0
- package/dist/vendor/hysnappy-purejs.mjs +2 -0
- package/package.json +61 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
type StorageValue = null | string | number | boolean | object;
|
|
2
|
+
type WatchEvent = "update" | "remove";
|
|
3
|
+
type WatchCallback = (event: WatchEvent, key: string) => any;
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
type MaybeDefined<T> = T extends any ? T : any;
|
|
6
|
+
type Unwatch = () => MaybePromise<void>;
|
|
7
|
+
interface StorageMeta {
|
|
8
|
+
atime?: Date;
|
|
9
|
+
mtime?: Date;
|
|
10
|
+
ttl?: number;
|
|
11
|
+
[key: string]: StorageValue | Date | undefined;
|
|
12
|
+
}
|
|
13
|
+
type TransactionOptions = Record<string, any>;
|
|
14
|
+
type GetKeysOptions = TransactionOptions & {
|
|
15
|
+
maxDepth?: number;
|
|
16
|
+
};
|
|
17
|
+
interface DriverFlags {
|
|
18
|
+
maxDepth?: boolean;
|
|
19
|
+
ttl?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface Driver<OptionsT = any, InstanceT = any> {
|
|
22
|
+
name?: string;
|
|
23
|
+
flags?: DriverFlags;
|
|
24
|
+
options?: OptionsT;
|
|
25
|
+
getInstance?: () => InstanceT;
|
|
26
|
+
hasItem: (key: string, opts: TransactionOptions) => MaybePromise<boolean>;
|
|
27
|
+
getItem: (key: string, opts?: TransactionOptions) => MaybePromise<StorageValue>;
|
|
28
|
+
/** @experimental */
|
|
29
|
+
getItems?: (items: {
|
|
30
|
+
key: string;
|
|
31
|
+
options?: TransactionOptions;
|
|
32
|
+
}[], commonOptions?: TransactionOptions) => MaybePromise<{
|
|
33
|
+
key: string;
|
|
34
|
+
value: StorageValue;
|
|
35
|
+
}[]>;
|
|
36
|
+
/** @experimental */
|
|
37
|
+
getItemRaw?: (key: string, opts: TransactionOptions) => MaybePromise<unknown>;
|
|
38
|
+
setItem?: (key: string, value: string, opts: TransactionOptions) => MaybePromise<void>;
|
|
39
|
+
/** @experimental */
|
|
40
|
+
setItems?: (items: {
|
|
41
|
+
key: string;
|
|
42
|
+
value: string;
|
|
43
|
+
options?: TransactionOptions;
|
|
44
|
+
}[], commonOptions?: TransactionOptions) => MaybePromise<void>;
|
|
45
|
+
/** @experimental */
|
|
46
|
+
setItemRaw?: (key: string, value: any, opts: TransactionOptions) => MaybePromise<void>;
|
|
47
|
+
removeItem?: (key: string, opts: TransactionOptions) => MaybePromise<void>;
|
|
48
|
+
getMeta?: (key: string, opts: TransactionOptions) => MaybePromise<StorageMeta | null>;
|
|
49
|
+
getKeys: (base: string, opts: GetKeysOptions) => MaybePromise<string[]>;
|
|
50
|
+
clear?: (base: string, opts: TransactionOptions) => MaybePromise<void>;
|
|
51
|
+
dispose?: () => MaybePromise<void>;
|
|
52
|
+
watch?: (callback: WatchCallback) => MaybePromise<Unwatch>;
|
|
53
|
+
}
|
|
54
|
+
type StorageDefinition = {
|
|
55
|
+
items: unknown;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
};
|
|
58
|
+
type StorageItemMap<T> = T extends StorageDefinition ? T["items"] : T;
|
|
59
|
+
type StorageItemType<T, K> = K extends keyof StorageItemMap<T> ? StorageItemMap<T>[K] : T extends StorageDefinition ? StorageValue : T;
|
|
60
|
+
interface Storage$1<T extends StorageValue = StorageValue> {
|
|
61
|
+
hasItem<U extends Extract<T, StorageDefinition>, K extends keyof StorageItemMap<U>>(key: K, opts?: TransactionOptions): Promise<boolean>;
|
|
62
|
+
hasItem(key: string, opts?: TransactionOptions): Promise<boolean>;
|
|
63
|
+
getItem<U extends Extract<T, StorageDefinition>, K extends string & keyof StorageItemMap<U>>(key: K, ops?: TransactionOptions): Promise<StorageItemType<T, K> | null>;
|
|
64
|
+
getItem<R = StorageItemType<T, string>>(key: string, opts?: TransactionOptions): Promise<R | null>;
|
|
65
|
+
/** @experimental */
|
|
66
|
+
getItems: <U extends T>(items: (string | {
|
|
67
|
+
key: string;
|
|
68
|
+
options?: TransactionOptions;
|
|
69
|
+
})[], commonOptions?: TransactionOptions) => Promise<{
|
|
70
|
+
key: string;
|
|
71
|
+
value: U;
|
|
72
|
+
}[]>;
|
|
73
|
+
/** @experimental See https://github.com/unjs/unstorage/issues/142 */
|
|
74
|
+
getItemRaw: <T = any>(key: string, opts?: TransactionOptions) => Promise<MaybeDefined<T> | null>;
|
|
75
|
+
setItem<U extends Extract<T, StorageDefinition>, K extends keyof StorageItemMap<U>>(key: K, value: StorageItemType<T, K>, opts?: TransactionOptions): Promise<void>;
|
|
76
|
+
setItem<U extends T>(key: string, value: U, opts?: TransactionOptions): Promise<void>;
|
|
77
|
+
/** @experimental */
|
|
78
|
+
setItems: <U extends T>(items: {
|
|
79
|
+
key: string;
|
|
80
|
+
value: U;
|
|
81
|
+
options?: TransactionOptions;
|
|
82
|
+
}[], commonOptions?: TransactionOptions) => Promise<void>;
|
|
83
|
+
/** @experimental See https://github.com/unjs/unstorage/issues/142 */
|
|
84
|
+
setItemRaw: <T = any>(key: string, value: MaybeDefined<T>, opts?: TransactionOptions) => Promise<void>;
|
|
85
|
+
removeItem<U extends Extract<T, StorageDefinition>, K extends keyof StorageItemMap<U>>(key: K, opts?: (TransactionOptions & {
|
|
86
|
+
removeMeta?: boolean;
|
|
87
|
+
}) | boolean): Promise<void>;
|
|
88
|
+
removeItem(key: string, opts?: (TransactionOptions & {
|
|
89
|
+
removeMeta?: boolean;
|
|
90
|
+
}) | boolean): Promise<void>;
|
|
91
|
+
getMeta: (key: string, opts?: (TransactionOptions & {
|
|
92
|
+
nativeOnly?: boolean;
|
|
93
|
+
}) | boolean) => MaybePromise<StorageMeta>;
|
|
94
|
+
setMeta: (key: string, value: StorageMeta, opts?: TransactionOptions) => Promise<void>;
|
|
95
|
+
removeMeta: (key: string, opts?: TransactionOptions) => Promise<void>;
|
|
96
|
+
getKeys: (base?: string, opts?: GetKeysOptions) => Promise<string[]>;
|
|
97
|
+
clear: (base?: string, opts?: TransactionOptions) => Promise<void>;
|
|
98
|
+
dispose: () => Promise<void>;
|
|
99
|
+
watch: (callback: WatchCallback) => Promise<Unwatch>;
|
|
100
|
+
unwatch: () => Promise<void>;
|
|
101
|
+
mount: (base: string, driver: Driver) => Storage$1;
|
|
102
|
+
unmount: (base: string, dispose?: boolean) => Promise<void>;
|
|
103
|
+
getMount: (key?: string) => {
|
|
104
|
+
base: string;
|
|
105
|
+
driver: Driver;
|
|
106
|
+
};
|
|
107
|
+
getMounts: (base?: string, options?: {
|
|
108
|
+
parents?: boolean;
|
|
109
|
+
}) => {
|
|
110
|
+
base: string;
|
|
111
|
+
driver: Driver;
|
|
112
|
+
}[];
|
|
113
|
+
keys: Storage$1["getKeys"];
|
|
114
|
+
get: Storage$1<T>["getItem"];
|
|
115
|
+
set: Storage$1<T>["setItem"];
|
|
116
|
+
has: Storage$1<T>["hasItem"];
|
|
117
|
+
del: Storage$1<T>["removeItem"];
|
|
118
|
+
remove: Storage$1<T>["removeItem"];
|
|
119
|
+
}
|
|
120
|
+
export { Storage$1 as Storage };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Iceberg schema/partition/identity type shapes — the dataset-agnostic
|
|
3
|
+
* half of `@gscdump/engine/iceberg/schema.ts` (ADR-0021, split per amendment 8).
|
|
4
|
+
*
|
|
5
|
+
* TYPES + PURE HELPERS ONLY. The GSC-specific frozen constants
|
|
6
|
+
* (`IcebergTableName`, `ICEBERG_TABLES`, `ICEBERG_SCHEMAS`, `SEARCH_TYPE_INT`,
|
|
7
|
+
* `ICEBERG_PARTITION_SPEC`) stay in the engine's own registry instance — they
|
|
8
|
+
* describe ONE dataset (`gsc.*`), not the mechanism.
|
|
9
|
+
*/
|
|
10
|
+
/** S3-compatible credentials for the Iceberg warehouse object store (R2 in prod). */
|
|
11
|
+
interface IcebergS3Config {
|
|
12
|
+
/** S3 endpoint host (prod: the R2 S3 endpoint). */
|
|
13
|
+
endpoint: string;
|
|
14
|
+
accessKeyId: string;
|
|
15
|
+
secretAccessKey: string;
|
|
16
|
+
/** Defaults to `'auto'` (R2's region). */
|
|
17
|
+
region?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Iceberg-native column type. */
|
|
20
|
+
type IcebergColumnType = 'STRING' | 'INT' | 'LONG' | 'DOUBLE' | 'DATE' | 'BOOLEAN';
|
|
21
|
+
interface IcebergColumn {
|
|
22
|
+
/** Column name as written into the Iceberg table (snake_case). */
|
|
23
|
+
name: string;
|
|
24
|
+
type: IcebergColumnType;
|
|
25
|
+
/** Iceberg field nullability. Partition identity columns are never null. */
|
|
26
|
+
required: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Stable Iceberg field id. Field ids — not names — are the schema-evolution
|
|
29
|
+
* identity in Iceberg; never reuse or renumber an id once a table is live.
|
|
30
|
+
*/
|
|
31
|
+
fieldId: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Partition-key encoding for identity columns.
|
|
35
|
+
*
|
|
36
|
+
* - `'string'` (legacy): identity columns are STRING. Correct, but R2 SQL's
|
|
37
|
+
* string min/max statistics are truncated in predicate pushdown, so a bare
|
|
38
|
+
* `WHERE site_id='<uuid>'` UNDERCOUNTS.
|
|
39
|
+
* - `'int'`: identity columns are INT. Integer statistics are fixed-width and
|
|
40
|
+
* never truncated, so `WHERE site_id=<n>` is both correct AND prunes.
|
|
41
|
+
*
|
|
42
|
+
* New catalogs are provisioned `'int'`; existing legacy catalogs stay `'string'`.
|
|
43
|
+
*/
|
|
44
|
+
type PartitionKeyEncoding = 'string' | 'int';
|
|
45
|
+
/** Default for new Iceberg/R2 Data Catalog tables. */
|
|
46
|
+
declare const DEFAULT_PARTITION_KEY_ENCODING: PartitionKeyEncoding;
|
|
47
|
+
/** Iceberg partition transform applied to a source column. */
|
|
48
|
+
type IcebergPartitionTransform = 'identity' | 'month';
|
|
49
|
+
interface IcebergPartitionField {
|
|
50
|
+
/** Source column the transform reads. */
|
|
51
|
+
sourceColumn: string;
|
|
52
|
+
transform: IcebergPartitionTransform;
|
|
53
|
+
/** Partition field name as it appears in Iceberg metadata. */
|
|
54
|
+
name: string;
|
|
55
|
+
}
|
|
56
|
+
interface IcebergTableSpec {
|
|
57
|
+
namespace: string;
|
|
58
|
+
table: string;
|
|
59
|
+
columns: readonly IcebergColumn[];
|
|
60
|
+
/** Partition spec — identity columns must appear here. */
|
|
61
|
+
partitionSpec: readonly IcebergPartitionField[];
|
|
62
|
+
/**
|
|
63
|
+
* Natural-key columns: a row is uniquely identified by this tuple within
|
|
64
|
+
* its partition. Drives dedupe. Per amendment 3, the FULL dedupe key is
|
|
65
|
+
* identity columns + dims columns + `naturalKey` (not `naturalKey` alone —
|
|
66
|
+
* identity alone would collapse rows across sites/dims).
|
|
67
|
+
*/
|
|
68
|
+
naturalKey: readonly string[];
|
|
69
|
+
/** Full dedupe identity: identity columns + dims columns + naturalKey. */
|
|
70
|
+
identityColumns: readonly string[];
|
|
71
|
+
/** Physical write-order columns (dimension-first) — undefined skips sort-order. */
|
|
72
|
+
clusterKey?: readonly string[];
|
|
73
|
+
}
|
|
74
|
+
export { DEFAULT_PARTITION_KEY_ENCODING, IcebergColumn, IcebergColumnType, IcebergPartitionField, IcebergPartitionTransform, IcebergS3Config, IcebergTableSpec, PartitionKeyEncoding };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { CatalogCache, CommitRetryOptions, ConnectIcebergOptions, ICEBERG_TYPE_MAP, IcebergCatalogConfig, IcebergConnection, IcebergFieldSummary, IcebergListedDataFile, IcebergPartitionSpec, IcebergPartitionSpecField, IcebergPrimitiveType, IcebergSchema, IcebergSchemaField, IcebergSortOrder, IcebergSortOrderField, IcebergTableOpResult, ManifestPartitionFilter, PartitionValueMatch, QueryProfiler, ResolveIcebergDataFilesOptions, buildManifestPartitionFilter, cacheGet, cachePut, connectIcebergCatalog, dropIcebergTables, ensureIcebergNamespace, listIcebergTables, resolveIcebergDataFiles } from "./_chunks/catalog.mjs";
|
|
2
|
+
import { DEFAULT_PARTITION_KEY_ENCODING, IcebergColumn, IcebergColumnType, IcebergPartitionField, IcebergPartitionTransform, IcebergS3Config, IcebergTableSpec, PartitionKeyEncoding } from "./_chunks/schema.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Closed identity shapes (ADR-0021 amendments 2 + 4). `'site-int'` is the
|
|
5
|
+
* team-scoped numeric Catalog Site Id (nuxtseo ADR-0091) stored under the
|
|
6
|
+
* fixed column name `site_id`. `'columns'` is the general N-column identity
|
|
7
|
+
* with per-column encoding, replacing the original opaque `'custom'` shape.
|
|
8
|
+
*/
|
|
9
|
+
type DatasetIdentity = {
|
|
10
|
+
kind: 'site-int';
|
|
11
|
+
encoding?: 'int' | 'string';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'columns';
|
|
14
|
+
columns: readonly {
|
|
15
|
+
name: string;
|
|
16
|
+
encoding: 'int32' | 'string';
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
/** A per-slice dimension (GSC's `searchType`). Absent for plain snapshot datasets. */
|
|
20
|
+
interface DatasetDim {
|
|
21
|
+
toPartitionValue: (v: string) => string | number;
|
|
22
|
+
/** Required (amendment 5) — how the reader decodes this column's manifest bounds. */
|
|
23
|
+
boundEncoding: 'int32' | 'string';
|
|
24
|
+
}
|
|
25
|
+
interface IcebergDatasetColumnDef {
|
|
26
|
+
name: string;
|
|
27
|
+
type: IcebergColumnType;
|
|
28
|
+
required: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface IcebergDatasetLedger {
|
|
31
|
+
key: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
interface IcebergDatasetDef {
|
|
34
|
+
namespace: string;
|
|
35
|
+
table: string;
|
|
36
|
+
identity: DatasetIdentity;
|
|
37
|
+
/** Extra per-slice dimensions; absent for snapshot datasets. */
|
|
38
|
+
dims?: Record<string, DatasetDim>;
|
|
39
|
+
/** Data columns (non-identity, non-dims) — includes any partition source column (e.g. `date`). */
|
|
40
|
+
columns: readonly IcebergDatasetColumnDef[];
|
|
41
|
+
/** Partition fields; identity columns must appear here. */
|
|
42
|
+
partition: readonly IcebergPartitionField[];
|
|
43
|
+
/** Natural-key columns. Full dedupe key = identity + dims + naturalKey (amendment 3). */
|
|
44
|
+
naturalKey: readonly string[];
|
|
45
|
+
clusterKey?: readonly string[];
|
|
46
|
+
/** Consumer-owned exactly-once ledger shape — folded into `appendSink().close()` (amendment 6). */
|
|
47
|
+
ledger?: IcebergDatasetLedger;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Derive the full {@link IcebergTableSpec} from a dataset def. Field ids are
|
|
51
|
+
* assigned sequentially in ONE fixed order — identity columns, then dims
|
|
52
|
+
* columns, then declared data columns — starting at 1. This mirrors the
|
|
53
|
+
* engine's original `icebergTableSpec` contract (identity columns first, data
|
|
54
|
+
* columns from a fixed base) so a def-derived spec for an existing table
|
|
55
|
+
* (`crawl.pages`, `lighthouse.scans`, `dataforseo.keywords`) is BYTE-IDENTICAL
|
|
56
|
+
* to the frozen inline constants it replaces.
|
|
57
|
+
*/
|
|
58
|
+
declare function deriveTableSpec(def: IcebergDatasetDef): IcebergTableSpec;
|
|
59
|
+
/**
|
|
60
|
+
* Convert a `YYYY-MM-DD` string / `Date` / already-numeric day-count to the
|
|
61
|
+
* integer "days since the Unix epoch" the Iceberg `date` type stores.
|
|
62
|
+
* hyparquet-writer mis-encodes Date-valued dictionary columns, so callers
|
|
63
|
+
* should feed this INTO their row before `appendRows`/`appendSink.emit` for
|
|
64
|
+
* any `month`-partitioned date column.
|
|
65
|
+
*/
|
|
66
|
+
declare function toIcebergDayCount(value: string | Date | number): number;
|
|
67
|
+
/** Options shared by `appendRows` / `appendSink`. */
|
|
68
|
+
interface AppendCommitOptions {
|
|
69
|
+
commitRetry?: CommitRetryOptions;
|
|
70
|
+
}
|
|
71
|
+
interface AppendSinkOptions extends AppendCommitOptions {
|
|
72
|
+
catalog: IcebergCatalogConfig;
|
|
73
|
+
connect?: ConnectIcebergOptions;
|
|
74
|
+
/** Invoked ONLY after a successful flush (amendment 6) — never on a failed/empty close. */
|
|
75
|
+
ledger?: {
|
|
76
|
+
record: () => Promise<void> | void;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface AppendResult {
|
|
80
|
+
/** Rows accepted after the identity guard + dedupe (what was actually appended). */
|
|
81
|
+
accepted: number;
|
|
82
|
+
/** Rows dropped by the identity guard (missing/out-of-range required identity value). */
|
|
83
|
+
skipped: number;
|
|
84
|
+
}
|
|
85
|
+
interface AppendSinkCloseResult extends AppendResult {
|
|
86
|
+
flushed: boolean;
|
|
87
|
+
error?: unknown;
|
|
88
|
+
}
|
|
89
|
+
interface AppendSink {
|
|
90
|
+
emit: (rows: readonly Record<string, unknown>[]) => void;
|
|
91
|
+
close: () => Promise<AppendSinkCloseResult>;
|
|
92
|
+
}
|
|
93
|
+
interface ResolveDataFilesOptions {
|
|
94
|
+
cache?: CatalogCache;
|
|
95
|
+
clock?: () => number;
|
|
96
|
+
profiler?: QueryProfiler;
|
|
97
|
+
}
|
|
98
|
+
interface IcebergDataset {
|
|
99
|
+
readonly def: IcebergDatasetDef;
|
|
100
|
+
readonly tableSpec: IcebergTableSpec;
|
|
101
|
+
icebergSchema: () => IcebergSchema;
|
|
102
|
+
icebergPartitionSpec: () => IcebergPartitionSpec;
|
|
103
|
+
icebergSortOrder: () => IcebergSortOrder | undefined;
|
|
104
|
+
createTable: (conn: IcebergConnection) => Promise<IcebergTableOpResult[]>;
|
|
105
|
+
/**
|
|
106
|
+
* One-shot append over an EXISTING connection: identity INT32 guard, dedupe
|
|
107
|
+
* by identity+dims+naturalKey (last-wins), cluster pre-sort (if
|
|
108
|
+
* `clusterKey` is set), then a single `icebergAppendRetrying` commit. `rows`
|
|
109
|
+
* must already be in final storage-column shape — identity/dims/data
|
|
110
|
+
* columns keyed by their STORED column names, with any `month`-partitioned
|
|
111
|
+
* date column pre-converted via {@link toIcebergDayCount}.
|
|
112
|
+
*/
|
|
113
|
+
appendRows: (conn: IcebergConnection, rows: readonly Record<string, unknown>[], opts?: AppendCommitOptions) => Promise<AppendResult>;
|
|
114
|
+
/**
|
|
115
|
+
* PURE row processing — the identity INT32 guard, dedupe (identity+dims+
|
|
116
|
+
* naturalKey, last-wins) and cluster pre-sort `appendRows`/`appendSink`
|
|
117
|
+
* apply before committing, exposed standalone with NO network/icebird call.
|
|
118
|
+
* Lets a consumer that owns its own commit call-site (e.g. one still
|
|
119
|
+
* calling a frozen `icebergAppendRetrying` import directly, for test-mock
|
|
120
|
+
* compatibility) still route its dedupe/guard/sort logic through the
|
|
121
|
+
* dataset definition.
|
|
122
|
+
*/
|
|
123
|
+
prepareRows: (rows: readonly Record<string, unknown>[]) => {
|
|
124
|
+
records: Record<string, unknown>[];
|
|
125
|
+
skipped: number;
|
|
126
|
+
};
|
|
127
|
+
/** Buffered multi-emit sink — owns its own connect/close lifecycle (ADR-0021's primary contract). */
|
|
128
|
+
appendSink: (opts: AppendSinkOptions) => AppendSink;
|
|
129
|
+
/** `PartitionValueMatch[]` for one identity value (+ optional dims), for manual manifest filtering. */
|
|
130
|
+
readerPredicate: (identity: string | number, dims?: Record<string, string>) => PartitionValueMatch[];
|
|
131
|
+
/** A ready-to-use manifest partition filter for one identity value + wanted months. */
|
|
132
|
+
partitionBoundFilter: (identity: string | number, months: ReadonlySet<number>, dims?: Record<string, string>) => ManifestPartitionFilter;
|
|
133
|
+
/** Resolve the data files for one identity value across a date range. */
|
|
134
|
+
resolveDataFiles: (conn: IcebergConnection, identity: string | number, range: {
|
|
135
|
+
start: string;
|
|
136
|
+
end: string;
|
|
137
|
+
}, dims?: Record<string, string>, opts?: ResolveDataFilesOptions) => Promise<IcebergListedDataFile[]>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Declare an Iceberg dataset — one `namespace.table` — deriving its schema,
|
|
141
|
+
* partition spec, dedupe key, INT32 guard, append path, and reader helpers
|
|
142
|
+
* from the def. See {@link IcebergDatasetDef}.
|
|
143
|
+
*/
|
|
144
|
+
declare function defineIcebergDataset(def: IcebergDatasetDef): IcebergDataset;
|
|
145
|
+
interface PyIcebergWriterResult {
|
|
146
|
+
rowCount?: number;
|
|
147
|
+
error?: string;
|
|
148
|
+
}
|
|
149
|
+
interface RunPyIcebergWriterOptions {
|
|
150
|
+
python: string;
|
|
151
|
+
script: string;
|
|
152
|
+
job: unknown;
|
|
153
|
+
label: string;
|
|
154
|
+
processErrorAsParseFailure?: boolean;
|
|
155
|
+
rejectOnProcessError?: boolean;
|
|
156
|
+
}
|
|
157
|
+
declare function resolvePyIcebergPython(override?: string): string;
|
|
158
|
+
declare function runPyIcebergWriter<T extends PyIcebergWriterResult>(options: RunPyIcebergWriterOptions): Promise<T>;
|
|
159
|
+
export { type AppendCommitOptions, type AppendResult, type AppendSink, type AppendSinkCloseResult, type AppendSinkOptions, type CatalogCache, type CommitRetryOptions, type ConnectIcebergOptions, DEFAULT_PARTITION_KEY_ENCODING, type DatasetDim, type DatasetIdentity, ICEBERG_TYPE_MAP, type IcebergCatalogConfig, type IcebergColumn, type IcebergColumnType, type IcebergConnection, type IcebergDataset, type IcebergDatasetColumnDef, type IcebergDatasetDef, type IcebergDatasetLedger, type IcebergFieldSummary, type IcebergListedDataFile, type IcebergPartitionField, type IcebergPartitionSpec, type IcebergPartitionSpecField, type IcebergPartitionTransform, type IcebergPrimitiveType, type IcebergS3Config, type IcebergSchema, type IcebergSchemaField, type IcebergSortOrder, type IcebergSortOrderField, type IcebergTableOpResult, type IcebergTableSpec, type ManifestPartitionFilter, type PartitionKeyEncoding, type PartitionValueMatch, type PyIcebergWriterResult, type QueryProfiler, type ResolveDataFilesOptions, type ResolveIcebergDataFilesOptions, type RunPyIcebergWriterOptions, buildManifestPartitionFilter, cacheGet, cachePut, connectIcebergCatalog, defineIcebergDataset, deriveTableSpec, dropIcebergTables, ensureIcebergNamespace, listIcebergTables, resolveIcebergDataFiles, resolvePyIcebergPython, runPyIcebergWriter, toIcebergDayCount };
|