@xcitedbs/client 0.2.9 → 0.2.11
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 +122 -6
- package/dist/client.js +562 -111
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +217 -26
- package/dist/user-isolation.test.d.ts +1 -0
- package/dist/user-isolation.test.js +175 -0
- package/llms-full.txt +115 -92
- package/llms.txt +57 -39
- 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, XCiteDBJwtClaims, XCiteQuery } from './types';
|
|
1
|
+
import { AccessCheckResult, AppAuthConfig, AppEmailConfig, AppEmailTemplates, AppUser, AppUserTokenPair, EmailTestResponse, ForgotPasswordResponse, SendVerificationResponse, BranchInfo, BookmarkRecord, CheckpointRecord, CommitRecord, CompareRef, CompareResult, DatabaseContext, DiffRef, DiffResult, Flags, ListIdentifierChildrenResult, ListIdentifiersResult, LockInfo, LogEntry, MergeResult, PublishResult, WorkspaceInfo, 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,6 +16,8 @@ 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,
|
|
@@ -33,6 +35,19 @@ export declare class XCiteDBClient {
|
|
|
33
35
|
* Use for debugging ABAC (compare `tenant_id` and `groups` to `project:<…>:role` in policies).
|
|
34
36
|
*/
|
|
35
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;
|
|
36
51
|
/** Destroy this test session on the server (`DELETE /api/v1/test/sessions/current`). */
|
|
37
52
|
destroyTestSession(): Promise<{
|
|
38
53
|
message: string;
|
|
@@ -57,6 +72,7 @@ export declare class XCiteDBClient {
|
|
|
57
72
|
private mergeAppTenant;
|
|
58
73
|
private authHeaders;
|
|
59
74
|
private testHeaders;
|
|
75
|
+
private requestHeaders;
|
|
60
76
|
private request;
|
|
61
77
|
/** Developer Bearer refresh first, then app-user refresh (no API key refresh). */
|
|
62
78
|
private tryRefreshSessionAfter401;
|
|
@@ -266,12 +282,45 @@ export declare class XCiteDBClient {
|
|
|
266
282
|
* ```
|
|
267
283
|
*/
|
|
268
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>;
|
|
296
|
+
createWorkspace(name: string, fromBranch?: string, fromDate?: string): Promise<void>;
|
|
297
|
+
/** @deprecated Use {@link createWorkspace}. */
|
|
269
298
|
createBranch(name: string, fromBranch?: string, fromDate?: string): Promise<void>;
|
|
299
|
+
deleteWorkspace(name: string): Promise<void>;
|
|
300
|
+
/** @deprecated Use {@link deleteWorkspace}. */
|
|
270
301
|
deleteBranch(name: string): Promise<void>;
|
|
302
|
+
deleteWorkspaceRevision(workspace: string, date: string): Promise<void>;
|
|
303
|
+
/** @deprecated Use {@link deleteWorkspaceRevision}. */
|
|
271
304
|
deleteRevision(branch: string, date: string): Promise<void>;
|
|
305
|
+
listWorkspaces(): Promise<WorkspaceInfo[]>;
|
|
306
|
+
/** @deprecated Use {@link listWorkspaces}. */
|
|
272
307
|
listBranches(): Promise<BranchInfo[]>;
|
|
308
|
+
getWorkspace(name: string): Promise<WorkspaceInfo>;
|
|
309
|
+
/** @deprecated Use {@link getWorkspace}. */
|
|
273
310
|
getBranch(name: string): Promise<BranchInfo>;
|
|
311
|
+
createCheckpoint(message: string, author?: string): Promise<CheckpointRecord>;
|
|
312
|
+
/** @deprecated Use {@link createCheckpoint}. */
|
|
274
313
|
createCommit(message: string, author?: string): Promise<CommitRecord>;
|
|
314
|
+
listCheckpoints(options?: {
|
|
315
|
+
branch?: string;
|
|
316
|
+
limit?: number;
|
|
317
|
+
offset?: number;
|
|
318
|
+
}): Promise<{
|
|
319
|
+
checkpoints: CheckpointRecord[];
|
|
320
|
+
total: number;
|
|
321
|
+
branch: string;
|
|
322
|
+
}>;
|
|
323
|
+
/** @deprecated Use {@link listCheckpoints}. */
|
|
275
324
|
listCommits(options?: {
|
|
276
325
|
branch?: string;
|
|
277
326
|
limit?: number;
|
|
@@ -281,13 +330,33 @@ export declare class XCiteDBClient {
|
|
|
281
330
|
total: number;
|
|
282
331
|
branch: string;
|
|
283
332
|
}>;
|
|
333
|
+
getCheckpoint(checkpointId: string): Promise<CheckpointRecord>;
|
|
334
|
+
/** @deprecated Use {@link getCheckpoint}. */
|
|
284
335
|
getCommit(commitId: string): Promise<CommitRecord>;
|
|
336
|
+
revertToCheckpoint(checkpointId: string, _confirm?: boolean): Promise<{
|
|
337
|
+
rolled_back_checkpoints: string[];
|
|
338
|
+
rolled_back_commits?: string[];
|
|
339
|
+
current_tip: string;
|
|
340
|
+
}>;
|
|
341
|
+
/** @deprecated Use {@link revertToCheckpoint}. */
|
|
285
342
|
rollbackToCommit(commitId: string, _confirm?: boolean): Promise<{
|
|
286
343
|
rolled_back_commits: string[];
|
|
287
344
|
current_tip: string;
|
|
288
345
|
}>;
|
|
346
|
+
applyCheckpoint(checkpointId: string, message?: string, author?: string): Promise<CheckpointRecord>;
|
|
347
|
+
/** @deprecated Use {@link applyCheckpoint}. */
|
|
289
348
|
cherryPick(commitId: string, message?: string, author?: string): Promise<CommitRecord>;
|
|
349
|
+
createBookmark(name: string, checkpointId: string, message?: string, author?: string): Promise<BookmarkRecord>;
|
|
350
|
+
/** @deprecated Use {@link createBookmark}. */
|
|
290
351
|
createTag(name: string, commitId: string, message?: string, author?: string): Promise<TagRecord>;
|
|
352
|
+
listBookmarks(options?: {
|
|
353
|
+
limit?: number;
|
|
354
|
+
offset?: number;
|
|
355
|
+
}): Promise<{
|
|
356
|
+
bookmarks: BookmarkRecord[];
|
|
357
|
+
total: number;
|
|
358
|
+
}>;
|
|
359
|
+
/** @deprecated Use {@link listBookmarks}. */
|
|
291
360
|
listTags(options?: {
|
|
292
361
|
limit?: number;
|
|
293
362
|
offset?: number;
|
|
@@ -295,23 +364,44 @@ export declare class XCiteDBClient {
|
|
|
295
364
|
tags: TagRecord[];
|
|
296
365
|
total: number;
|
|
297
366
|
}>;
|
|
367
|
+
getBookmark(name: string): Promise<BookmarkRecord>;
|
|
368
|
+
/** @deprecated Use {@link getBookmark}. */
|
|
298
369
|
getTag(name: string): Promise<TagRecord>;
|
|
370
|
+
deleteBookmark(name: string): Promise<void>;
|
|
371
|
+
/** @deprecated Use {@link deleteBookmark}. */
|
|
299
372
|
deleteTag(name: string): Promise<void>;
|
|
373
|
+
compare(from: CompareRef, to: CompareRef, includeContent?: boolean): Promise<CompareResult>;
|
|
374
|
+
/** @deprecated Use {@link compare}. */
|
|
300
375
|
diff(from: DiffRef, to: DiffRef, includeContent?: boolean): Promise<DiffResult>;
|
|
376
|
+
publishWorkspace(targetWorkspace: string, sourceWorkspace: string, options?: {
|
|
377
|
+
message?: string;
|
|
378
|
+
autoResolve?: 'none' | 'source' | 'target';
|
|
379
|
+
}): Promise<PublishResult>;
|
|
380
|
+
/** @deprecated Use {@link publishWorkspace}. */
|
|
301
381
|
mergeBranch(targetBranch: string, sourceBranch: string, options?: {
|
|
302
382
|
message?: string;
|
|
303
383
|
autoResolve?: 'none' | 'source' | 'target';
|
|
304
384
|
}): Promise<MergeResult>;
|
|
305
385
|
/**
|
|
306
|
-
* Create `
|
|
307
|
-
* create a
|
|
308
|
-
* Restores previous {@link DatabaseContext} afterward.
|
|
386
|
+
* Create `workspaceName` from {@link options.fromBranch} (or current context), run `fn` scoped to that workspace,
|
|
387
|
+
* create a checkpoint, then publish back unless {@link options.autoMerge} is `false`.
|
|
309
388
|
*/
|
|
389
|
+
withWorkspace<T>(workspaceName: string, fn: (client: XCiteDBClient) => Promise<T>, options?: {
|
|
390
|
+
message?: string;
|
|
391
|
+
/** When true (default), publish `workspaceName` into the parent workspace after checkpoint. */
|
|
392
|
+
autoMerge?: boolean;
|
|
393
|
+
/** Workspace to fork from (default: current `context.branch` / `context.workspace`, or `""`). */
|
|
394
|
+
fromBranch?: string;
|
|
395
|
+
author?: string;
|
|
396
|
+
}): Promise<{
|
|
397
|
+
result: T;
|
|
398
|
+
checkpoint?: CheckpointRecord;
|
|
399
|
+
publish?: PublishResult;
|
|
400
|
+
}>;
|
|
401
|
+
/** @deprecated Use {@link withWorkspace}. */
|
|
310
402
|
withBranch<T>(branchName: string, fn: (client: XCiteDBClient) => Promise<T>, options?: {
|
|
311
403
|
message?: string;
|
|
312
|
-
/** When true (default), merge `branchName` into the parent branch after commit. */
|
|
313
404
|
autoMerge?: boolean;
|
|
314
|
-
/** Branch to fork from (default: current `context.branch`, or `""`). */
|
|
315
405
|
fromBranch?: string;
|
|
316
406
|
author?: string;
|
|
317
407
|
}): Promise<{
|
|
@@ -386,6 +476,32 @@ export declare class XCiteDBClient {
|
|
|
386
476
|
status: string;
|
|
387
477
|
message: string;
|
|
388
478
|
}>;
|
|
479
|
+
reembedVector(): Promise<{
|
|
480
|
+
status: string;
|
|
481
|
+
message: string;
|
|
482
|
+
}>;
|
|
483
|
+
/** Project search / FTS / vector / LLM configuration (`GET /api/v1/project/settings/search`). */
|
|
484
|
+
getProjectSearchSettings(): Promise<ProjectSearchSettings>;
|
|
485
|
+
/** Update project search settings (`PUT /api/v1/project/settings/search`). Returns the same shape as GET. */
|
|
486
|
+
updateProjectSearchSettings(patch: ProjectSearchSettingsUpdate): Promise<ProjectSearchSettings>;
|
|
487
|
+
/** Blocking full DB scan (admin; no calls to embedding API). Prefer {@link postVectorIndexEstimateSession} for UI. */
|
|
488
|
+
getVectorIndexEstimate(): Promise<VectorIndexEstimate>;
|
|
489
|
+
/** Start background estimate (202); cancel prior session for this tenant. */
|
|
490
|
+
postVectorIndexEstimateSession(): Promise<VectorIndexEstimate>;
|
|
491
|
+
getVectorIndexEstimateSession(sessionId: string): Promise<VectorIndexEstimate>;
|
|
492
|
+
deleteVectorIndexEstimateSession(sessionId: string): Promise<{
|
|
493
|
+
status?: string;
|
|
494
|
+
}>;
|
|
495
|
+
/**
|
|
496
|
+
* RAG over indexed documents (`POST /api/v1/rag/query` with JSON body).
|
|
497
|
+
* Requires LLM completion; embedding required when retrieval uses semantic or hybrid.
|
|
498
|
+
*/
|
|
499
|
+
ragQuery(options: Omit<RagQueryOptions, 'stream'>): Promise<RagQueryResult>;
|
|
500
|
+
/**
|
|
501
|
+
* Streaming RAG (`POST /api/v1/rag/query` with `stream: true`). Parses SSE `data: {...}` lines.
|
|
502
|
+
* The final event has `done: true` and may include `sources`.
|
|
503
|
+
*/
|
|
504
|
+
ragQueryStream(options: Omit<RagQueryOptions, 'stream'>, onEvent: (ev: RagStreamEvent) => void): Promise<void>;
|
|
389
505
|
writeJsonDocument(identifier: string, data: unknown): Promise<void>;
|
|
390
506
|
readJsonDocument<T = unknown>(identifier: string): Promise<T>;
|
|
391
507
|
deleteJsonDocument(identifier: string): Promise<void>;
|