@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/client.d.ts
CHANGED
|
@@ -370,4 +370,33 @@ export declare class StarfishClient {
|
|
|
370
370
|
* Binary collections use last-write-wins (no conflict detection).
|
|
371
371
|
*/
|
|
372
372
|
pushBlob(path: string, data: ArrayBuffer | Uint8Array | Blob, contentType: string): Promise<BlobPushResult>;
|
|
373
|
+
/**
|
|
374
|
+
* Push an Apache Parquet file to a Parquet collection.
|
|
375
|
+
*
|
|
376
|
+
* Thin wrapper over {@link pushBlob} that fixes `Content-Type` to
|
|
377
|
+
* `application/vnd.apache.parquet` so the S3 object is tagged correctly
|
|
378
|
+
* for DuckDB and CDN consumption.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```ts
|
|
382
|
+
* const parquetBytes = await generateParquet(rows)
|
|
383
|
+
* const result = await client.pushParquet("/push/analytics/alice/q1.parquet", parquetBytes)
|
|
384
|
+
* console.log("stored hash:", result.hash)
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
pushParquet(path: string, data: ArrayBuffer | Uint8Array | Blob): Promise<BlobPushResult>;
|
|
388
|
+
/**
|
|
389
|
+
* Pull an Apache Parquet file from a Parquet collection.
|
|
390
|
+
*
|
|
391
|
+
* Thin wrapper over {@link pullBlob} for API symmetry with
|
|
392
|
+
* {@link pushParquet}.
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```ts
|
|
396
|
+
* const result = await client.pullParquet("/pull/analytics/alice/q1.parquet")
|
|
397
|
+
* // result.data → ArrayBuffer
|
|
398
|
+
* // result.contentType → "application/vnd.apache.parquet"
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
pullParquet(path: string): Promise<BlobPullResult>;
|
|
373
402
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type { RevocationList, RevocationEntry, RevokedSubject, BuildRevocationLi
|
|
|
6
6
|
export type { PullResult, PushSuccess, PullKeyringProjection } from "@drakkar.software/starfish-protocol";
|
|
7
7
|
export { StarfishClient, pullWasFromCache } from "./client.js";
|
|
8
8
|
export type { BlobPullResult, BlobPushResult, AppendPullOptions, PullOptions, BatchPullOptions, BatchPullResult, BatchPullEntry, } from "./client.js";
|
|
9
|
+
export { PARQUET_MIME_TYPE, PARQUET_MIME_TYPES } from "@drakkar.software/starfish-protocol";
|
|
9
10
|
export { SyncManager, AbortError } from "./sync.js";
|
|
10
11
|
export type { SyncManagerOptions, SyncSigner } from "./sync.js";
|
|
11
12
|
export { AppendLogCursor, AppendAuthorError, checkpointOf } from "./append-log.js";
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
HEADER_PUB,
|
|
19
19
|
HEADER_CONTENT_TYPE,
|
|
20
20
|
HEADER_ACCEPT,
|
|
21
|
+
PARQUET_MIME_TYPE as PARQUET_MIME_TYPE_VALUE,
|
|
22
|
+
PARQUET_MIME_TYPES as PARQUET_MIME_TYPES_VALUE,
|
|
21
23
|
signAppendAuthor,
|
|
22
24
|
signRequest,
|
|
23
25
|
stableStringify
|
|
@@ -731,8 +733,51 @@ var StarfishClient = class {
|
|
|
731
733
|
}
|
|
732
734
|
return res.json();
|
|
733
735
|
}
|
|
736
|
+
/**
|
|
737
|
+
* Push an Apache Parquet file to a Parquet collection.
|
|
738
|
+
*
|
|
739
|
+
* Thin wrapper over {@link pushBlob} that fixes `Content-Type` to
|
|
740
|
+
* `application/vnd.apache.parquet` so the S3 object is tagged correctly
|
|
741
|
+
* for DuckDB and CDN consumption.
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* ```ts
|
|
745
|
+
* const parquetBytes = await generateParquet(rows)
|
|
746
|
+
* const result = await client.pushParquet("/push/analytics/alice/q1.parquet", parquetBytes)
|
|
747
|
+
* console.log("stored hash:", result.hash)
|
|
748
|
+
* ```
|
|
749
|
+
*/
|
|
750
|
+
async pushParquet(path, data) {
|
|
751
|
+
return this.pushBlob(path, data, PARQUET_MIME_TYPE_VALUE);
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Pull an Apache Parquet file from a Parquet collection.
|
|
755
|
+
*
|
|
756
|
+
* Thin wrapper over {@link pullBlob} for API symmetry with
|
|
757
|
+
* {@link pushParquet}.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* const result = await client.pullParquet("/pull/analytics/alice/q1.parquet")
|
|
762
|
+
* // result.data → ArrayBuffer
|
|
763
|
+
* // result.contentType → "application/vnd.apache.parquet"
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
async pullParquet(path) {
|
|
767
|
+
const result = await this.pullBlob(path);
|
|
768
|
+
if (!PARQUET_MIME_TYPES_VALUE.includes(result.contentType)) {
|
|
769
|
+
throw new StarfishHttpError(
|
|
770
|
+
415,
|
|
771
|
+
`Expected a Parquet content-type, got: ${result.contentType}`
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
return result;
|
|
775
|
+
}
|
|
734
776
|
};
|
|
735
777
|
|
|
778
|
+
// src/index.ts
|
|
779
|
+
import { PARQUET_MIME_TYPE, PARQUET_MIME_TYPES } from "@drakkar.software/starfish-protocol";
|
|
780
|
+
|
|
736
781
|
// src/sync.ts
|
|
737
782
|
import {
|
|
738
783
|
AUTHOR_PUBKEY_FIELD as AUTHOR_PUBKEY_FIELD2,
|
|
@@ -2143,6 +2188,8 @@ export {
|
|
|
2143
2188
|
AppendLogCursor,
|
|
2144
2189
|
ConflictError,
|
|
2145
2190
|
ENCRYPTED_KEY,
|
|
2191
|
+
PARQUET_MIME_TYPE,
|
|
2192
|
+
PARQUET_MIME_TYPES,
|
|
2146
2193
|
SnapshotHistory,
|
|
2147
2194
|
StarfishClient,
|
|
2148
2195
|
StarfishHttpError,
|