@qaecy/cue-sdk 0.0.48 → 0.0.52
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/README.md +10 -10
- package/browser.js +49189 -0
- package/{document-filter-Cj0Yql1C.js → document-filter-BuFNMQwr.js} +2050 -1157
- package/index.d.ts +9 -3
- package/index.js +59 -39
- package/lib/api.d.ts +42 -8
- 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 +172 -17
- package/lib/privileges.d.ts +1 -0
- package/lib/profile.d.ts +0 -8
- package/lib/project-schema.d.ts +25 -0
- package/lib/project.d.ts +21 -0
- 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 +6 -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 */
|
|
@@ -122,11 +122,13 @@ export interface McpContext {
|
|
|
122
122
|
* Deliberately a sibling of `graph`, not a new `graph.type` value: `cue` is not
|
|
123
123
|
* a graph backend. `databases-cue` owns all three engines, so `graph.type:
|
|
124
124
|
* 'cue'` would say "the graph lives at cue" while leaving vector and FTS
|
|
125
|
-
* pointed
|
|
126
|
-
*
|
|
127
|
-
*
|
|
125
|
+
* pointed elsewhere — two owners for one project, which is the exact split this
|
|
126
|
+
* field exists to prevent. See the monorepo's `apps/databases/cue/PLAN.md` §9b.
|
|
127
|
+
*
|
|
128
|
+
* A union of one: `cue` is the only owner left, and the type is kept so that a
|
|
129
|
+
* second deployment of it stays expressible without changing every call site.
|
|
128
130
|
*/
|
|
129
|
-
export type IndexService = '
|
|
131
|
+
export type IndexService = 'cue';
|
|
130
132
|
export interface IndexSettings {
|
|
131
133
|
service: IndexService;
|
|
132
134
|
/**
|
|
@@ -145,22 +147,36 @@ export interface ProjectSettings {
|
|
|
145
147
|
type: 'qlever' | 'fuseki';
|
|
146
148
|
uri?: string;
|
|
147
149
|
};
|
|
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
|
-
*/
|
|
150
|
+
/** Absent means the deployment's configured `index_default_service`. */
|
|
152
151
|
index?: IndexSettings;
|
|
153
152
|
/** Processing tier determining credit costs. Defaults to "l" if not set. */
|
|
154
153
|
tier?: 's' | 'm' | 'l';
|
|
155
154
|
/**
|
|
156
155
|
* Gzip-compress eligible raw uploads for this project (see `gzip-steps.md`
|
|
157
|
-
* Phase 3 —
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* today (same as `tier` on an existing
|
|
161
|
-
* project's Firestore doc.
|
|
156
|
+
* Phase 3). Absent now means ON — the rollout has been verified end-to-end,
|
|
157
|
+
* including against an already-populated production project, so `sync.ts`
|
|
158
|
+
* defaults this to `true`. Set explicitly to `false` to opt a project out.
|
|
159
|
+
* No admin-panel UI toggles this today (same as `tier` on an existing
|
|
160
|
+
* project) — set it directly on the project's Firestore doc.
|
|
162
161
|
*/
|
|
163
162
|
gzipEnabled?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* BCP-47 tags the project works in, and the single source of that answer.
|
|
165
|
+
*
|
|
166
|
+
* `en` is the pivot: every label map carries it, it is what an untranslated
|
|
167
|
+
* literal falls back to, and it is therefore never a translation *target*. It
|
|
168
|
+
* is implied whether or not it is stored, so `['da']` and `['en','da']` mean
|
|
169
|
+
* the same thing — both readers normalize to `['en','da']`.
|
|
170
|
+
*
|
|
171
|
+
* Absent means English only, which is what every project resolved to before
|
|
172
|
+
* this field existed.
|
|
173
|
+
*
|
|
174
|
+
* Read by `writers-commands` (stamped onto `ProjectSchema.languages` on every
|
|
175
|
+
* schema write), the schema-suggestion endpoint (which languages a proposed
|
|
176
|
+
* term is translated into), and the translation enricher (its targets, minus
|
|
177
|
+
* the pivot).
|
|
178
|
+
*/
|
|
179
|
+
languages?: string[];
|
|
164
180
|
}
|
|
165
181
|
/** One daily snapshot in `QleverStats.history` — a calendar day this index's stats were (re)computed. */
|
|
166
182
|
export interface QleverStatsHistoryEntry {
|
|
@@ -171,13 +187,22 @@ export interface QleverStatsHistoryEntry {
|
|
|
171
187
|
numSubjects: number | null;
|
|
172
188
|
numPredicates: number | null;
|
|
173
189
|
numObjects: number | null;
|
|
174
|
-
|
|
190
|
+
graphSizeInBytes: number | null;
|
|
175
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* A project's index stats, sourced from `databases-cue`'s `/stats/project`.
|
|
194
|
+
* Field names follow `databases-cue`'s shape (`graphSizeInBytes`, plus
|
|
195
|
+
* `fts`/`vector`/`ledgerSizeInBytes`) rather than the legacy `indexSizeBytes` —
|
|
196
|
+
* this is also exactly the shape `cue-ui`'s `ProjectInsights`
|
|
197
|
+
* (`views/project-workspace/models.ts`) expects.
|
|
198
|
+
*/
|
|
176
199
|
export interface QleverStats {
|
|
177
200
|
/** ISO timestamp of when this index was first created (init or clone) — null for indexes built before this field existed. */
|
|
178
201
|
created: string | null;
|
|
179
202
|
builtAt: string | null;
|
|
180
203
|
qleverVersion: string | null;
|
|
204
|
+
/** QLever CLI version currently deployed — compare against `qleverVersion` to tell whether this project's index needs `migrate()`. */
|
|
205
|
+
currentQleverVersion: string | null;
|
|
181
206
|
numTriples: number | null;
|
|
182
207
|
numSubjects: number | null;
|
|
183
208
|
numPredicates: number | null;
|
|
@@ -185,7 +210,19 @@ export interface QleverStats {
|
|
|
185
210
|
numDocuments: number | null;
|
|
186
211
|
/** ISO timestamp of the last build whose triple/subject/predicate counts actually differed from the build before it. */
|
|
187
212
|
lastChanged: string | null;
|
|
188
|
-
|
|
213
|
+
graphSizeInBytes: number | null;
|
|
214
|
+
/** FTS (Tantivy) index size, in bytes. */
|
|
215
|
+
ftsSizeInBytes: number | null;
|
|
216
|
+
/** Vector (LanceDB) index size, in bytes. */
|
|
217
|
+
vectorSizeInBytes: number | null;
|
|
218
|
+
/** Total size of the RDF ledger backing this project, in bytes. */
|
|
219
|
+
ledgerSizeInBytes: number | null;
|
|
220
|
+
/**
|
|
221
|
+
* True when at least one engine holding real data has been evicted to cloud
|
|
222
|
+
* storage and deleted locally by the sync-bridge's idle sweep —
|
|
223
|
+
* `CueIndexApi.warmUp` restores it.
|
|
224
|
+
*/
|
|
225
|
+
idled: boolean;
|
|
189
226
|
updateFractionPct: number | null;
|
|
190
227
|
lastQueriedAt: string | null;
|
|
191
228
|
resolvedMentions: number | null;
|
|
@@ -229,6 +266,11 @@ export interface CreateProjectOptions {
|
|
|
229
266
|
graphType?: 'fuseki' | 'qlever';
|
|
230
267
|
/** Processing tier determining credit costs. */
|
|
231
268
|
tier?: 's' | 'm' | 'l';
|
|
269
|
+
/**
|
|
270
|
+
* BCP-47 tags the project works in. See {@link ProjectSettings.languages} —
|
|
271
|
+
* normalized server-side, so omitting `en` is the same as naming it.
|
|
272
|
+
*/
|
|
273
|
+
languages?: string[];
|
|
232
274
|
}
|
|
233
275
|
export interface ProjectLocation {
|
|
234
276
|
lat: number;
|
|
@@ -891,8 +933,12 @@ export interface EntityCoreData {
|
|
|
891
933
|
}
|
|
892
934
|
/** A single directed relationship edge between two entities. */
|
|
893
935
|
export interface EntityRelationship {
|
|
894
|
-
/** IRI of the property used (e.g. `qcy:
|
|
936
|
+
/** IRI of the property used — one of the five groups (e.g. `qcy:involves`). */
|
|
895
937
|
relIRI: string;
|
|
938
|
+
/** IRI of the relation category that says which relation this is, when one was named. */
|
|
939
|
+
categoryIRI?: string;
|
|
940
|
+
/** What the source document said about this relation, when there is a note. */
|
|
941
|
+
note?: string;
|
|
896
942
|
/** Full IRI of the related entity. */
|
|
897
943
|
nodeIRI: string;
|
|
898
944
|
/** Label of the related entity. */
|
|
@@ -954,6 +1000,115 @@ export interface SummaryGraphData {
|
|
|
954
1000
|
weight: number;
|
|
955
1001
|
}>;
|
|
956
1002
|
}
|
|
1003
|
+
/**
|
|
1004
|
+
* One entity category that at least one `qcy:EntityPrototype` belongs to,
|
|
1005
|
+
* with the number of prototypes carrying it.
|
|
1006
|
+
*
|
|
1007
|
+
* Unlike `contentCategoriesInProject`, the count is a field of its own rather
|
|
1008
|
+
* than being folded into `label` — the prototype browser renders the two
|
|
1009
|
+
* separately.
|
|
1010
|
+
*/
|
|
1011
|
+
export interface PrototypeCategoryCount {
|
|
1012
|
+
iri: string;
|
|
1013
|
+
/**
|
|
1014
|
+
* `skos:prefLabel` in the active language when the category has one. The IFC
|
|
1015
|
+
* processor mints category IRIs from the BEO class list, so most carry no
|
|
1016
|
+
* label at all; those fall back to the IRI fragment.
|
|
1017
|
+
*/
|
|
1018
|
+
label: string;
|
|
1019
|
+
/** Number of distinct prototypes in this category. */
|
|
1020
|
+
count: number;
|
|
1021
|
+
}
|
|
1022
|
+
/** One `qcy:EntityPrototype`, as listed under a category. */
|
|
1023
|
+
export interface PrototypeSummary {
|
|
1024
|
+
iri: string;
|
|
1025
|
+
uuid: string;
|
|
1026
|
+
/**
|
|
1027
|
+
* `qcy:value` — the type object's name. Empty when the IFC type object had no
|
|
1028
|
+
* `Name`/`ElementType`/`PredefinedType`, which the writer allows.
|
|
1029
|
+
*/
|
|
1030
|
+
value: string;
|
|
1031
|
+
/** Number of entities pointing here with `qcy:inheritsFrom`. */
|
|
1032
|
+
instanceCount: number;
|
|
1033
|
+
}
|
|
1034
|
+
/** One `qcy:Property` hanging off a prototype (or any other entity). */
|
|
1035
|
+
export interface PrototypeProperty {
|
|
1036
|
+
iri: string;
|
|
1037
|
+
/** `qcy:label` — an untagged literal, so no language filtering applies. */
|
|
1038
|
+
label: string;
|
|
1039
|
+
/** `qcy:value`, stringified. The writer types these (`xsd:double`, …). */
|
|
1040
|
+
value: string;
|
|
1041
|
+
/** `qcy:unit` — only the polygon-area path emits one, so usually absent. */
|
|
1042
|
+
unit?: string;
|
|
1043
|
+
/** `qcy:ifcPSet` — the IFC property set this came from. */
|
|
1044
|
+
pset?: string;
|
|
1045
|
+
}
|
|
1046
|
+
/** One entity inheriting from a prototype via `qcy:inheritsFrom`. */
|
|
1047
|
+
export interface PrototypeInstance {
|
|
1048
|
+
iri: string;
|
|
1049
|
+
uuid: string;
|
|
1050
|
+
value: string;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* One entity located inside one source model, as resolved from a
|
|
1054
|
+
* `qcy:IFCExpressIDSelector`.
|
|
1055
|
+
*
|
|
1056
|
+
* An entity can appear in several models (a federated project mentions the same
|
|
1057
|
+
* canonical entity from each of them), so a single requested IRI can yield more
|
|
1058
|
+
* than one of these.
|
|
1059
|
+
*/
|
|
1060
|
+
export interface EntityModelLocation {
|
|
1061
|
+
/** The IRI that was asked about — a mention or a canonical entity. */
|
|
1062
|
+
requestedIri: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* The IRI the selector actually points at (`qcy:selectorObject`). Equal to
|
|
1065
|
+
* `requestedIri` for a mention; the mention behind it when a canonical entity
|
|
1066
|
+
* was requested and the `qcy:resolvesTo` hop was taken.
|
|
1067
|
+
*/
|
|
1068
|
+
mentionIri: string;
|
|
1069
|
+
/** `qcy:selectorSubject` — the model's `qcy:FileContent` IRI. */
|
|
1070
|
+
modelIri: string;
|
|
1071
|
+
/** UUID of that model — the key `CueProjectDocuments` and storage take. */
|
|
1072
|
+
modelUuid: string;
|
|
1073
|
+
/** `qcy:value` of the selector, parsed. The handle `cue-ifc-viewer` selects on. */
|
|
1074
|
+
expressId: number;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* The express IDs of a set of entities that live in one model, ready to hand to
|
|
1078
|
+
* a viewer alongside that model's file.
|
|
1079
|
+
*/
|
|
1080
|
+
export interface ModelExpressIds {
|
|
1081
|
+
/** `qcy:FileContent` IRI of the model. */
|
|
1082
|
+
modelIri: string;
|
|
1083
|
+
/** UUID of that model. */
|
|
1084
|
+
modelUuid: string;
|
|
1085
|
+
/** Ascending, de-duplicated. */
|
|
1086
|
+
expressIds: number[];
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* One prototype's occurrences inside one model, as returned for a whole entity
|
|
1090
|
+
* category at once — enough to colour every prototype in that category
|
|
1091
|
+
* differently in a single pass.
|
|
1092
|
+
*/
|
|
1093
|
+
export interface PrototypeCategoryExpressIds extends ModelExpressIds {
|
|
1094
|
+
/** The `qcy:EntityPrototype` the express IDs inherit from. */
|
|
1095
|
+
prototypeIri: string;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* The entity behind one express ID, with the prototype and category it belongs
|
|
1099
|
+
* to — the reverse of `entityExpressIds`, for turning a click in a model viewer
|
|
1100
|
+
* back into something the graph can be browsed by.
|
|
1101
|
+
*/
|
|
1102
|
+
export interface EntityAtExpressId {
|
|
1103
|
+
/** The `qcy:EntityMention` the selector points at. */
|
|
1104
|
+
entityIri: string;
|
|
1105
|
+
/** `qcy:value` of that entity, or an empty string when it carries none. */
|
|
1106
|
+
value: string;
|
|
1107
|
+
/** The `qcy:EntityPrototype` it inherits from, when it has one. */
|
|
1108
|
+
prototypeIri?: string;
|
|
1109
|
+
/** The prototype's entity category, when the prototype carries one. */
|
|
1110
|
+
categoryIri?: string;
|
|
1111
|
+
}
|
|
957
1112
|
/** Core metadata for a single document (FileContent node). */
|
|
958
1113
|
export interface DocumentInfo {
|
|
959
1114
|
id: string;
|
package/lib/privileges.d.ts
CHANGED
package/lib/profile.d.ts
CHANGED
|
@@ -145,14 +145,6 @@ export declare class CueProfile {
|
|
|
145
145
|
checkoutUrl?: string;
|
|
146
146
|
}>;
|
|
147
147
|
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
148
|
/** Record that the current user has accepted the terms of service. Sets a `terms` custom claim on the token. */
|
|
157
149
|
acceptTerms(version: string): Promise<void>;
|
|
158
150
|
/**
|
|
@@ -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
|
@@ -3,6 +3,13 @@ import { CueAuth } from './auth';
|
|
|
3
3
|
import { CreateProjectOptions, CueEndpoints, ProjectData, ProjectMetadata } from './models';
|
|
4
4
|
import { ReadonlySignal } from './signal';
|
|
5
5
|
type ProjectRole = 'admin' | 'syncer' | 'member';
|
|
6
|
+
/** What `updateProject` accepts. Every field optional; omitted means unchanged. */
|
|
7
|
+
export interface ProjectUpdate {
|
|
8
|
+
name?: string;
|
|
9
|
+
isPublic?: boolean;
|
|
10
|
+
/** BCP-47 tags. See {@link ProjectSettings.languages}; normalized server-side. */
|
|
11
|
+
languages?: string[];
|
|
12
|
+
}
|
|
6
13
|
export declare class CueProjects {
|
|
7
14
|
private readonly _auth;
|
|
8
15
|
private readonly _db;
|
|
@@ -67,6 +74,20 @@ export declare class CueProjects {
|
|
|
67
74
|
* Returns `{}` if none has been set yet.
|
|
68
75
|
*/
|
|
69
76
|
getProjectMetadata(projectId: string): Promise<ProjectMetadata>;
|
|
77
|
+
/**
|
|
78
|
+
* Edits the project itself — name, visibility, and the languages it works in.
|
|
79
|
+
*
|
|
80
|
+
* Project admins and superadmins only; anyone else is refused. Omit a field
|
|
81
|
+
* to leave it as it is.
|
|
82
|
+
*
|
|
83
|
+
* `languages` is normalized server-side: the `en` pivot is always present and
|
|
84
|
+
* always first, order is otherwise preserved and duplicates dropped, so
|
|
85
|
+
* `['da']` and `['en','da']` are the same request. It is the single source of
|
|
86
|
+
* what languages a project works in — a schema write stamps it onto the
|
|
87
|
+
* document, a proposed term is translated into it, and the translation
|
|
88
|
+
* enricher takes its targets from it.
|
|
89
|
+
*/
|
|
90
|
+
updateProject(projectId: string, updates: ProjectUpdate): Promise<ProjectData>;
|
|
70
91
|
/** Sets a project's portal-only metadata. Omit a field to leave it untouched, `null` to clear it. */
|
|
71
92
|
setProjectMetadata(projectId: string, metadata: ProjectMetadata): Promise<void>;
|
|
72
93
|
}
|
|
@@ -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 }`),
|
package/node.js
CHANGED
|
@@ -1,49 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as
|
|
3
|
-
|
|
1
|
+
import { c as s } from "./document-filter-BuFNMQwr.js";
|
|
2
|
+
import { B as t, C as c, a as n, b as S, d as E, e as m, f as p, g as l, h as A, i as P, j as R, k as d, l as _, m as I, n as g, o as T, p as D, q as N, r as O, s as U, t as G, u as h, v as x, w as f, x as j, y as v, z as M, A as y, D as B, E as F, F as L, G as H, H as b, I as K, J as q, K as w, L as Q, M as V, N as W, O as X, P as Y, Q as k, R as z, S as J, T as Z, U as $, V as ee, W as se, X as ae, Y as ue, Z as Ce, _ as re, $ as ie, a0 as oe, a1 as te, a2 as ce, a3 as ne } from "./document-filter-BuFNMQwr.js";
|
|
3
|
+
import "uuid";
|
|
4
|
+
class r extends s {
|
|
4
5
|
constructor(e) {
|
|
5
6
|
super(e);
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
t as BASE_CURRENCY,
|
|
11
|
+
c as CORE_PREFIXES,
|
|
12
|
+
n as CanonicalPolicy,
|
|
13
|
+
S as CatalogKind,
|
|
10
14
|
s as Cue,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
E as CueAdmin,
|
|
16
|
+
m as CueApi,
|
|
17
|
+
p as CueAppData,
|
|
18
|
+
l as CueApps,
|
|
19
|
+
A as CueAuth,
|
|
20
|
+
P as CueCache,
|
|
21
|
+
R as CueContexts,
|
|
22
|
+
d as CueCurrency,
|
|
23
|
+
_ as CueDataSources,
|
|
24
|
+
I as CueDmsApi,
|
|
25
|
+
g as CueDocumentFilter,
|
|
26
|
+
T as CueExtraction,
|
|
23
27
|
D as CueGis,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
N as CueGisSources,
|
|
29
|
+
O as CueIndexApi,
|
|
30
|
+
U as CueLlmTools,
|
|
31
|
+
G as CueMcp,
|
|
32
|
+
r as CueNode,
|
|
33
|
+
h as CuePrivileges,
|
|
34
|
+
x as CueProcessingApi,
|
|
35
|
+
f as CueProfile,
|
|
36
|
+
j as CueProjectDocuments,
|
|
37
|
+
v as CueProjectEntities,
|
|
38
|
+
M as CueProjectSchema,
|
|
39
|
+
y as CueProjectView,
|
|
40
|
+
B as CueProjects,
|
|
41
|
+
F as CueRequestError,
|
|
42
|
+
L as CueSchemaSuggestion,
|
|
43
|
+
H as CueSemanticTemplate,
|
|
44
|
+
b as CueSignUp,
|
|
45
|
+
K as CueSignal,
|
|
46
|
+
q as CueStorage,
|
|
47
|
+
w as CueSyncApi,
|
|
48
|
+
Q as CueTables,
|
|
49
|
+
V as CueUserSettings,
|
|
50
|
+
W as DEFAULT_SCHEMA_BASE,
|
|
51
|
+
X as ENDPOINT_SCHEMA_SUGGESTION_CATALOGS,
|
|
52
|
+
Y as ENDPOINT_SCHEMA_SUGGESTION_FROM_PROSE,
|
|
53
|
+
k as EmbeddingBasis,
|
|
54
|
+
z as NumeralRole,
|
|
55
|
+
J as Provenance,
|
|
56
|
+
Z as REQUIRED_ROLES,
|
|
57
|
+
$ as ResolutionIdentity,
|
|
58
|
+
ee as SUPPORTED_CURRENCIES,
|
|
59
|
+
se as SchemaTermKind,
|
|
60
|
+
ae as configureScanWasm,
|
|
61
|
+
ue as cueComputed,
|
|
62
|
+
Ce as deriveIri,
|
|
63
|
+
re as expandCurie,
|
|
64
|
+
ie as isCurie,
|
|
65
|
+
oe as rdfBase,
|
|
66
|
+
te as resolveIri,
|
|
67
|
+
ce as resolveRef,
|
|
68
|
+
ne as schemaGraphIri
|
|
49
69
|
};
|