node-s3tables 0.0.7 → 0.0.8

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.ts CHANGED
@@ -87,7 +87,7 @@ interface IcebergMetadata {
87
87
  'default-spec-id': number;
88
88
  'partition-specs': IcebergPartitionSpec[];
89
89
  'last-partition-id': number;
90
- 'current-snapshot-id'?: bigint | number;
90
+ 'current-snapshot-id': bigint | number;
91
91
  location: string;
92
92
  }
93
93
 
@@ -171,6 +171,7 @@ interface AddDataFilesParams {
171
171
  tableBucketARN: string;
172
172
  namespace: string;
173
173
  name: string;
174
+ snapshotId?: bigint;
174
175
  lists: AddFileList[];
175
176
  retryCount?: number;
176
177
  }
package/dist/index.js CHANGED
@@ -1177,10 +1177,10 @@ async function addDataFiles(params) {
1177
1177
  if (!region) {
1178
1178
  throw new Error('bad tableBucketARN');
1179
1179
  }
1180
- const snapshot_id = _randomBigInt64();
1180
+ const snapshot_id = params.snapshotId ?? _randomBigInt64();
1181
1181
  const metadata = await getMetadata(params);
1182
1182
  const bucket = metadata.location.split('/').slice(-1)[0];
1183
- const parent_snapshot_id = BigInt(metadata['current-snapshot-id'] ?? -1n);
1183
+ const parent_snapshot_id = BigInt(metadata['current-snapshot-id']);
1184
1184
  const snapshot = metadata.snapshots.find((s) => s['snapshot-id'] === parent_snapshot_id) ??
1185
1185
  null;
1186
1186
  if (!bucket) {
@@ -1313,7 +1313,7 @@ async function addDataFiles(params) {
1313
1313
  }
1314
1314
  // we do a merge in the append only simultanious case
1315
1315
  const conflict_metadata = await getMetadata(params);
1316
- const conflict_snapshot_id = BigInt(conflict_metadata['current-snapshot-id'] ?? -1n);
1316
+ const conflict_snapshot_id = BigInt(conflict_metadata['current-snapshot-id']);
1317
1317
  if (conflict_snapshot_id <= 0n) {
1318
1318
  throw new Error('conflict');
1319
1319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-s3tables",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "node api for dealing with s3tables",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",