@qaecy/cue-sdk 0.0.37 → 0.0.39
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/browser.js +48048 -0
- package/{document-filter-BNui_ucF.js → document-filter-CuDPYi7U.js} +1766 -1057
- package/index.d.ts +8 -2
- package/index.js +35 -32
- package/lib/admin.d.ts +109 -0
- package/lib/api.d.ts +6 -0
- package/lib/cue.d.ts +5 -0
- package/lib/data-sources.d.ts +186 -0
- package/lib/index-api.d.ts +8 -6
- package/lib/llm-tools.d.ts +64 -0
- package/lib/models.d.ts +338 -2
- package/lib/privileges.d.ts +4 -0
- package/lib/processing.d.ts +29 -3
- package/lib/profile.d.ts +44 -2
- package/lib/project.d.ts +21 -4
- package/lib/usage-stats.d.ts +19 -0
- package/node.js +36 -33
- package/package.json +1 -1
- package/variables.d.ts +41 -1
package/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type { McpCallOptions } from './lib/mcp';
|
|
|
13
13
|
export type { IndexSearchRequest, IndexItem, IndexSearchResponse, IndexFilterOption, IndexAppliedFilters, AvailableFiltersResponse, SearchFilter, DocumentFilterOption, AvailableDocumentFilters, } from './lib/models';
|
|
14
14
|
export { CueSyncApi, configureScanWasm } from './lib/sync';
|
|
15
15
|
export { CueProcessingApi } from './lib/processing';
|
|
16
|
-
export type { ProcessingStatusWatcher } from './lib/processing';
|
|
16
|
+
export type { ProcessingStatusWatcher, MyProcessingStatusWatcher } from './lib/processing';
|
|
17
17
|
export { CueDmsApi } from './lib/dms';
|
|
18
18
|
export type { DmsProviderInfo, DmsRemoteFile, DmsSyncPreviewResponse } from './lib/models';
|
|
19
19
|
export { CueProjectSchema } from './lib/schema';
|
|
@@ -24,6 +24,8 @@ export { CueProjectView } from './lib/project-view';
|
|
|
24
24
|
export type { CueProjectViewOptions } from './lib/project-view';
|
|
25
25
|
export { CueProjects } from './lib/project';
|
|
26
26
|
export { CueProfile } from './lib/profile';
|
|
27
|
+
export { CueAdmin } from './lib/admin';
|
|
28
|
+
export type { AdminOrgSearchResult, AdminUserSearchResult, AdminProjectSearchResult, AdminUserOrgSummary, AdminUserProjectSummary, AdminUserDetail, AdminDeletedUserOrgRef, AdminDeletedUserProjectRef, AdminDeletedUserSummary, AdminRestoreUserResult, } from './lib/models';
|
|
27
29
|
export { CuePrivileges, REQUIRED_ROLES } from './lib/privileges';
|
|
28
30
|
export type { UserProjectRole, Privileges } from './lib/privileges';
|
|
29
31
|
export { CueSignal, cueComputed } from './lib/signal';
|
|
@@ -32,12 +34,16 @@ export { CueCache } from './lib/cache';
|
|
|
32
34
|
export type { QueryCacheEntry } from './lib/cache';
|
|
33
35
|
export { CueCurrency, SUPPORTED_CURRENCIES, BASE_CURRENCY } from './lib/currency';
|
|
34
36
|
export type { SupportedCurrency, CurrencyRates } from './lib/currency';
|
|
35
|
-
export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, SearchResponse, SearchSource, SearchOptions, ProjectData, ProjectSettings, QleverStats, CreateProjectOptions, SyncOptions, SyncResult, SyncPreview, ScanOutputRecord, UnitCreditMap, UnitsConsumedDto, OrgCreditsDto, OrgPlanSummary, MonthlyConsumptionDto, ProjectConsumptionReportDto, OrgConsumptionReportDto, FileTypeConsumptionDto, FileTypeBreakdownDto, OrganizationData, OrgMember, ProfileSSOAccount, APIKeyInfo, APIKeyDoc, ProjectDoc, OrganizationDoc, UserDoc, UserSettings, CustomAppRecord, CustomAppWithHtml, CreateCustomAppOptions, UpdateCustomAppOptions, RDFWritingDoc, ProcessingStatus, ProcessingStage, ViewDefinition, QueryCache, LangMap, CategoryDef, RelationshipDef, EntityCoreData, EntityRelationship, EntityRelationships, MapGeometry, EntityDetailedData, ProjectEntitiesData, SummaryGraphData, DocumentInfo, DocumentSummary, ProjectDocumentsData, } from './lib/models';
|
|
37
|
+
export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, SearchResponse, SearchSource, SearchOptions, ProjectData, ProjectSettings, QleverStats, CreateProjectOptions, SyncOptions, SyncResult, SyncPreview, ScanOutputRecord, UnitCreditMap, UnitsConsumedDto, OrgCreditsDto, OrgPlanSummary, MonthlyConsumptionDto, ProjectConsumptionReportDto, OrgConsumptionReportDto, FileTypeConsumptionDto, FileTypeBreakdownDto, RouteTrafficDto, DayTrafficDto, MonthTrafficDto, TrafficReportDto, ViewUsageDto, DayUsageDto, MonthUsageDto, UsageReportDto, OrganizationData, OrgMember, ProfileSSOAccount, APIKeyInfo, APIKeyDoc, ProjectDoc, OrganizationDoc, UserDoc, UserSettings, CustomAppRecord, CustomAppWithHtml, CreateCustomAppOptions, UpdateCustomAppOptions, RDFWritingDoc, ProcessingStatus, ProcessingStage, DocumentProcessingStage, DocumentProgress, ProjectProcessingSummary, MyProcessingStatus, DocumentReprocessJob, ReprocessJobStatus, ViewDefinition, QueryCache, LangMap, CategoryDef, RelationshipDef, EntityCoreData, EntityRelationship, EntityRelationships, MapGeometry, EntityDetailedData, ProjectEntitiesData, SummaryGraphData, DocumentInfo, DocumentSummary, ProjectDocumentsData, } from './lib/models';
|
|
36
38
|
export type { AuthStateListener, Unsubscribe } from './lib/auth';
|
|
37
39
|
export { CueTables } from './lib/tables';
|
|
38
40
|
export type { ProjectTable } from './lib/tables';
|
|
39
41
|
export { CueExtraction } from './lib/extraction';
|
|
40
42
|
export type { ExtractionRequest, ExtractionResponse } from './lib/extraction';
|
|
43
|
+
export { CueLlmTools } from './lib/llm-tools';
|
|
44
|
+
export type { GenerateWranglingSchemaRequest, GenerateWranglingSchemaResponse } from './lib/llm-tools';
|
|
45
|
+
export { CueDataSources } from './lib/data-sources';
|
|
46
|
+
export type { DataSourceRecord, XToRdfConfig, RmlXToRdfConfig, GraphXToRdfConfig, TypeMappingConfiguration, UploadDataSourceMode, UploadDataSourceResult, } from './lib/data-sources';
|
|
41
47
|
export { CueContexts } from './lib/contexts';
|
|
42
48
|
export type { ContextDoc, ContextItem, McpContext } from './lib/models';
|
|
43
49
|
export { CueAppData } from './lib/app-data';
|
package/index.js
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import { B as a, C as u, a as C, b as t, c as r, d as i, e as
|
|
1
|
+
import { B as a, C as u, a as C, b as t, c as r, d as i, e as o, f as c, g as n, h as p, i as S, j as E, k as A, l as m, m as P, n as R, o as g, p as l, q as D, r as j, s as U, t as x, u as d, v as f, w as h, x as I, y, z as T, A as _, D as b, E as q, F as v, G as w, R as B, S as F, H as G, I as L } from "./document-filter-CuDPYi7U.js";
|
|
2
2
|
export {
|
|
3
3
|
a as BASE_CURRENCY,
|
|
4
4
|
u as Cue,
|
|
5
|
-
C as
|
|
6
|
-
t as
|
|
7
|
-
r as
|
|
8
|
-
i as
|
|
5
|
+
C as CueAdmin,
|
|
6
|
+
t as CueApi,
|
|
7
|
+
r as CueAppData,
|
|
8
|
+
i as CueApps,
|
|
9
|
+
o as CueAuth,
|
|
9
10
|
c as CueCache,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
E as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
P as
|
|
17
|
-
R as
|
|
18
|
-
g as
|
|
19
|
-
|
|
20
|
-
D as
|
|
21
|
-
j as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
f as
|
|
26
|
-
h as
|
|
27
|
-
|
|
28
|
-
y as
|
|
29
|
-
|
|
30
|
-
_ as
|
|
31
|
-
b as
|
|
32
|
-
q as
|
|
33
|
-
v as
|
|
34
|
-
w as
|
|
35
|
-
B as
|
|
36
|
-
F as
|
|
11
|
+
n as CueContexts,
|
|
12
|
+
p as CueCurrency,
|
|
13
|
+
S as CueDataSources,
|
|
14
|
+
E as CueDmsApi,
|
|
15
|
+
A as CueDocumentFilter,
|
|
16
|
+
m as CueExtraction,
|
|
17
|
+
P as CueGis,
|
|
18
|
+
R as CueIndexApi,
|
|
19
|
+
g as CueLlmTools,
|
|
20
|
+
l as CueMcp,
|
|
21
|
+
D as CuePrivileges,
|
|
22
|
+
j as CueProcessingApi,
|
|
23
|
+
U as CueProfile,
|
|
24
|
+
x as CueProjectDocuments,
|
|
25
|
+
d as CueProjectEntities,
|
|
26
|
+
f as CueProjectSchema,
|
|
27
|
+
h as CueProjectView,
|
|
28
|
+
I as CueProjects,
|
|
29
|
+
y as CueRequestError,
|
|
30
|
+
T as CueSignUp,
|
|
31
|
+
_ as CueSignal,
|
|
32
|
+
b as CueStorage,
|
|
33
|
+
q as CueSyncApi,
|
|
34
|
+
v as CueTables,
|
|
35
|
+
w as CueUserSettings,
|
|
36
|
+
B as REQUIRED_ROLES,
|
|
37
|
+
F as SUPPORTED_CURRENCIES,
|
|
38
|
+
G as configureScanWasm,
|
|
39
|
+
L as cueComputed
|
|
37
40
|
};
|
package/lib/admin.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CueAuth } from './auth';
|
|
2
|
+
import { AdminDeletedOrganizationSummary, AdminDeletedUserSummary, AdminOrganization, AdminOrgSearchResult, AdminOrphanedOrganization, AdminOrphanedProject, AdminOrphanedUser, AdminProjectSearchResult, AdminRestoreOrganizationResult, AdminRestoreUserResult, AdminUserDetail, AdminUserSearchResult, OrganizationData, ProjectData } from './models';
|
|
3
|
+
/**
|
|
4
|
+
* Cross-organisation lookup for platform superadmins.
|
|
5
|
+
*
|
|
6
|
+
* Every method here reaches data outside the caller's own orgs and projects, so
|
|
7
|
+
* each backing endpoint is `@SuperAdminsOnly()` — a non-superadmin caller gets a
|
|
8
|
+
* 403, not a filtered result set. Check `cue.auth.isSuperAdmin` before surfacing
|
|
9
|
+
* any UI that calls into this.
|
|
10
|
+
*
|
|
11
|
+
* Search is substring matching done server-side over a capped scan (Firestore
|
|
12
|
+
* has no substring index), so results are best-effort rather than exhaustive on
|
|
13
|
+
* very large collections — see the service-side notes in `data-views`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* if (cue.auth.isSuperAdmin.get()) {
|
|
18
|
+
* const orgs = await cue.admin.searchOrganizations('acme');
|
|
19
|
+
* const detail = await cue.admin.getUserDetail(orgs[0].id);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class CueAdmin {
|
|
24
|
+
private readonly _auth;
|
|
25
|
+
private readonly _gatewayUrl;
|
|
26
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
27
|
+
private _fetch;
|
|
28
|
+
private _search;
|
|
29
|
+
/** Matches organisations on name, id or any alternative id. */
|
|
30
|
+
searchOrganizations(q: string): Promise<AdminOrgSearchResult[]>;
|
|
31
|
+
/** Matches users on display name, e-mail, or an exact uid. */
|
|
32
|
+
searchUsers(q: string): Promise<AdminUserSearchResult[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Matches projects on name, id or any alternative id, across every organisation.
|
|
35
|
+
* Soft-deleted projects are excluded unless `includeDeleted` is set.
|
|
36
|
+
*/
|
|
37
|
+
searchProjects(q: string, includeDeleted?: boolean): Promise<AdminProjectSearchResult[]>;
|
|
38
|
+
/** Full profile for one user: auth record, orgs and projects they belong to. */
|
|
39
|
+
getUserDetail(uid: string): Promise<AdminUserDetail>;
|
|
40
|
+
/** Every organisation on the platform. Unpaginated — prefer `searchOrganizations`. */
|
|
41
|
+
listOrganizations(): Promise<OrganizationData[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Every project owned by `orgId`, regardless of the caller's membership.
|
|
44
|
+
* Unlike `cue.projects.listProjects()` (which lists by direct project
|
|
45
|
+
* membership) this is what lets a superadmin open a foreign org's projects.
|
|
46
|
+
*/
|
|
47
|
+
listOrgProjects(orgId: string): Promise<ProjectData[]>;
|
|
48
|
+
/** Every user holding the `superadmin` custom claim. */
|
|
49
|
+
listSuperadmins(): Promise<AdminUserSearchResult[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Deletes the Auth account and profile doc, and scrubs every org/project
|
|
52
|
+
* membership. Archives a restorable snapshot first (see `restoreUser`) unless
|
|
53
|
+
* `hard` is set, which skips the archive entirely — intended for e2e test
|
|
54
|
+
* teardown, not normal superadmin use, since a hard delete cannot be undone.
|
|
55
|
+
*/
|
|
56
|
+
deleteUser(uid: string, hard?: boolean): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Undoes `deleteUser`: recreates the Auth account (same uid) and profile doc,
|
|
59
|
+
* and re-grants the recorded org/project roles where those still exist.
|
|
60
|
+
*/
|
|
61
|
+
restoreUser(uid: string): Promise<AdminRestoreUserResult>;
|
|
62
|
+
/** Every archived deletion, restored or not — newest first. */
|
|
63
|
+
listDeletedUsers(): Promise<AdminDeletedUserSummary[]>;
|
|
64
|
+
/** Creates a Firebase Auth account with no organisation — for picking as a new org's initial admin. */
|
|
65
|
+
createAdminUser(dto: {
|
|
66
|
+
name: string;
|
|
67
|
+
email: string;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
uid: string;
|
|
70
|
+
email: string;
|
|
71
|
+
name: string;
|
|
72
|
+
}>;
|
|
73
|
+
/** Grants the `superadmin` custom claim. The user must sign in again for it to take effect. */
|
|
74
|
+
grantSuperadmin(uid: string): Promise<void>;
|
|
75
|
+
/** Revokes the `superadmin` custom claim. */
|
|
76
|
+
revokeSuperadmin(uid: string): Promise<void>;
|
|
77
|
+
/** Creates a new organisation with `adminUserId` as its sole admin/member. */
|
|
78
|
+
createOrganization(dto: {
|
|
79
|
+
name: string;
|
|
80
|
+
domains: string[];
|
|
81
|
+
adminUserId: string;
|
|
82
|
+
}): Promise<AdminOrganization>;
|
|
83
|
+
/** Sets an organisation's allowed email domains for auto-join sign-up. */
|
|
84
|
+
setOrgDomains(orgId: string, domains: string[]): Promise<OrganizationData>;
|
|
85
|
+
/**
|
|
86
|
+
* Soft-deletes an organisation: flags it deleted (its `admins`/`members` stay
|
|
87
|
+
* intact as a relationship snapshot for `restoreOrganization`) and cascades —
|
|
88
|
+
* every active project under it is soft-deleted, and every admin/member with
|
|
89
|
+
* no *other* org membership is soft-deleted too (their own restorable
|
|
90
|
+
* snapshot, same as a direct `deleteUser`).
|
|
91
|
+
*/
|
|
92
|
+
deleteOrganization(orgId: string): Promise<void>;
|
|
93
|
+
/** Undoes `deleteOrganization`: restores cascaded projects/users where they still can be, then un-flags the org. */
|
|
94
|
+
restoreOrganization(orgId: string): Promise<AdminRestoreOrganizationResult>;
|
|
95
|
+
/** Every soft-deleted organisation, restored or not — newest first. */
|
|
96
|
+
listDeletedOrganizations(): Promise<AdminDeletedOrganizationSummary[]>;
|
|
97
|
+
/** Users belonging to no organisation — a data-health diagnostic, not paginated. */
|
|
98
|
+
listUsersWithoutOrg(): Promise<AdminOrphanedUser[]>;
|
|
99
|
+
/** Users belonging to no project — a data-health diagnostic, not paginated. */
|
|
100
|
+
listUsersWithoutProject(): Promise<AdminOrphanedUser[]>;
|
|
101
|
+
/** Projects with no members, syncers, or admins — a data-health diagnostic. */
|
|
102
|
+
listProjectsWithoutUsers(): Promise<AdminOrphanedProject[]>;
|
|
103
|
+
/** Projects with no admin (may still have members/syncers) — a data-health diagnostic. */
|
|
104
|
+
listProjectsWithoutAdmins(): Promise<AdminOrphanedProject[]>;
|
|
105
|
+
/** Organisations with no members — a data-health diagnostic. */
|
|
106
|
+
listOrgsWithoutUsers(): Promise<AdminOrphanedOrganization[]>;
|
|
107
|
+
/** Organisations with no admin (may still have members) — a data-health diagnostic. */
|
|
108
|
+
listOrgsWithoutAdmins(): Promise<AdminOrphanedOrganization[]>;
|
|
109
|
+
}
|
package/lib/api.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { CueApps } from './apps';
|
|
|
12
12
|
import { CueUserSettings } from './user-settings';
|
|
13
13
|
import { CueProcessingApi } from './processing';
|
|
14
14
|
import { CueDmsApi } from './dms';
|
|
15
|
+
import { CueLlmTools } from './llm-tools';
|
|
16
|
+
import { CueDataSources } from './data-sources';
|
|
15
17
|
export declare class CueApi {
|
|
16
18
|
private readonly _auth;
|
|
17
19
|
private readonly _gatewayUrl;
|
|
@@ -36,6 +38,10 @@ export declare class CueApi {
|
|
|
36
38
|
readonly processing: CueProcessingApi;
|
|
37
39
|
/** Sync files into a project from a 3rd-party DMS (e.g. ThinkProject). */
|
|
38
40
|
readonly dms: CueDmsApi;
|
|
41
|
+
/** Guarded LLM endpoints (llm-tools) — prompt-driven helpers like data-wrangling schema generation. */
|
|
42
|
+
readonly llmTools: CueLlmTools;
|
|
43
|
+
/** Project-scoped data sources — reusable raw-data-to-RDF pipelines writing into their own named graph. */
|
|
44
|
+
readonly dataSources: CueDataSources;
|
|
39
45
|
/** Active language used for language-sensitive SPARQL queries across all project classes. */
|
|
40
46
|
language: string;
|
|
41
47
|
/** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
|
package/lib/cue.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { CueApi } from './api';
|
|
|
8
8
|
import { CueGis } from './gis';
|
|
9
9
|
import { CueProjects } from './project';
|
|
10
10
|
import { CueProfile } from './profile';
|
|
11
|
+
import { CueUsageStats } from './usage-stats';
|
|
12
|
+
import { CueAdmin } from './admin';
|
|
11
13
|
import { CuePrivileges } from './privileges';
|
|
12
14
|
import { CueCache } from './cache';
|
|
13
15
|
import { CueCurrency } from './currency';
|
|
@@ -30,6 +32,9 @@ export declare class Cue {
|
|
|
30
32
|
readonly api: CueApi;
|
|
31
33
|
readonly projects: CueProjects;
|
|
32
34
|
readonly profile: CueProfile;
|
|
35
|
+
readonly usageStats: CueUsageStats;
|
|
36
|
+
/** Cross-org lookup for platform superadmins — every call 403s for anyone else. */
|
|
37
|
+
readonly admin: CueAdmin;
|
|
33
38
|
readonly privileges: CuePrivileges;
|
|
34
39
|
readonly cache: CueCache;
|
|
35
40
|
readonly storage: CueStorage;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { CueAuth } from './auth';
|
|
2
|
+
export type XToRdfConfig = RmlXToRdfConfig | GraphXToRdfConfig | DecompositionConfig;
|
|
3
|
+
interface XToRdfConfigBase {
|
|
4
|
+
/** Steps run on the transform's output, in order — see `XToRdfPostProcessingStep`. */
|
|
5
|
+
postProcessing?: XToRdfPostProcessingStep[];
|
|
6
|
+
}
|
|
7
|
+
export interface RmlXToRdfConfig extends XToRdfConfigBase {
|
|
8
|
+
type: 'rml';
|
|
9
|
+
yarrrml?: string;
|
|
10
|
+
rml?: string;
|
|
11
|
+
options?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface GraphXToRdfConfig extends XToRdfConfigBase {
|
|
14
|
+
type: 'graph';
|
|
15
|
+
constructQuery: string;
|
|
16
|
+
/**
|
|
17
|
+
* cue-ui's tuner-x-to-rdf wizard's saved type/relation mapping selection that
|
|
18
|
+
* produced constructQuery — lets a UI fully reopen the visual wizard for
|
|
19
|
+
* editing instead of only showing raw SPARQL text. Opaque to the SDK itself.
|
|
20
|
+
*/
|
|
21
|
+
wizardConfig?: TypeMappingConfiguration;
|
|
22
|
+
}
|
|
23
|
+
export interface DecompositionConfig extends XToRdfConfigBase {
|
|
24
|
+
type: 'decomposition';
|
|
25
|
+
/**
|
|
26
|
+
* The `@context` `graph` and `frame` are written against — no longer a fixed constant once
|
|
27
|
+
* relationship predicates are user-chosen (a reversed relationship needs its own `@reverse`
|
|
28
|
+
* alias term). Opaque to the SDK itself.
|
|
29
|
+
*/
|
|
30
|
+
context: Record<string, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* FLAT JSON-LD: one node object per canonical entity, no embedding — a building broken into
|
|
33
|
+
* storeys and spaces, a system into subsystems and components, an organization into
|
|
34
|
+
* departments and teams, or any other hierarchy a project needs. Containment is edges
|
|
35
|
+
* (`{'@id': ...}` references under each level's own relationship predicate), the actual RDF
|
|
36
|
+
* this decomposition produces. See cue-ui's spatial-decomposition component's `JsonLdNode`
|
|
37
|
+
* for the shape this always follows in practice. Opaque to the SDK itself.
|
|
38
|
+
*/
|
|
39
|
+
graph: Record<string, unknown>[];
|
|
40
|
+
/**
|
|
41
|
+
* A real JSON-LD Frame that reconstitutes the hierarchy from `graph` — the declarative,
|
|
42
|
+
* standards-based artifact any JSON-LD processor can apply, unlike `levels` below which is
|
|
43
|
+
* specific to cue-ui's editor. Always regenerated from `levels` on save. Opaque to the SDK.
|
|
44
|
+
*/
|
|
45
|
+
frame: Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Root-to-leaf tiers of the hierarchy (label, category IRI, the relationship connecting each
|
|
48
|
+
* tier to its parent, and how that tier's nodes were created — geographic/floor-plan/manual)
|
|
49
|
+
* — lets the frontend reopen the editor with the same configuration it was built with, and is
|
|
50
|
+
* what `frame` above is derived from. Opaque to the SDK itself.
|
|
51
|
+
*/
|
|
52
|
+
levels: Record<string, unknown>[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A step applied to a transform's *output*, after the CONSTRUCT query (or RML mapping) has run.
|
|
56
|
+
*
|
|
57
|
+
* Recorded in the config rather than hardcoded in the pipeline so a data source is
|
|
58
|
+
* self-describing: what a stored mapping does to its input is not the query alone, and neither a
|
|
59
|
+
* human reading the config nor a future engine should have to know about an implicit post-pass.
|
|
60
|
+
* Order is significant. An absent `postProcessing` means "the default for this config type" —
|
|
61
|
+
* see `_postProcessingSteps` in writers-commands' data-sources.service.ts, which is also where the legacy
|
|
62
|
+
* behaviour for configs saved before this field existed is pinned down.
|
|
63
|
+
*/
|
|
64
|
+
export type XToRdfPostProcessingStep = MintCanonicalEntitiesStep;
|
|
65
|
+
/**
|
|
66
|
+
* Rewrites every constructed subject that carries both `qcy:value` and `qcy:hasEntityCategory`
|
|
67
|
+
* onto a deterministic IRI derived from that pair (`<rdfBase><projectId>/<uuidv5(value+category)>`),
|
|
68
|
+
* rewrites every other reference to it, and adds a `qcy:similarTo` link back to the source IRI.
|
|
69
|
+
*
|
|
70
|
+
* Deriving the IRI from the value rather than the source document is what makes an `add` upload
|
|
71
|
+
* idempotent: the same entity arriving again — re-uploaded, exported under a different source
|
|
72
|
+
* IRI, or split across several files — resolves to the same IRI and merges instead of creating a
|
|
73
|
+
* second instance.
|
|
74
|
+
*/
|
|
75
|
+
export interface MintCanonicalEntitiesStep {
|
|
76
|
+
type: 'mint-canonical-entities';
|
|
77
|
+
/**
|
|
78
|
+
* Revision of the IRI derivation itself. Bumped only if that derivation changes, so an
|
|
79
|
+
* existing data source keeps producing the IRIs it was built against instead of silently
|
|
80
|
+
* re-keying everything already in its named graph.
|
|
81
|
+
*/
|
|
82
|
+
version: 1;
|
|
83
|
+
}
|
|
84
|
+
/** Mirrors cue-ui's tuner-x-to-rdf `TypeMappingConfiguration` exactly. */
|
|
85
|
+
export interface TypeMappingConfiguration {
|
|
86
|
+
id?: string;
|
|
87
|
+
name: string;
|
|
88
|
+
typeMappings: {
|
|
89
|
+
typeIri: string;
|
|
90
|
+
categoryIri: string;
|
|
91
|
+
}[];
|
|
92
|
+
relationMappings: {
|
|
93
|
+
sourceTypeIri: string;
|
|
94
|
+
targetTypeIri: string;
|
|
95
|
+
predicateIri: string;
|
|
96
|
+
reversed?: boolean;
|
|
97
|
+
}[];
|
|
98
|
+
}
|
|
99
|
+
export interface DataSourceRecord {
|
|
100
|
+
id: string;
|
|
101
|
+
projectId: string;
|
|
102
|
+
name: string;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
createdBy: string;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
updatedBy: string;
|
|
107
|
+
/** Named graph all of this data source's derived triples live in. */
|
|
108
|
+
namedGraph: string;
|
|
109
|
+
/** Triple count in `namedGraph` as of the last successful upload — a cache updated after every
|
|
110
|
+
* upload, not computed live on read. */
|
|
111
|
+
tripleCount: number;
|
|
112
|
+
/** When data was last uploaded to this source; null until the first upload. */
|
|
113
|
+
lastUploadedAt: string | null;
|
|
114
|
+
config: XToRdfConfig;
|
|
115
|
+
}
|
|
116
|
+
export type UploadDataSourceMode = 'replace' | 'add';
|
|
117
|
+
export interface UploadDataSourceResult {
|
|
118
|
+
added: number;
|
|
119
|
+
removed: number;
|
|
120
|
+
}
|
|
121
|
+
/** Live status reported while `uploadData`/`previewTransform` are in flight — any
|
|
122
|
+
* number of these arrive via `onProgress` before the call resolves or rejects. */
|
|
123
|
+
export interface DataSourceProgressEvent {
|
|
124
|
+
phase: string;
|
|
125
|
+
message: string;
|
|
126
|
+
pct?: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Client for project-scoped data sources — a named, reusable raw-data-to-RDF
|
|
130
|
+
* pipeline whose config (RML mapping or CONSTRUCT query) is stored once and
|
|
131
|
+
* re-applied to every subsequent data upload. Uploaded data's derived triples
|
|
132
|
+
* land in the data source's own named graph.
|
|
133
|
+
*
|
|
134
|
+
* Mutations (create/update/delete/uploadData) go through writers-commands and
|
|
135
|
+
* require the syncer role; reads (list/get) go through data-views.
|
|
136
|
+
*
|
|
137
|
+
* Exposed as `cue.api.dataSources`.
|
|
138
|
+
*/
|
|
139
|
+
export declare class CueDataSources {
|
|
140
|
+
private readonly _auth;
|
|
141
|
+
private readonly _gatewayUrl;
|
|
142
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
143
|
+
createDataSource(projectId: string, name: string, config: XToRdfConfig): Promise<DataSourceRecord>;
|
|
144
|
+
updateDataSource(projectId: string, id: string, updates: {
|
|
145
|
+
name?: string;
|
|
146
|
+
config?: XToRdfConfig;
|
|
147
|
+
}): Promise<DataSourceRecord>;
|
|
148
|
+
/** Hard delete — also removes the data source's triples from the graph/ledger. */
|
|
149
|
+
deleteDataSource(projectId: string, id: string): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Uploads new data to be transformed by the data source's stored config and
|
|
152
|
+
* committed into its named graph. `mode: 'replace'` swaps out everything
|
|
153
|
+
* previously derived from this source; `'add'` merges alongside it.
|
|
154
|
+
*
|
|
155
|
+
* `files` may contain more than one document — for `type: 'graph'` configs
|
|
156
|
+
* they're all loaded into one shared graph server-side before the stored
|
|
157
|
+
* CONSTRUCT query runs against it. `type: 'rml'` configs expect exactly one.
|
|
158
|
+
*
|
|
159
|
+
* The endpoint streams NDJSON progress while the upload is in flight — pass
|
|
160
|
+
* `onProgress` to receive it. The call still resolves/rejects only once, with
|
|
161
|
+
* the final result or an `Error` built from the stream's `error` line (a
|
|
162
|
+
* non-2xx HTTP status, e.g. an auth/guard rejection before the handler even
|
|
163
|
+
* runs, is still thrown from `response.ok` as before).
|
|
164
|
+
*/
|
|
165
|
+
uploadData(projectId: string, id: string, files: Blob[], mode: UploadDataSourceMode, onProgress?: (event: DataSourceProgressEvent) => void): Promise<UploadDataSourceResult>;
|
|
166
|
+
/**
|
|
167
|
+
* Dry-run: runs `config` against `files` and returns the resulting Turtle,
|
|
168
|
+
* without creating a data source or writing anything to the graph/ledger —
|
|
169
|
+
* for previewing a transform (e.g. while building a CONSTRUCT query or RML
|
|
170
|
+
* mapping) before saving it. Same transform code as `uploadData`, so a
|
|
171
|
+
* preview never drifts from what an actual upload would produce. Streams
|
|
172
|
+
* progress the same way — see `uploadData`'s doc comment.
|
|
173
|
+
*/
|
|
174
|
+
previewTransform(projectId: string, config: XToRdfConfig, files: Blob[], onProgress?: (event: DataSourceProgressEvent) => void): Promise<{
|
|
175
|
+
turtle: string;
|
|
176
|
+
}>;
|
|
177
|
+
/** Reads an NDJSON response (`{type:'progress',...}` lines, then one `{type:'result',...}`
|
|
178
|
+
* or `{type:'error',...}` line), forwarding progress events to `onProgress` and
|
|
179
|
+
* resolving/rejecting with the terminal event. The HTTP status alone can't signal
|
|
180
|
+
* failure here — the server commits to 200 as soon as the first line is written. */
|
|
181
|
+
private _consumeNdjsonResult;
|
|
182
|
+
listDataSources(projectId: string): Promise<DataSourceRecord[]>;
|
|
183
|
+
getDataSource(projectId: string, id: string): Promise<DataSourceRecord>;
|
|
184
|
+
private _errorMessage;
|
|
185
|
+
}
|
|
186
|
+
export {};
|
package/lib/index-api.d.ts
CHANGED
|
@@ -29,11 +29,13 @@ export declare class CueIndexApi {
|
|
|
29
29
|
*/
|
|
30
30
|
rebuild(projectId: string, onProgress?: (message: string) => void): Promise<string>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
* Recomputes QLever stats (document count, materialized views, index size)
|
|
33
|
+
* from the index and persists the result, bypassing the normal cache TTL.
|
|
34
|
+
* Super-admin only. Resolves with a summary message.
|
|
35
|
+
*
|
|
36
|
+
* Pass `projectId` to refresh that project alone — the usual case, and much
|
|
37
|
+
* cheaper. Omit it to re-scan EVERY project on the volume, which costs several
|
|
38
|
+
* SPARQL queries per index and can run for minutes.
|
|
37
39
|
*/
|
|
38
|
-
refreshStats(): Promise<string>;
|
|
40
|
+
refreshStats(projectId?: string): Promise<string>;
|
|
39
41
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CueAuth } from './auth';
|
|
2
|
+
export declare const ENDPOINT_WRANGLING_SCHEMA_GENERATE = "/llm-tools/wrangling-schema/generate";
|
|
3
|
+
export declare const ENDPOINT_WRANGLING_SCHEMA_REFINE = "/llm-tools/wrangling-schema/refine";
|
|
4
|
+
export interface GenerateWranglingSchemaRequest {
|
|
5
|
+
/** Plain-language instruction for how the sheet should be reshaped. */
|
|
6
|
+
prompt: string;
|
|
7
|
+
/** Column names available in the sheet. */
|
|
8
|
+
columns: string[];
|
|
9
|
+
/** A handful of real rows, given as worked examples for the model. */
|
|
10
|
+
exampleRows: Record<string, unknown>[];
|
|
11
|
+
/** Project the request is scoped to. */
|
|
12
|
+
projectId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GenerateWranglingSchemaResponse {
|
|
15
|
+
/**
|
|
16
|
+
* Plain objects shaped like cue-ui's `WranglingRule` (splitCell | formula).
|
|
17
|
+
* Run through cue-ui's `normalizeWranglingSettings` before use — the model's
|
|
18
|
+
* output isn't guaranteed to be a well-formed rule set.
|
|
19
|
+
*/
|
|
20
|
+
rules: Record<string, unknown>[];
|
|
21
|
+
}
|
|
22
|
+
export interface RefineWranglingSchemaRequest {
|
|
23
|
+
/** The instruction that produced `currentRules`. */
|
|
24
|
+
previousPrompt: string;
|
|
25
|
+
/** The rule set currently in effect — may include manual edits since `previousPrompt`. */
|
|
26
|
+
currentRules: Record<string, unknown>[];
|
|
27
|
+
/** The new, follow-up instruction. */
|
|
28
|
+
prompt: string;
|
|
29
|
+
/** Column names available in the sheet. */
|
|
30
|
+
columns: string[];
|
|
31
|
+
/** A handful of real rows, given as worked examples for the model. */
|
|
32
|
+
exampleRows: Record<string, unknown>[];
|
|
33
|
+
/** Project the request is scoped to. */
|
|
34
|
+
projectId: string;
|
|
35
|
+
}
|
|
36
|
+
export interface RefineWranglingSchemaResponse {
|
|
37
|
+
/** The complete, updated rule set — a replacement, not a diff. Same shape as `generate`'s. */
|
|
38
|
+
rules: Record<string, unknown>[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Client for the llm-tools guarded-LLM endpoints — small, single-purpose
|
|
42
|
+
* backend calls that turn a prompt plus example data into a structured JSON
|
|
43
|
+
* result, each backed by its own internal system instructions.
|
|
44
|
+
*
|
|
45
|
+
* Exposed as `cue.api.llmTools`.
|
|
46
|
+
*/
|
|
47
|
+
export declare class CueLlmTools {
|
|
48
|
+
private readonly _auth;
|
|
49
|
+
private readonly _gatewayUrl;
|
|
50
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
51
|
+
/**
|
|
52
|
+
* Generates a data-wrangling rule set (the `splitCell`/`formula` rules cue-ui's
|
|
53
|
+
* `cue-data-wrangler` runs) from a plain-language instruction and a few example
|
|
54
|
+
* rows — for people who don't want to hand-write a regex.
|
|
55
|
+
*/
|
|
56
|
+
generateWranglingSchema(request: GenerateWranglingSchemaRequest): Promise<GenerateWranglingSchemaResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Improves a previously drafted rule set from a follow-up instruction — sends the
|
|
59
|
+
* instruction that produced the current rules alongside the new one and the rules
|
|
60
|
+
* themselves (which may have been hand-edited since), so the model revises rather
|
|
61
|
+
* than starts over.
|
|
62
|
+
*/
|
|
63
|
+
refineWranglingSchema(request: RefineWranglingSchemaRequest): Promise<RefineWranglingSchemaResponse>;
|
|
64
|
+
}
|