@qaecy/cue-sdk 0.0.50 → 0.0.53
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 +17623 -26418
- package/{document-filter-C9Og2u8R.js → document-filter-CBrY09DH.js} +2574 -1681
- package/index.d.ts +9 -3
- package/index.js +59 -39
- package/lib/api.d.ts +42 -8
- package/lib/auth.d.ts +9 -0
- package/lib/cue.d.ts +1 -1
- package/lib/data-sources.d.ts +223 -2
- package/lib/documents.d.ts +1 -1
- package/lib/entities.d.ts +137 -5
- package/lib/extraction.d.ts +4 -3
- package/lib/gis.d.ts +1 -1
- package/lib/index-api.d.ts +61 -4
- package/lib/llm-tools.d.ts +262 -0
- package/lib/models.d.ts +167 -16
- package/lib/privileges.d.ts +1 -0
- package/lib/profile.d.ts +1 -11
- package/lib/project-schema.d.ts +25 -0
- package/lib/project.d.ts +22 -8
- package/lib/schema-suggestion.d.ts +81 -0
- package/lib/semantic-template.d.ts +61 -0
- package/lib/sync.d.ts +14 -4
- package/node.js +61 -41
- package/package.json +1 -1
- package/variables.d.ts +7 -4
package/lib/models.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SupportedCurrency } from './currency';
|
|
2
|
-
import { ComparisonResult } from '
|
|
2
|
+
import { ComparisonResult } from '../../sync-tools/src/index';
|
|
3
3
|
export type CueEnvironment = 'production' | 'emulator';
|
|
4
4
|
export interface CueEndpoints {
|
|
5
5
|
/** API gateway base URL */
|
|
@@ -12,10 +12,6 @@ export interface CueEndpoints {
|
|
|
12
12
|
storageEmulatorHost: string;
|
|
13
13
|
/** Firebase Storage emulator port (emulator mode only, default: 9199) */
|
|
14
14
|
storageEmulatorPort: number;
|
|
15
|
-
/** Firebase Firestore emulator hostname, no protocol (emulator mode only, default: 'localhost') */
|
|
16
|
-
firestoreEmulatorHost: string;
|
|
17
|
-
/** Firebase Firestore emulator port (emulator mode only, default: 8080) */
|
|
18
|
-
firestoreEmulatorPort: number;
|
|
19
15
|
}
|
|
20
16
|
export interface CueSdkConfig {
|
|
21
17
|
/** Firebase API key for this project. Defaults to the QAECY demo app if omitted. */
|
|
@@ -122,11 +118,13 @@ export interface McpContext {
|
|
|
122
118
|
* Deliberately a sibling of `graph`, not a new `graph.type` value: `cue` is not
|
|
123
119
|
* a graph backend. `databases-cue` owns all three engines, so `graph.type:
|
|
124
120
|
* 'cue'` would say "the graph lives at cue" while leaving vector and FTS
|
|
125
|
-
* pointed
|
|
126
|
-
*
|
|
127
|
-
*
|
|
121
|
+
* pointed elsewhere — two owners for one project, which is the exact split this
|
|
122
|
+
* field exists to prevent. See the monorepo's `apps/databases/cue/PLAN.md` §9b.
|
|
123
|
+
*
|
|
124
|
+
* A union of one: `cue` is the only owner left, and the type is kept so that a
|
|
125
|
+
* second deployment of it stays expressible without changing every call site.
|
|
128
126
|
*/
|
|
129
|
-
export type IndexService = '
|
|
127
|
+
export type IndexService = 'cue';
|
|
130
128
|
export interface IndexSettings {
|
|
131
129
|
service: IndexService;
|
|
132
130
|
/**
|
|
@@ -145,10 +143,7 @@ export interface ProjectSettings {
|
|
|
145
143
|
type: 'qlever' | 'fuseki';
|
|
146
144
|
uri?: string;
|
|
147
145
|
};
|
|
148
|
-
/**
|
|
149
|
-
* Absent means `writers-index` — every project predating this field is on it,
|
|
150
|
-
* so the default has to be the status quo, not the new service.
|
|
151
|
-
*/
|
|
146
|
+
/** Absent means the deployment's configured `index_default_service`. */
|
|
152
147
|
index?: IndexSettings;
|
|
153
148
|
/** Processing tier determining credit costs. Defaults to "l" if not set. */
|
|
154
149
|
tier?: 's' | 'm' | 'l';
|
|
@@ -161,6 +156,23 @@ export interface ProjectSettings {
|
|
|
161
156
|
* project) — set it directly on the project's Firestore doc.
|
|
162
157
|
*/
|
|
163
158
|
gzipEnabled?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* BCP-47 tags the project works in, and the single source of that answer.
|
|
161
|
+
*
|
|
162
|
+
* `en` is the pivot: every label map carries it, it is what an untranslated
|
|
163
|
+
* literal falls back to, and it is therefore never a translation *target*. It
|
|
164
|
+
* is implied whether or not it is stored, so `['da']` and `['en','da']` mean
|
|
165
|
+
* the same thing — both readers normalize to `['en','da']`.
|
|
166
|
+
*
|
|
167
|
+
* Absent means English only, which is what every project resolved to before
|
|
168
|
+
* this field existed.
|
|
169
|
+
*
|
|
170
|
+
* Read by `writers-commands` (stamped onto `ProjectSchema.languages` on every
|
|
171
|
+
* schema write), the schema-suggestion endpoint (which languages a proposed
|
|
172
|
+
* term is translated into), and the translation enricher (its targets, minus
|
|
173
|
+
* the pivot).
|
|
174
|
+
*/
|
|
175
|
+
languages?: string[];
|
|
164
176
|
}
|
|
165
177
|
/** One daily snapshot in `QleverStats.history` — a calendar day this index's stats were (re)computed. */
|
|
166
178
|
export interface QleverStatsHistoryEntry {
|
|
@@ -171,13 +183,22 @@ export interface QleverStatsHistoryEntry {
|
|
|
171
183
|
numSubjects: number | null;
|
|
172
184
|
numPredicates: number | null;
|
|
173
185
|
numObjects: number | null;
|
|
174
|
-
|
|
186
|
+
graphSizeInBytes: number | null;
|
|
175
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* A project's index stats, sourced from `databases-cue`'s `/stats/project`.
|
|
190
|
+
* Field names follow `databases-cue`'s shape (`graphSizeInBytes`, plus
|
|
191
|
+
* `fts`/`vector`/`ledgerSizeInBytes`) rather than the legacy `indexSizeBytes` —
|
|
192
|
+
* this is also exactly the shape `cue-ui`'s `ProjectInsights`
|
|
193
|
+
* (`views/project-workspace/models.ts`) expects.
|
|
194
|
+
*/
|
|
176
195
|
export interface QleverStats {
|
|
177
196
|
/** ISO timestamp of when this index was first created (init or clone) — null for indexes built before this field existed. */
|
|
178
197
|
created: string | null;
|
|
179
198
|
builtAt: string | null;
|
|
180
199
|
qleverVersion: string | null;
|
|
200
|
+
/** QLever CLI version currently deployed — compare against `qleverVersion` to tell whether this project's index needs `migrate()`. */
|
|
201
|
+
currentQleverVersion: string | null;
|
|
181
202
|
numTriples: number | null;
|
|
182
203
|
numSubjects: number | null;
|
|
183
204
|
numPredicates: number | null;
|
|
@@ -185,7 +206,19 @@ export interface QleverStats {
|
|
|
185
206
|
numDocuments: number | null;
|
|
186
207
|
/** ISO timestamp of the last build whose triple/subject/predicate counts actually differed from the build before it. */
|
|
187
208
|
lastChanged: string | null;
|
|
188
|
-
|
|
209
|
+
graphSizeInBytes: number | null;
|
|
210
|
+
/** FTS (Tantivy) index size, in bytes. */
|
|
211
|
+
ftsSizeInBytes: number | null;
|
|
212
|
+
/** Vector (LanceDB) index size, in bytes. */
|
|
213
|
+
vectorSizeInBytes: number | null;
|
|
214
|
+
/** Total size of the RDF ledger backing this project, in bytes. */
|
|
215
|
+
ledgerSizeInBytes: number | null;
|
|
216
|
+
/**
|
|
217
|
+
* True when at least one engine holding real data has been evicted to cloud
|
|
218
|
+
* storage and deleted locally by the sync-bridge's idle sweep —
|
|
219
|
+
* `CueIndexApi.warmUp` restores it.
|
|
220
|
+
*/
|
|
221
|
+
idled: boolean;
|
|
189
222
|
updateFractionPct: number | null;
|
|
190
223
|
lastQueriedAt: string | null;
|
|
191
224
|
resolvedMentions: number | null;
|
|
@@ -229,6 +262,11 @@ export interface CreateProjectOptions {
|
|
|
229
262
|
graphType?: 'fuseki' | 'qlever';
|
|
230
263
|
/** Processing tier determining credit costs. */
|
|
231
264
|
tier?: 's' | 'm' | 'l';
|
|
265
|
+
/**
|
|
266
|
+
* BCP-47 tags the project works in. See {@link ProjectSettings.languages} —
|
|
267
|
+
* normalized server-side, so omitting `en` is the same as naming it.
|
|
268
|
+
*/
|
|
269
|
+
languages?: string[];
|
|
232
270
|
}
|
|
233
271
|
export interface ProjectLocation {
|
|
234
272
|
lat: number;
|
|
@@ -891,8 +929,12 @@ export interface EntityCoreData {
|
|
|
891
929
|
}
|
|
892
930
|
/** A single directed relationship edge between two entities. */
|
|
893
931
|
export interface EntityRelationship {
|
|
894
|
-
/** IRI of the property used (e.g. `qcy:
|
|
932
|
+
/** IRI of the property used — one of the five groups (e.g. `qcy:involves`). */
|
|
895
933
|
relIRI: string;
|
|
934
|
+
/** IRI of the relation category that says which relation this is, when one was named. */
|
|
935
|
+
categoryIRI?: string;
|
|
936
|
+
/** What the source document said about this relation, when there is a note. */
|
|
937
|
+
note?: string;
|
|
896
938
|
/** Full IRI of the related entity. */
|
|
897
939
|
nodeIRI: string;
|
|
898
940
|
/** Label of the related entity. */
|
|
@@ -954,6 +996,115 @@ export interface SummaryGraphData {
|
|
|
954
996
|
weight: number;
|
|
955
997
|
}>;
|
|
956
998
|
}
|
|
999
|
+
/**
|
|
1000
|
+
* One entity category that at least one `qcy:EntityPrototype` belongs to,
|
|
1001
|
+
* with the number of prototypes carrying it.
|
|
1002
|
+
*
|
|
1003
|
+
* Unlike `contentCategoriesInProject`, the count is a field of its own rather
|
|
1004
|
+
* than being folded into `label` — the prototype browser renders the two
|
|
1005
|
+
* separately.
|
|
1006
|
+
*/
|
|
1007
|
+
export interface PrototypeCategoryCount {
|
|
1008
|
+
iri: string;
|
|
1009
|
+
/**
|
|
1010
|
+
* `skos:prefLabel` in the active language when the category has one. The IFC
|
|
1011
|
+
* processor mints category IRIs from the BEO class list, so most carry no
|
|
1012
|
+
* label at all; those fall back to the IRI fragment.
|
|
1013
|
+
*/
|
|
1014
|
+
label: string;
|
|
1015
|
+
/** Number of distinct prototypes in this category. */
|
|
1016
|
+
count: number;
|
|
1017
|
+
}
|
|
1018
|
+
/** One `qcy:EntityPrototype`, as listed under a category. */
|
|
1019
|
+
export interface PrototypeSummary {
|
|
1020
|
+
iri: string;
|
|
1021
|
+
uuid: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* `qcy:value` — the type object's name. Empty when the IFC type object had no
|
|
1024
|
+
* `Name`/`ElementType`/`PredefinedType`, which the writer allows.
|
|
1025
|
+
*/
|
|
1026
|
+
value: string;
|
|
1027
|
+
/** Number of entities pointing here with `qcy:inheritsFrom`. */
|
|
1028
|
+
instanceCount: number;
|
|
1029
|
+
}
|
|
1030
|
+
/** One `qcy:Property` hanging off a prototype (or any other entity). */
|
|
1031
|
+
export interface PrototypeProperty {
|
|
1032
|
+
iri: string;
|
|
1033
|
+
/** `qcy:label` — an untagged literal, so no language filtering applies. */
|
|
1034
|
+
label: string;
|
|
1035
|
+
/** `qcy:value`, stringified. The writer types these (`xsd:double`, …). */
|
|
1036
|
+
value: string;
|
|
1037
|
+
/** `qcy:unit` — only the polygon-area path emits one, so usually absent. */
|
|
1038
|
+
unit?: string;
|
|
1039
|
+
/** `qcy:ifcPSet` — the IFC property set this came from. */
|
|
1040
|
+
pset?: string;
|
|
1041
|
+
}
|
|
1042
|
+
/** One entity inheriting from a prototype via `qcy:inheritsFrom`. */
|
|
1043
|
+
export interface PrototypeInstance {
|
|
1044
|
+
iri: string;
|
|
1045
|
+
uuid: string;
|
|
1046
|
+
value: string;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* One entity located inside one source model, as resolved from a
|
|
1050
|
+
* `qcy:IFCExpressIDSelector`.
|
|
1051
|
+
*
|
|
1052
|
+
* An entity can appear in several models (a federated project mentions the same
|
|
1053
|
+
* canonical entity from each of them), so a single requested IRI can yield more
|
|
1054
|
+
* than one of these.
|
|
1055
|
+
*/
|
|
1056
|
+
export interface EntityModelLocation {
|
|
1057
|
+
/** The IRI that was asked about — a mention or a canonical entity. */
|
|
1058
|
+
requestedIri: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* The IRI the selector actually points at (`qcy:selectorObject`). Equal to
|
|
1061
|
+
* `requestedIri` for a mention; the mention behind it when a canonical entity
|
|
1062
|
+
* was requested and the `qcy:resolvesTo` hop was taken.
|
|
1063
|
+
*/
|
|
1064
|
+
mentionIri: string;
|
|
1065
|
+
/** `qcy:selectorSubject` — the model's `qcy:FileContent` IRI. */
|
|
1066
|
+
modelIri: string;
|
|
1067
|
+
/** UUID of that model — the key `CueProjectDocuments` and storage take. */
|
|
1068
|
+
modelUuid: string;
|
|
1069
|
+
/** `qcy:value` of the selector, parsed. The handle `cue-ifc-viewer` selects on. */
|
|
1070
|
+
expressId: number;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* The express IDs of a set of entities that live in one model, ready to hand to
|
|
1074
|
+
* a viewer alongside that model's file.
|
|
1075
|
+
*/
|
|
1076
|
+
export interface ModelExpressIds {
|
|
1077
|
+
/** `qcy:FileContent` IRI of the model. */
|
|
1078
|
+
modelIri: string;
|
|
1079
|
+
/** UUID of that model. */
|
|
1080
|
+
modelUuid: string;
|
|
1081
|
+
/** Ascending, de-duplicated. */
|
|
1082
|
+
expressIds: number[];
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* One prototype's occurrences inside one model, as returned for a whole entity
|
|
1086
|
+
* category at once — enough to colour every prototype in that category
|
|
1087
|
+
* differently in a single pass.
|
|
1088
|
+
*/
|
|
1089
|
+
export interface PrototypeCategoryExpressIds extends ModelExpressIds {
|
|
1090
|
+
/** The `qcy:EntityPrototype` the express IDs inherit from. */
|
|
1091
|
+
prototypeIri: string;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* The entity behind one express ID, with the prototype and category it belongs
|
|
1095
|
+
* to — the reverse of `entityExpressIds`, for turning a click in a model viewer
|
|
1096
|
+
* back into something the graph can be browsed by.
|
|
1097
|
+
*/
|
|
1098
|
+
export interface EntityAtExpressId {
|
|
1099
|
+
/** The `qcy:EntityMention` the selector points at. */
|
|
1100
|
+
entityIri: string;
|
|
1101
|
+
/** `qcy:value` of that entity, or an empty string when it carries none. */
|
|
1102
|
+
value: string;
|
|
1103
|
+
/** The `qcy:EntityPrototype` it inherits from, when it has one. */
|
|
1104
|
+
prototypeIri?: string;
|
|
1105
|
+
/** The prototype's entity category, when the prototype carries one. */
|
|
1106
|
+
categoryIri?: string;
|
|
1107
|
+
}
|
|
957
1108
|
/** Core metadata for a single document (FileContent node). */
|
|
958
1109
|
export interface DocumentInfo {
|
|
959
1110
|
id: string;
|
package/lib/privileges.d.ts
CHANGED
package/lib/profile.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { UserInfo } from 'firebase/auth';
|
|
2
|
-
import { FirebaseApp } from 'firebase/app';
|
|
3
2
|
import { APIKeyDoc, APIKeyInfo, FileTypeBreakdownDto, OrgConsumptionReportDto, OrgCreditsDto, OrgMember, OrganizationData, ProfileSSOAccount, TrafficReportDto, UsageReportDto } from './models';
|
|
4
3
|
import { CueAuth } from './auth';
|
|
5
4
|
import { ReadonlySignal } from './signal';
|
|
6
5
|
export declare class CueProfile {
|
|
7
6
|
private readonly _auth;
|
|
8
7
|
private readonly _gatewayUrl;
|
|
9
|
-
private readonly _functions;
|
|
10
8
|
private readonly _orgCredits;
|
|
11
9
|
/**
|
|
12
10
|
* Reactive view of the last-fetched org credit pool. Updated automatically
|
|
@@ -17,7 +15,7 @@ export declare class CueProfile {
|
|
|
17
15
|
* `effect(() => sig.set(cue.profile.orgCredits.get()))` + `.subscribe(...)`.
|
|
18
16
|
*/
|
|
19
17
|
readonly orgCredits: ReadonlySignal<OrgCreditsDto | undefined>;
|
|
20
|
-
constructor(_auth: CueAuth,
|
|
18
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
21
19
|
private _url;
|
|
22
20
|
private _fetch;
|
|
23
21
|
/** Whether the current user has an active API key. */
|
|
@@ -145,14 +143,6 @@ export declare class CueProfile {
|
|
|
145
143
|
checkoutUrl?: string;
|
|
146
144
|
}>;
|
|
147
145
|
private _requireUser;
|
|
148
|
-
/**
|
|
149
|
-
* Fetch display name and email for a list of user UIDs.
|
|
150
|
-
* Uses the `getUserInfo` Firebase callable function.
|
|
151
|
-
*/
|
|
152
|
-
getUserInfo(uids: string[]): Promise<Record<string, {
|
|
153
|
-
name: string;
|
|
154
|
-
email: string;
|
|
155
|
-
}>>;
|
|
156
146
|
/** Record that the current user has accepted the terms of service. Sets a `terms` custom claim on the token. */
|
|
157
147
|
acceptTerms(version: string): Promise<void>;
|
|
158
148
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The project-schema DTO, re-exported so consumers outside the monorepo can
|
|
3
|
+
* reach it.
|
|
4
|
+
*
|
|
5
|
+
* `js/models` is a monorepo-internal tsconfig path — there is no `@qaecy/models`
|
|
6
|
+
* package — so cue-ui and any other external consumer can only see these shapes
|
|
7
|
+
* through this barrel. The alternative is a third hand-written copy of the DTO,
|
|
8
|
+
* and the parity test (`libs/py/shared-types/tests/test_project_schema_parity.py`)
|
|
9
|
+
* only guards two: the TypeScript source and its Python twin. So nothing outside
|
|
10
|
+
* declares its own.
|
|
11
|
+
*
|
|
12
|
+
* Two names are renamed on the way out, because the SDK already owns them:
|
|
13
|
+
*
|
|
14
|
+
* - `LangMap` -> `SchemaLangMap`. The SDK's own {@link LangMap} is the
|
|
15
|
+
* *graph-read* shape, which adds a `default` key that always resolves to
|
|
16
|
+
* English. The DTO's is the *document* shape, where `en` is the pivot and is
|
|
17
|
+
* always present and there is no `default`. Both are legitimate; a consumer
|
|
18
|
+
* must not be able to pass one where the other is meant.
|
|
19
|
+
* - `Kind` -> `SchemaTermKind`, which says what it is: the IRI segment a term's
|
|
20
|
+
* kind contributes (`e` / `c` / `p`).
|
|
21
|
+
* - `AltLabelMap` -> `SchemaAltLabelMap`, for the same reason as `LangMap`: a
|
|
22
|
+
* name the SDK might otherwise want for something else.
|
|
23
|
+
*/
|
|
24
|
+
export { CatalogKind, Provenance, CanonicalPolicy, ResolutionIdentity, NumeralRole, EmbeddingBasis, Kind as SchemaTermKind, DEFAULT_SCHEMA_BASE, CORE_PREFIXES, isCurie, deriveIri, expandCurie, resolveRef, resolveIri, rdfBase, schemaGraphIri, } from '../../models/src/index';
|
|
25
|
+
export type { LangMap as SchemaLangMap, AltLabelMap as SchemaAltLabelMap, Ref as SchemaRef, ResolutionRules, Canonical, EntityCategory, RelationCategory, ContentCategory, CodingScheme, CodingSchemeField, ProjectSchema, Catalog, CatalogIndex, CatalogIndexEntry, MimeCategoryTerm, MimeDeclaration, } from '../../models/src/index';
|
package/lib/project.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { FirebaseApp } from 'firebase/app';
|
|
2
1
|
import { CueAuth } from './auth';
|
|
3
2
|
import { CreateProjectOptions, CueEndpoints, ProjectData, ProjectMetadata } from './models';
|
|
4
3
|
import { ReadonlySignal } from './signal';
|
|
5
4
|
type ProjectRole = 'admin' | 'syncer' | 'member';
|
|
5
|
+
/** What `updateProject` accepts. Every field optional; omitted means unchanged. */
|
|
6
|
+
export interface ProjectUpdate {
|
|
7
|
+
name?: string;
|
|
8
|
+
isPublic?: boolean;
|
|
9
|
+
/** BCP-47 tags. See {@link ProjectSettings.languages}; normalized server-side. */
|
|
10
|
+
languages?: string[];
|
|
11
|
+
}
|
|
6
12
|
export declare class CueProjects {
|
|
7
13
|
private readonly _auth;
|
|
8
|
-
private readonly _db;
|
|
9
14
|
private readonly _gatewayUrl;
|
|
10
15
|
private readonly _projects;
|
|
11
16
|
/**
|
|
@@ -14,7 +19,7 @@ export declare class CueProjects {
|
|
|
14
19
|
* without every caller having to remember to re-fetch the whole list.
|
|
15
20
|
*/
|
|
16
21
|
readonly projects: ReadonlySignal<ProjectData[] | undefined>;
|
|
17
|
-
constructor(_auth: CueAuth,
|
|
22
|
+
constructor(_auth: CueAuth, endpoints?: CueEndpoints);
|
|
18
23
|
/**
|
|
19
24
|
* Create a new project. The authenticated user is automatically set as admin, syncer, and member.
|
|
20
25
|
* Throws if a project with the given ID already exists.
|
|
@@ -31,11 +36,6 @@ export declare class CueProjects {
|
|
|
31
36
|
* single project look like the user's entire project set.
|
|
32
37
|
*/
|
|
33
38
|
private _patchProject;
|
|
34
|
-
/**
|
|
35
|
-
* Atomically increments `unitsConsumed` on the top-level `clientSync/{projectId}`
|
|
36
|
-
* document, creating it if it doesn't exist. Intended for pre-flight checks.
|
|
37
|
-
*/
|
|
38
|
-
incrementUnitsConsumed(projectId: string, units: number, userId: string): Promise<void>;
|
|
39
39
|
/**
|
|
40
40
|
* Invite a user to a project by email. Returns the invited user's uid.
|
|
41
41
|
* Throws if no account exists yet for that email — the gateway route supports
|
|
@@ -67,6 +67,20 @@ export declare class CueProjects {
|
|
|
67
67
|
* Returns `{}` if none has been set yet.
|
|
68
68
|
*/
|
|
69
69
|
getProjectMetadata(projectId: string): Promise<ProjectMetadata>;
|
|
70
|
+
/**
|
|
71
|
+
* Edits the project itself — name, visibility, and the languages it works in.
|
|
72
|
+
*
|
|
73
|
+
* Project admins and superadmins only; anyone else is refused. Omit a field
|
|
74
|
+
* to leave it as it is.
|
|
75
|
+
*
|
|
76
|
+
* `languages` is normalized server-side: the `en` pivot is always present and
|
|
77
|
+
* always first, order is otherwise preserved and duplicates dropped, so
|
|
78
|
+
* `['da']` and `['en','da']` are the same request. It is the single source of
|
|
79
|
+
* what languages a project works in — a schema write stamps it onto the
|
|
80
|
+
* document, a proposed term is translated into it, and the translation
|
|
81
|
+
* enricher takes its targets from it.
|
|
82
|
+
*/
|
|
83
|
+
updateProject(projectId: string, updates: ProjectUpdate): Promise<ProjectData>;
|
|
70
84
|
/** Sets a project's portal-only metadata. Omit a field to leave it untouched, `null` to clear it. */
|
|
71
85
|
setProjectMetadata(projectId: string, metadata: ProjectMetadata): Promise<void>;
|
|
72
86
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CatalogIndex, ProjectSchema } from '../../models/src/index';
|
|
2
|
+
import { CueAuth } from './auth';
|
|
3
|
+
export declare const ENDPOINT_SCHEMA_SUGGESTION_FROM_PROSE = "/llm-tools/schema-suggestion/from-prose";
|
|
4
|
+
export declare const ENDPOINT_SCHEMA_SUGGESTION_CATALOGS = "/llm-tools/schema-suggestion/catalogs";
|
|
5
|
+
export interface SuggestSchemaFromProseRequest {
|
|
6
|
+
/** A description of the project — a paragraph or two, not a document. */
|
|
7
|
+
prose: string;
|
|
8
|
+
/** Project the request is scoped to, and the one the returned IRIs derive against. */
|
|
9
|
+
projectId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Carried onto the returned schema. The catalogues hold da/de/en/fr/it, and a
|
|
12
|
+
* proposed term is translated in the same call that proposes it, so this is
|
|
13
|
+
* what decides whether a Danish project gets Danish labels on both.
|
|
14
|
+
*
|
|
15
|
+
* The endpoint does **not** look the project's languages up — it falls back
|
|
16
|
+
* to `['en']` alone. Pass the project's own `ProjectSettings.languages`, or
|
|
17
|
+
* a Danish project gets English-only suggestions beside Danish catalogue
|
|
18
|
+
* terms.
|
|
19
|
+
*/
|
|
20
|
+
languages?: string[];
|
|
21
|
+
/** How many catalogues triage may open. Server default is 6; the cap is 12. */
|
|
22
|
+
maxCatalogs?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface SchemaSuggestionUsage {
|
|
25
|
+
/** Catalogue ids triage chose to open, in index order. */
|
|
26
|
+
catalogsOpened: string[];
|
|
27
|
+
/** Entity categories the model could see in the selection call. */
|
|
28
|
+
termsOffered: number;
|
|
29
|
+
/** Entity categories it selected, before reference closure. */
|
|
30
|
+
termsSelected: number;
|
|
31
|
+
/** Entity categories pulled in because a selected one referenced them. */
|
|
32
|
+
termsClosedOver: number;
|
|
33
|
+
tokensIn: number;
|
|
34
|
+
tokensOut: number;
|
|
35
|
+
}
|
|
36
|
+
export interface SuggestSchemaFromProseResponse {
|
|
37
|
+
/**
|
|
38
|
+
* Entity categories only. Document types are a fixed QAECY-maintained
|
|
39
|
+
* taxonomy shared by every project, so `schema.contentCategories` comes back
|
|
40
|
+
* empty and an entity references one by `qcy-e:` CURIE instead.
|
|
41
|
+
*
|
|
42
|
+
* This is a *proposal*, not a saved document: it has never been through
|
|
43
|
+
* `putSchema` and its `revision` means nothing. Merge it into the document
|
|
44
|
+
* you read, then save that.
|
|
45
|
+
*/
|
|
46
|
+
schema: ProjectSchema;
|
|
47
|
+
/** Anything the caller should know: dropped suggestions, refs closed over, a thin selection. */
|
|
48
|
+
notes: string[];
|
|
49
|
+
usage: SchemaSuggestionUsage;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Client for llm-tools' schema-suggestion endpoints — prose in, a proposed
|
|
53
|
+
* `ProjectSchema` out, assembled by selecting from the published catalogues
|
|
54
|
+
* rather than by having a model retype curated terms.
|
|
55
|
+
*
|
|
56
|
+
* Exposed as `cue.api.schemaSuggestion`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class CueSchemaSuggestion {
|
|
59
|
+
private readonly _auth;
|
|
60
|
+
private readonly _gatewayUrl;
|
|
61
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
62
|
+
/**
|
|
63
|
+
* Turns a project description into a proposed schema of entity categories.
|
|
64
|
+
*
|
|
65
|
+
* Two model calls: triage picks which catalogues are worth opening from the
|
|
66
|
+
* index alone, selection picks terms out of digests of just those. Selected
|
|
67
|
+
* terms are hydrated from the catalogue JSON verbatim, so their prompts and
|
|
68
|
+
* label maps arrive intact.
|
|
69
|
+
*/
|
|
70
|
+
fromProse(request: SuggestSchemaFromProseRequest): Promise<SuggestSchemaFromProseResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* The catalogue index triage sees: ids, labels, term counts and the file each
|
|
73
|
+
* one lives in.
|
|
74
|
+
*
|
|
75
|
+
* Worth calling on its own to show the same map a user's suggestion was drawn
|
|
76
|
+
* from, or to check that a deploy actually reaches the catalogue bucket —
|
|
77
|
+
* an empty index is the failure mode, and it is silent from `fromProse` alone.
|
|
78
|
+
*/
|
|
79
|
+
catalogs(projectId: string): Promise<CatalogIndex>;
|
|
80
|
+
private _errorMessage;
|
|
81
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EntityCategory, ProjectSchema } from '../../models/src/index';
|
|
1
2
|
import { CueAuth } from './auth';
|
|
2
3
|
export interface MutationResult {
|
|
3
4
|
message: string;
|
|
@@ -31,6 +32,26 @@ export interface EntityRelationshipInput extends EntityCategoryInput {
|
|
|
31
32
|
sources: string[];
|
|
32
33
|
targets: string[];
|
|
33
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* One project the caller could take an existing schema from — what
|
|
37
|
+
* `listSchemaSources` lists.
|
|
38
|
+
*
|
|
39
|
+
* Counts rather than terms: the picker needs to say which project and how much
|
|
40
|
+
* is in it, and the document itself is one `getSchema(projectId)` away once the
|
|
41
|
+
* user has chosen. Projects with a schema that has no terms are not listed at
|
|
42
|
+
* all, so every entry here copies something.
|
|
43
|
+
*/
|
|
44
|
+
export interface SchemaSource {
|
|
45
|
+
projectId: string;
|
|
46
|
+
projectName: string;
|
|
47
|
+
/** The source document's revision, not the destination's. */
|
|
48
|
+
revision: number;
|
|
49
|
+
updatedAt?: string;
|
|
50
|
+
sourceLanguage: string;
|
|
51
|
+
languages: string[];
|
|
52
|
+
entityCategories: number;
|
|
53
|
+
relations: number;
|
|
54
|
+
}
|
|
34
55
|
/**
|
|
35
56
|
* Client for writers-commands' semantic-template CRUD endpoints — persists a
|
|
36
57
|
* project's custom extraction/classification schema (content categories,
|
|
@@ -55,8 +76,48 @@ export declare class CueSemanticTemplate {
|
|
|
55
76
|
createEntityRelationshipBatch(projectId: string, items: EntityRelationshipInput[]): Promise<BatchMutationResult>;
|
|
56
77
|
deleteEntityRelationship(projectId: string, value: string): Promise<MutationResult>;
|
|
57
78
|
deleteEntityRelationshipBatch(projectId: string, values: string[]): Promise<BatchMutationResult>;
|
|
79
|
+
/**
|
|
80
|
+
* The project's `ProjectSchema` — the document that replaces the semantic
|
|
81
|
+
* extraction template, migrated from it on first read.
|
|
82
|
+
*
|
|
83
|
+
* Read the document rather than the schema graph: `provenance`, `catalog`,
|
|
84
|
+
* `canonicalPolicy` and the `iri` pin exist only here, and `provenance` is
|
|
85
|
+
* what decides which fields a user is allowed to edit.
|
|
86
|
+
*/
|
|
87
|
+
getSchema(projectId: string): Promise<ProjectSchema>;
|
|
88
|
+
/**
|
|
89
|
+
* Replaces the whole document.
|
|
90
|
+
*
|
|
91
|
+
* `schema.revision` is the concurrency token: pass back the one you read. A
|
|
92
|
+
* stale revision is refused with 409 rather than overwriting whatever landed
|
|
93
|
+
* in between, so re-read and re-apply rather than retrying the same body.
|
|
94
|
+
*
|
|
95
|
+
* The response carries the saved document with its revision bumped — use it
|
|
96
|
+
* as the new baseline.
|
|
97
|
+
*/
|
|
98
|
+
putSchema(projectId: string, schema: ProjectSchema): Promise<ProjectSchema>;
|
|
99
|
+
/**
|
|
100
|
+
* The caller's *other* projects that already have a schema, so a new project
|
|
101
|
+
* can start from one instead of from prose.
|
|
102
|
+
*
|
|
103
|
+
* `projectId` is the destination — the project being set up — and is excluded
|
|
104
|
+
* from its own answer. What comes back is scoped to the caller's memberships
|
|
105
|
+
* server-side, so this never reveals a project they are not on.
|
|
106
|
+
*
|
|
107
|
+
* Reading a chosen source is plain `getSchema(source.projectId)`: the gateway
|
|
108
|
+
* authorizes that call by membership on that project, which the caller has by
|
|
109
|
+
* virtue of it being listed here.
|
|
110
|
+
*/
|
|
111
|
+
listSchemaSources(projectId: string): Promise<SchemaSource[]>;
|
|
112
|
+
/**
|
|
113
|
+
* The QAECY catalogues' non-deprecated entity categories, for the wizard's "use default"
|
|
114
|
+
* starting point — the same list for every caller, nothing project-specific about it.
|
|
115
|
+
*/
|
|
116
|
+
getDefaultEntities(projectId: string): Promise<EntityCategory[]>;
|
|
58
117
|
/** Re-pushes the project's currently stored template into its `databases-cue` schema graph, without mutating it. */
|
|
59
118
|
reloadSchema(projectId: string): Promise<MutationResult>;
|
|
119
|
+
private _get;
|
|
120
|
+
private _send;
|
|
60
121
|
private _post;
|
|
61
122
|
private _delete;
|
|
62
123
|
private _errorMessage;
|
package/lib/sync.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CueBlobStorage } from '
|
|
2
|
-
import { LocalFile } from '
|
|
1
|
+
import { CueBlobStorage } from '../../databases/src/index';
|
|
2
|
+
import { LocalFile } from '../../sync-tools/src/index';
|
|
3
3
|
import { CueAuth } from './auth';
|
|
4
4
|
import { CueApi } from './api';
|
|
5
5
|
import { CueProfile } from './profile';
|
|
@@ -137,7 +137,12 @@ export declare class CueSyncApi {
|
|
|
137
137
|
*
|
|
138
138
|
* @param file - `LocalFile` with `data` populated (e.g. from `File.arrayBuffer()`).
|
|
139
139
|
* @param options - Upload options including project/provider/user context and an
|
|
140
|
-
* optional `AbortSignal` for cancellation and `onProgress` for tracking.
|
|
140
|
+
* optional `AbortSignal` for cancellation and `onProgress` for tracking. Set
|
|
141
|
+
* `skipProcessing` to keep the standard per-suffix processor pipeline from
|
|
142
|
+
* picking this file up (e.g. when the caller already parsed it itself).
|
|
143
|
+
* @returns The identifiers `uploadedFileMetadata` derived for this file, so
|
|
144
|
+
* callers that need to reference the document immediately (e.g. to attach
|
|
145
|
+
* an alternative representation) don't have to recompute them.
|
|
141
146
|
*/
|
|
142
147
|
syncBrowserFile(file: LocalFile, options: {
|
|
143
148
|
spaceId: string;
|
|
@@ -145,7 +150,12 @@ export declare class CueSyncApi {
|
|
|
145
150
|
userId: string;
|
|
146
151
|
signal?: AbortSignal;
|
|
147
152
|
onProgress?: (percent: number) => void;
|
|
148
|
-
|
|
153
|
+
skipProcessing?: boolean;
|
|
154
|
+
}): Promise<{
|
|
155
|
+
documentUUID: string;
|
|
156
|
+
blob_name: string;
|
|
157
|
+
suffix: string;
|
|
158
|
+
}>;
|
|
149
159
|
getTierNames(): Promise<Record<string, string>>;
|
|
150
160
|
/**
|
|
151
161
|
* Per-extension credit rates for `tier` (e.g. `{ pdf: 4, ifc: 2, dwg: 2 }`),
|