@xcitedbs/client 0.2.8 → 0.2.10
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/client.d.ts +65 -1
- package/dist/client.js +502 -62
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +168 -0
- package/dist/user-isolation.test.d.ts +1 -0
- package/dist/user-isolation.test.js +175 -0
- package/llms-full.txt +5 -2
- package/llms.txt +51 -4
- package/package.json +4 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessCheckResult, AppAuthConfig, AppEmailConfig, AppEmailTemplates, AppUser, AppUserTokenPair, EmailTestResponse, ForgotPasswordResponse, SendVerificationResponse, BranchInfo, CommitRecord, DatabaseContext, DiffRef, DiffResult, Flags, ListIdentifierChildrenResult, ListIdentifiersResult, LockInfo, LogEntry, MergeResult, MetaValue, PlatformRegisterResult, PolicySubjectInput, UnqueryResult, UnqueryTemplate, PolicyUpdateResponse, RealtimeEvent, SecurityConfig, SecurityPolicy, StoredTriggerResponse, TriggerDefinition, StoredPolicyResponse, SubscriptionOptions, TagRecord, TextSearchQuery, TextSearchResult, OAuthProvidersResponse, ProjectInfo, PlatformRegistrationConfig, PlatformWorkspacesResponse, TokenPair, UserInfo, ApiKeyInfo, WriteDocumentOptions, CreateTestSessionOptions, XCiteDBClientOptions, XCiteQuery } from './types';
|
|
1
|
+
import { AccessCheckResult, AppAuthConfig, AppEmailConfig, AppEmailTemplates, AppUser, AppUserTokenPair, EmailTestResponse, ForgotPasswordResponse, SendVerificationResponse, BranchInfo, CommitRecord, DatabaseContext, DiffRef, DiffResult, Flags, ListIdentifierChildrenResult, ListIdentifiersResult, LockInfo, LogEntry, MergeResult, MetaValue, PlatformRegisterResult, PolicySubjectInput, UnqueryResult, UnqueryTemplate, PolicyUpdateResponse, RealtimeEvent, SecurityConfig, SecurityPolicy, StoredTriggerResponse, TriggerDefinition, StoredPolicyResponse, SubscriptionOptions, TagRecord, TextSearchQuery, TextSearchResult, ProjectSearchSettings, ProjectSearchSettingsUpdate, VectorIndexEstimate, RagQueryOptions, RagQueryResult, RagStreamEvent, OAuthProvidersResponse, ProjectInfo, PlatformRegistrationConfig, PlatformWorkspacesResponse, TokenPair, UserInfo, ApiKeyInfo, WriteDocumentOptions, CreateTestSessionOptions, XCiteDBClientOptions, XCiteDBJwtClaims, XCiteQuery, UserIsolationConfig } from './types';
|
|
2
2
|
import { WebSocketSubscription } from './websocket';
|
|
3
3
|
export declare class XCiteDBClient {
|
|
4
4
|
private baseUrl;
|
|
@@ -16,12 +16,38 @@ export declare class XCiteDBClient {
|
|
|
16
16
|
private onSessionInvalid?;
|
|
17
17
|
private testSessionToken?;
|
|
18
18
|
private testRequireAuth?;
|
|
19
|
+
private userIsolation?;
|
|
20
|
+
private cachedAppUserId?;
|
|
19
21
|
constructor(options: XCiteDBClientOptions);
|
|
20
22
|
/**
|
|
21
23
|
* Create an ephemeral isolated database: calls `POST /api/v1/test/sessions` with your API key or Bearer,
|
|
22
24
|
* then returns a client that sends `X-Test-Session` (auth-free by default).
|
|
23
25
|
*/
|
|
24
26
|
static createTestSession(opts: CreateTestSessionOptions): Promise<XCiteDBClient>;
|
|
27
|
+
/**
|
|
28
|
+
* Canonical `project:<tenant_id>:<role>` group string. The middle segment must match the app JWT `tenant_id`
|
|
29
|
+
* (internal project id), not the human-readable project name.
|
|
30
|
+
*/
|
|
31
|
+
static buildProjectGroup(projectId: string, role: 'admin' | 'editor' | 'viewer'): string;
|
|
32
|
+
private static decodeJwtPayloadJson;
|
|
33
|
+
/**
|
|
34
|
+
* Decode `appUserAccessToken`, or `accessToken` if no app token (platform JWT), without verifying the signature.
|
|
35
|
+
* Use for debugging ABAC (compare `tenant_id` and `groups` to `project:<…>:role` in policies).
|
|
36
|
+
*/
|
|
37
|
+
getTokenClaims(): XCiteDBJwtClaims | null;
|
|
38
|
+
private cacheAppUserIdFromPair;
|
|
39
|
+
private clearAppUserIdCache;
|
|
40
|
+
private getAppUserId;
|
|
41
|
+
private normalizeIsolationNamespaceTemplate;
|
|
42
|
+
private canonicalId;
|
|
43
|
+
/** Resolved namespace root, e.g. `/users/abc`, or `null` if isolation is off or no app user id. */
|
|
44
|
+
private userIsolationNamespace;
|
|
45
|
+
private allSharedPassthroughPrefixes;
|
|
46
|
+
private pathMatchesSharedPassthrough;
|
|
47
|
+
private isoPrefixId;
|
|
48
|
+
private isoUnprefixId;
|
|
49
|
+
private isoPrefixQuery;
|
|
50
|
+
private isoApplyXmlDbIdentifier;
|
|
25
51
|
/** Destroy this test session on the server (`DELETE /api/v1/test/sessions/current`). */
|
|
26
52
|
destroyTestSession(): Promise<{
|
|
27
53
|
message: string;
|
|
@@ -46,6 +72,7 @@ export declare class XCiteDBClient {
|
|
|
46
72
|
private mergeAppTenant;
|
|
47
73
|
private authHeaders;
|
|
48
74
|
private testHeaders;
|
|
75
|
+
private requestHeaders;
|
|
49
76
|
private request;
|
|
50
77
|
/** Developer Bearer refresh first, then app-user refresh (no API key refresh). */
|
|
51
78
|
private tryRefreshSessionAfter401;
|
|
@@ -255,6 +282,17 @@ export declare class XCiteDBClient {
|
|
|
255
282
|
* ```
|
|
256
283
|
*/
|
|
257
284
|
updateSecurityConfig(config: Partial<SecurityConfig>): Promise<void>;
|
|
285
|
+
/** Per-tenant user data spaces (`GET /api/v1/security/user-isolation`). Requires security admin. */
|
|
286
|
+
getUserIsolationConfig(): Promise<UserIsolationConfig>;
|
|
287
|
+
/** Enable or reconfigure user isolation (`PUT /api/v1/security/user-isolation`). */
|
|
288
|
+
setUserIsolationConfig(config: Partial<UserIsolationConfig>): Promise<UserIsolationConfig>;
|
|
289
|
+
/** Disable user isolation and remove generated policies (`DELETE /api/v1/security/user-isolation`). */
|
|
290
|
+
disableUserIsolation(): Promise<void>;
|
|
291
|
+
/**
|
|
292
|
+
* Loads server isolation config; when enabled, configures client-side identifier prefixing to match
|
|
293
|
+
* the server (namespace + shared paths). Does not send `X-Prefix`; identifiers in requests are rewritten.
|
|
294
|
+
*/
|
|
295
|
+
enableUserIsolation(): Promise<UserIsolationConfig>;
|
|
258
296
|
createBranch(name: string, fromBranch?: string, fromDate?: string): Promise<void>;
|
|
259
297
|
deleteBranch(name: string): Promise<void>;
|
|
260
298
|
deleteRevision(branch: string, date: string): Promise<void>;
|
|
@@ -375,6 +413,32 @@ export declare class XCiteDBClient {
|
|
|
375
413
|
status: string;
|
|
376
414
|
message: string;
|
|
377
415
|
}>;
|
|
416
|
+
reembedVector(): Promise<{
|
|
417
|
+
status: string;
|
|
418
|
+
message: string;
|
|
419
|
+
}>;
|
|
420
|
+
/** Project search / FTS / vector / LLM configuration (`GET /api/v1/project/settings/search`). */
|
|
421
|
+
getProjectSearchSettings(): Promise<ProjectSearchSettings>;
|
|
422
|
+
/** Update project search settings (`PUT /api/v1/project/settings/search`). Returns the same shape as GET. */
|
|
423
|
+
updateProjectSearchSettings(patch: ProjectSearchSettingsUpdate): Promise<ProjectSearchSettings>;
|
|
424
|
+
/** Blocking full DB scan (admin; no calls to embedding API). Prefer {@link postVectorIndexEstimateSession} for UI. */
|
|
425
|
+
getVectorIndexEstimate(): Promise<VectorIndexEstimate>;
|
|
426
|
+
/** Start background estimate (202); cancel prior session for this tenant. */
|
|
427
|
+
postVectorIndexEstimateSession(): Promise<VectorIndexEstimate>;
|
|
428
|
+
getVectorIndexEstimateSession(sessionId: string): Promise<VectorIndexEstimate>;
|
|
429
|
+
deleteVectorIndexEstimateSession(sessionId: string): Promise<{
|
|
430
|
+
status?: string;
|
|
431
|
+
}>;
|
|
432
|
+
/**
|
|
433
|
+
* RAG over indexed documents (`POST /api/v1/rag/query` with JSON body).
|
|
434
|
+
* Requires LLM completion; embedding required when retrieval uses semantic or hybrid.
|
|
435
|
+
*/
|
|
436
|
+
ragQuery(options: Omit<RagQueryOptions, 'stream'>): Promise<RagQueryResult>;
|
|
437
|
+
/**
|
|
438
|
+
* Streaming RAG (`POST /api/v1/rag/query` with `stream: true`). Parses SSE `data: {...}` lines.
|
|
439
|
+
* The final event has `done: true` and may include `sources`.
|
|
440
|
+
*/
|
|
441
|
+
ragQueryStream(options: Omit<RagQueryOptions, 'stream'>, onEvent: (ev: RagStreamEvent) => void): Promise<void>;
|
|
378
442
|
writeJsonDocument(identifier: string, data: unknown): Promise<void>;
|
|
379
443
|
readJsonDocument<T = unknown>(identifier: string): Promise<T>;
|
|
380
444
|
deleteJsonDocument(identifier: string): Promise<void>;
|