@drakkar.software/starfish-client 3.0.0-alpha.39 → 3.0.0-alpha.40
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/bindings/zustand.js +42 -0
- package/dist/bindings/zustand.js.map +2 -2
- package/dist/client.d.ts +29 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/bindings/zustand.js
CHANGED
|
@@ -243,6 +243,8 @@ import {
|
|
|
243
243
|
HEADER_PUB,
|
|
244
244
|
HEADER_CONTENT_TYPE,
|
|
245
245
|
HEADER_ACCEPT,
|
|
246
|
+
PARQUET_MIME_TYPE as PARQUET_MIME_TYPE_VALUE,
|
|
247
|
+
PARQUET_MIME_TYPES as PARQUET_MIME_TYPES_VALUE,
|
|
246
248
|
signAppendAuthor,
|
|
247
249
|
signRequest,
|
|
248
250
|
stableStringify
|
|
@@ -956,6 +958,46 @@ var StarfishClient = class {
|
|
|
956
958
|
}
|
|
957
959
|
return res.json();
|
|
958
960
|
}
|
|
961
|
+
/**
|
|
962
|
+
* Push an Apache Parquet file to a Parquet collection.
|
|
963
|
+
*
|
|
964
|
+
* Thin wrapper over {@link pushBlob} that fixes `Content-Type` to
|
|
965
|
+
* `application/vnd.apache.parquet` so the S3 object is tagged correctly
|
|
966
|
+
* for DuckDB and CDN consumption.
|
|
967
|
+
*
|
|
968
|
+
* @example
|
|
969
|
+
* ```ts
|
|
970
|
+
* const parquetBytes = await generateParquet(rows)
|
|
971
|
+
* const result = await client.pushParquet("/push/analytics/alice/q1.parquet", parquetBytes)
|
|
972
|
+
* console.log("stored hash:", result.hash)
|
|
973
|
+
* ```
|
|
974
|
+
*/
|
|
975
|
+
async pushParquet(path, data) {
|
|
976
|
+
return this.pushBlob(path, data, PARQUET_MIME_TYPE_VALUE);
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Pull an Apache Parquet file from a Parquet collection.
|
|
980
|
+
*
|
|
981
|
+
* Thin wrapper over {@link pullBlob} for API symmetry with
|
|
982
|
+
* {@link pushParquet}.
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* ```ts
|
|
986
|
+
* const result = await client.pullParquet("/pull/analytics/alice/q1.parquet")
|
|
987
|
+
* // result.data → ArrayBuffer
|
|
988
|
+
* // result.contentType → "application/vnd.apache.parquet"
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
async pullParquet(path) {
|
|
992
|
+
const result = await this.pullBlob(path);
|
|
993
|
+
if (!PARQUET_MIME_TYPES_VALUE.includes(result.contentType)) {
|
|
994
|
+
throw new StarfishHttpError(
|
|
995
|
+
415,
|
|
996
|
+
`Expected a Parquet content-type, got: ${result.contentType}`
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
return result;
|
|
1000
|
+
}
|
|
959
1001
|
};
|
|
960
1002
|
|
|
961
1003
|
// src/sync.ts
|