@qaecy/cue-sdk 0.0.26 → 0.0.28

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/index.d.ts CHANGED
@@ -23,3 +23,5 @@ export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, Sea
23
23
  export type { AuthStateListener, Unsubscribe } from './lib/auth';
24
24
  export { CueTables } from './lib/tables';
25
25
  export type { ProjectTable } from './lib/tables';
26
+ export { CueExtraction } from './lib/extraction';
27
+ export type { ExtractionRequest, ExtractionResponse } from './lib/extraction';
package/index.js CHANGED
@@ -1,23 +1,24 @@
1
- import { C as s, a as u, b as C, c as i, d as t, e as c, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as S, n as g, o as h, R as p, p as R, q as f, s as E } from "./cue-BjbRXItA.js";
1
+ import { C as s, a as u, b as C, c as t, d as i, e as c, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as S, n as g, o as h, p, R as E, q as R, r as f, s as d } from "./cue-BR7V1Nem.js";
2
2
  export {
3
3
  s as Cue,
4
4
  u as CueApi,
5
5
  C as CueAuth,
6
- i as CueCache,
7
- t as CueGis,
8
- c as CuePrivileges,
9
- o as CueProfile,
10
- r as CueProjectDocuments,
11
- l as CueProjectEntities,
12
- n as CueProjectSchema,
13
- P as CueProjectView,
14
- j as CueProjects,
15
- m as CueSignal,
16
- S as CueStorage,
17
- g as CueSyncApi,
18
- h as CueTables,
19
- p as REQUIRED_ROLES,
6
+ t as CueCache,
7
+ i as CueExtraction,
8
+ c as CueGis,
9
+ o as CuePrivileges,
10
+ r as CueProfile,
11
+ l as CueProjectDocuments,
12
+ n as CueProjectEntities,
13
+ P as CueProjectSchema,
14
+ j as CueProjectView,
15
+ m as CueProjects,
16
+ S as CueSignal,
17
+ g as CueStorage,
18
+ h as CueSyncApi,
19
+ p as CueTables,
20
+ E as REQUIRED_ROLES,
20
21
  R as configureScanWasm,
21
22
  f as cueComputed,
22
- E as staleWhileRevalidate
23
+ d as staleWhileRevalidate
23
24
  };
package/lib/api.d.ts CHANGED
@@ -3,12 +3,15 @@ import { SearchRequest, SearchResponse, ShaclValidationReport, UnitsConsumedDto
3
3
  import { CueProjects } from './project';
4
4
  import { CueSyncApi } from './sync';
5
5
  import { CueTables } from './tables';
6
+ import { CueExtraction } from './extraction';
6
7
  export declare class CueApi {
7
8
  private readonly _auth;
8
9
  private readonly _gatewayUrl;
9
10
  readonly projects: CueProjects;
10
11
  readonly sync?: CueSyncApi | undefined;
11
12
  readonly tables: CueTables;
13
+ /** Semantic extraction client — call document pages against a SemanticTemplate. */
14
+ readonly extraction: CueExtraction;
12
15
  /** Active language used for language-sensitive SPARQL queries across all project classes. */
13
16
  language: string;
14
17
  /** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
package/lib/auth.d.ts CHANGED
@@ -47,6 +47,8 @@ export declare class CueAuth {
47
47
  checkSuperAdmin(): Promise<boolean>;
48
48
  /** Sign in with a Cue API key. `projectId` is optional — omit it when no project context is available (e.g. admin flows). */
49
49
  signInWithApiKey(cueApiKey: string, projectId?: string): Promise<User>;
50
+ /** Sign in with a Firebase custom token (e.g. minted server-side for MCP/OAuth flows). */
51
+ signInWithCustomToken(token: string): Promise<User>;
50
52
  /** Sign out the current user */
51
53
  signOut(): Promise<void>;
52
54
  /**
@@ -1,5 +1,6 @@
1
1
  import { CueApi } from './api';
2
2
  import { ReadonlySignal } from './signal';
3
+ import { FileType } from 'js/models';
3
4
  import { DocumentInfo, ProjectDocumentsData, QueryCache } from './models';
4
5
  /**
5
6
  * Manages document data for a single project.
@@ -122,6 +123,64 @@ export declare class CueProjectDocuments {
122
123
  * Useful for pre-filling path-based query inputs with a realistic example.
123
124
  */
124
125
  randomFilePath(): Promise<string | null>;
126
+ /**
127
+ * Fetches all `qcy:FileContent` documents whose file suffix matches one of
128
+ * the given extensions (e.g. `'.ifc'`, `'.pdf'`).
129
+ *
130
+ * By default returns only `{ iri, uuid }` — pass `includeMetadata: true` to
131
+ * also get `path`, `suffix`, and `size`. Use the default form when you intend
132
+ * to lazy-load full details via `requestDocumentData`.
133
+ *
134
+ * Suffixes are matched case-insensitively and the leading dot is optional
135
+ * (both `'ifc'` and `'.ifc'` are accepted).
136
+ */
137
+ documentsBySuffix(suffixes: string[], includeMetadata?: false): Promise<Array<{
138
+ iri: string;
139
+ uuid: string;
140
+ }>>;
141
+ documentsBySuffix(suffixes: string[], includeMetadata: true): Promise<Array<{
142
+ iri: string;
143
+ uuid: string;
144
+ path: string;
145
+ suffix: string;
146
+ size: number;
147
+ }>>;
148
+ /**
149
+ * Fetches documents whose file suffix maps to one of the given `FileType`
150
+ * values (e.g. `FileType.BIM`, `FileType.CAD`).
151
+ *
152
+ * Resolves matching suffixes from `fileExtensionsInfo` and delegates to
153
+ * `documentsBySuffix`. Accepts the same `includeMetadata` flag.
154
+ */
155
+ documentsByFileType(fileTypes: FileType[], includeMetadata?: false): Promise<Array<{
156
+ iri: string;
157
+ uuid: string;
158
+ }>>;
159
+ documentsByFileType(fileTypes: FileType[], includeMetadata: true): Promise<Array<{
160
+ iri: string;
161
+ uuid: string;
162
+ path: string;
163
+ suffix: string;
164
+ size: number;
165
+ }>>;
166
+ /**
167
+ * Fetches documents whose MIME type matches one of the given strings
168
+ * (e.g. `'application/x-step'`, `'application/pdf'`).
169
+ *
170
+ * Resolves matching suffixes from `fileExtensionsInfo` and delegates to
171
+ * `documentsBySuffix`. Accepts the same `includeMetadata` flag.
172
+ */
173
+ documentsByMime(mimeTypes: string[], includeMetadata?: false): Promise<Array<{
174
+ iri: string;
175
+ uuid: string;
176
+ }>>;
177
+ documentsByMime(mimeTypes: string[], includeMetadata: true): Promise<Array<{
178
+ iri: string;
179
+ uuid: string;
180
+ path: string;
181
+ suffix: string;
182
+ size: number;
183
+ }>>;
125
184
  /** Executes the document-info SPARQL query for the given UUIDs, merges results
126
185
  * into `documentInfoMap`, and returns the newly fetched entries. */
127
186
  private _fetchDocumentInfoBatch;
package/lib/entities.d.ts CHANGED
@@ -106,6 +106,28 @@ export declare class CueProjectEntities {
106
106
  iri: string;
107
107
  label: string;
108
108
  }[]>;
109
+ /**
110
+ * Fetches all `qcy:CanonicalEntity` instances that belong to at least one of
111
+ * the given category IRIs.
112
+ *
113
+ * Accepts both full HTTP IRIs and prefixed forms, e.g.:
114
+ * - `"qcy:Building"`
115
+ * - `"https://cue.qaecy.com/ontology#Building"`
116
+ *
117
+ * By default returns only `{ iri, uuid }` — pass `includeMetadata: true` to
118
+ * also get `value` and `categories` (all categories, not just the filtered ones).
119
+ * Use the default form when you intend to lazy-load details via `requestEntityData`.
120
+ */
121
+ entitiesByCategory(categoryIris: string[], includeMetadata?: false): Promise<Array<{
122
+ iri: string;
123
+ uuid: string;
124
+ }>>;
125
+ entitiesByCategory(categoryIris: string[], includeMetadata: true): Promise<Array<{
126
+ iri: string;
127
+ uuid: string;
128
+ value: string;
129
+ categories: string[];
130
+ }>>;
109
131
  /**
110
132
  * Fetches a summary graph of entity category relationships for the project.
111
133
  *
@@ -0,0 +1,48 @@
1
+ import { CueAuth } from './auth';
2
+ export declare const ENDPOINT_EXTRACTION = "/semantic-extraction/extract";
3
+ export interface ExtractionRequest {
4
+ /** PNG (or other image) blob of the document page to extract from. */
5
+ image: Blob;
6
+ /** SemanticTemplate JSON object. */
7
+ template: object;
8
+ /** Project / space ID used by the extraction service. */
9
+ projectId: string;
10
+ /** IRI of the pre-selected content category; omit to let the model classify. */
11
+ category?: string | null;
12
+ /** Plain text of the page, used as additional context. */
13
+ text?: string | null;
14
+ /** Desired RDF serialisation — defaults to `'json-ld'`. */
15
+ rdfFormat?: 'json-ld' | 'turtle' | 'ntriples' | 'xml';
16
+ }
17
+ export interface ExtractionResponse {
18
+ /** Parsed JSON-LD document ready for `cue-rdf-graph`. */
19
+ jsonld: object;
20
+ }
21
+ /**
22
+ * Client for the Cue semantic-extraction endpoint.
23
+ *
24
+ * Exposed as `cue.api.extraction`.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const result = await cue.api.extraction.extract({
29
+ * image: pngBlob,
30
+ * template: myTemplate,
31
+ * projectId: 'my-project',
32
+ * });
33
+ * // result.jsonld is a JSON-LD document for cue-rdf-graph
34
+ * ```
35
+ */
36
+ export declare class CueExtraction {
37
+ private readonly _auth;
38
+ private readonly _gatewayUrl;
39
+ constructor(_auth: CueAuth, _gatewayUrl: string);
40
+ /**
41
+ * Run semantic extraction on a document page image.
42
+ *
43
+ * Sends a multipart/form-data POST to `/semantic-extraction/extract`.
44
+ * Always requests JSON-LD so the result can be displayed directly in
45
+ * `cue-rdf-graph` without any further parsing.
46
+ */
47
+ extract(request: ExtractionRequest): Promise<ExtractionResponse>;
48
+ }
package/node.js CHANGED
@@ -1,16 +1,16 @@
1
- import { C as h, B as l, r as _, t as S, u as E, n as m, v as P, a as d } from "./cue-BjbRXItA.js";
2
- import { b as j, c as y, d as I, e as K, f as L, g as v, h as x, i as H, j as N, k as O, l as D, m as G, o as W, R as k, p as q, q as Q, s as V } from "./cue-BjbRXItA.js";
3
- import { getStorage as e, connectStorageEmulator as b } from "firebase/storage";
1
+ import { C as h, B as l, t as _, u as E, v as S, o as m, w as P, a as d } from "./cue-BR7V1Nem.js";
2
+ import { b as j, c as x, d as y, e as I, f as K, g as L, h as v, i as H, j as N, k as O, l as D, m as G, n as W, p as k, R as q, q as Q, r as V, s as z } from "./cue-BR7V1Nem.js";
3
+ import { getStorage as t, connectStorageEmulator as w } from "firebase/storage";
4
4
  import "firebase/firestore";
5
5
  class A extends h {
6
6
  constructor(s) {
7
7
  super(s);
8
8
  }
9
9
  _buildApi(s) {
10
- const r = e(this._app, l), i = e(this._app, _), n = this._storageRaw, u = e(this._app, S), c = this._storageProcessed, t = e(this._app, E);
10
+ const r = t(this._app, l), i = t(this._app, _), n = this._storageRaw, u = t(this._app, E), c = this._storageProcessed, e = t(this._app, S);
11
11
  if (this._isEmulator) {
12
12
  const p = this._endpoints.storageEmulatorHost, g = this._endpoints.storageEmulatorPort;
13
- b(t, p, g);
13
+ w(e, p, g);
14
14
  }
15
15
  const C = new P({
16
16
  storageChatSessions: r,
@@ -18,7 +18,7 @@ class A extends h {
18
18
  storageRaw: n,
19
19
  storagePersistence: u,
20
20
  storageProcessed: c,
21
- storagePublic: t
21
+ storagePublic: e
22
22
  }), a = new m(
23
23
  this.auth,
24
24
  s,
@@ -37,22 +37,23 @@ export {
37
37
  h as Cue,
38
38
  d as CueApi,
39
39
  j as CueAuth,
40
- y as CueCache,
40
+ x as CueCache,
41
+ y as CueExtraction,
41
42
  I as CueGis,
42
43
  A as CueNode,
43
44
  K as CuePrivileges,
44
45
  L as CueProfile,
45
46
  v as CueProjectDocuments,
46
- x as CueProjectEntities,
47
- H as CueProjectSchema,
48
- N as CueProjectView,
49
- O as CueProjects,
50
- D as CueSignal,
51
- G as CueStorage,
47
+ H as CueProjectEntities,
48
+ N as CueProjectSchema,
49
+ O as CueProjectView,
50
+ D as CueProjects,
51
+ G as CueSignal,
52
+ W as CueStorage,
52
53
  m as CueSyncApi,
53
- W as CueTables,
54
- k as REQUIRED_ROLES,
55
- q as configureScanWasm,
56
- Q as cueComputed,
57
- V as staleWhileRevalidate
54
+ k as CueTables,
55
+ q as REQUIRED_ROLES,
56
+ Q as configureScanWasm,
57
+ V as cueComputed,
58
+ z as staleWhileRevalidate
58
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaecy/cue-sdk",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",