@drakkar.software/starfish-client 1.11.0 → 1.14.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/config.d.ts +34 -0
- package/dist/config.js +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Encryption modes supported by the Starfish server. */
|
|
2
|
+
export type EncryptionMode = "none" | "identity" | "server" | "delegated";
|
|
3
|
+
/** Per-collection metadata returned by GET /config. */
|
|
4
|
+
export interface CollectionClientInfo {
|
|
5
|
+
name: string;
|
|
6
|
+
maxBodyBytes: number;
|
|
7
|
+
encryption: EncryptionMode;
|
|
8
|
+
allowedMimeTypes: string[];
|
|
9
|
+
pullOnly?: boolean;
|
|
10
|
+
pushOnly?: boolean;
|
|
11
|
+
queueOnly?: boolean;
|
|
12
|
+
clientEncrypted?: boolean;
|
|
13
|
+
/** Base64-encoded public key for client-side encryption, if configured on the server. */
|
|
14
|
+
publicKey?: string;
|
|
15
|
+
ttlMs?: number;
|
|
16
|
+
forceFullFetch?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Response shape of GET /config. */
|
|
19
|
+
export interface ConfigResponse {
|
|
20
|
+
collections: CollectionClientInfo[];
|
|
21
|
+
namespaces?: Record<string, {
|
|
22
|
+
collections: CollectionClientInfo[];
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fetch the server's collection manifest from GET /config.
|
|
27
|
+
*
|
|
28
|
+
* @param baseUrl - Base URL of the Starfish server (e.g. `"https://api.example.com/v1"`).
|
|
29
|
+
* @param options.headers - Optional request headers (e.g. `Authorization`).
|
|
30
|
+
* @throws {Error} if the server returns a non-2xx response.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fetchServerConfig(baseUrl: string, options?: {
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
}): Promise<ConfigResponse>;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch the server's collection manifest from GET /config.
|
|
3
|
+
*
|
|
4
|
+
* @param baseUrl - Base URL of the Starfish server (e.g. `"https://api.example.com/v1"`).
|
|
5
|
+
* @param options.headers - Optional request headers (e.g. `Authorization`).
|
|
6
|
+
* @throws {Error} if the server returns a non-2xx response.
|
|
7
|
+
*/
|
|
8
|
+
export async function fetchServerConfig(baseUrl, options) {
|
|
9
|
+
const url = `${baseUrl.replace(/\/$/, "")}/config`;
|
|
10
|
+
const res = await fetch(url, {
|
|
11
|
+
method: "GET",
|
|
12
|
+
headers: options?.headers,
|
|
13
|
+
});
|
|
14
|
+
if (!res.ok) {
|
|
15
|
+
throw new Error(`fetchServerConfig: ${res.status} ${res.statusText}`);
|
|
16
|
+
}
|
|
17
|
+
return res.json();
|
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export type { Snapshot, SnapshotHistoryOptions } from "./history.js";
|
|
|
25
25
|
export { startPolling, startAdaptivePolling } from "./polling.js";
|
|
26
26
|
export type { PollableState, AdaptivePollingOptions, AdaptivePollingControls } from "./polling.js";
|
|
27
27
|
export { createDedupFetch } from "./dedup.js";
|
|
28
|
+
export { fetchServerConfig } from "./config.js";
|
|
29
|
+
export type { EncryptionMode, CollectionClientInfo, ConfigResponse } from "./config.js";
|
|
28
30
|
export { createIndexedDBStorage } from "./storage/indexeddb.js";
|
|
29
31
|
export type { IndexedDBStorageOptions, AsyncStateStorage } from "./storage/indexeddb.js";
|
|
30
32
|
export { exportData, importData, exportToBlob } from "./export.js";
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { createUnionMerge, createSoftDeleteResolver, timestampWinner, pruneTombs
|
|
|
12
12
|
export { SnapshotHistory } from "./history.js";
|
|
13
13
|
export { startPolling, startAdaptivePolling } from "./polling.js";
|
|
14
14
|
export { createDedupFetch } from "./dedup.js";
|
|
15
|
+
export { fetchServerConfig } from "./config.js";
|
|
15
16
|
export { createIndexedDBStorage } from "./storage/indexeddb.js";
|
|
16
17
|
export { exportData, importData, exportToBlob } from "./export.js";
|
|
17
18
|
export { isBackgroundSyncSupported, registerBackgroundSync } from "./background-sync.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drakkar.software/starfish-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Drakkar-Software/starfish.git",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@drakkar.software/starfish-protocol": "1.
|
|
67
|
+
"@drakkar.software/starfish-protocol": "1.14.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@legendapp/state": "^2.0.0",
|