@qaecy/cue-sdk 0.0.16 → 0.0.17

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
@@ -1,5 +1,7 @@
1
1
  export { Cue } from './lib/cue';
2
2
  export { CueGis } from './lib/gis';
3
+ export { CueStorage } from './lib/storage';
4
+ export type { StorageBucket } from './lib/storage';
3
5
  export type { GisBBox, GisCategoryDescriptor, GisFeature, GisFeaturesMap, FeatureCategory } from './lib/gis';
4
6
  export { CueAuth } from './lib/auth';
5
7
  export { CueApi } from './lib/api';
package/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { C as s, a as u, b as C, c as i, d as c, e as t, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as h, n as p, R, o as S, p as f, s as g } from "./cue-DiFnK22Q.js";
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-yUoyoy61.js";
2
2
  export {
3
3
  s as Cue,
4
4
  u as CueApi,
5
5
  C as CueAuth,
6
6
  i as CueCache,
7
- c as CueGis,
8
- t as CuePrivileges,
7
+ t as CueGis,
8
+ c as CuePrivileges,
9
9
  o as CueProfile,
10
10
  r as CueProjectDocuments,
11
11
  l as CueProjectEntities,
@@ -13,10 +13,11 @@ export {
13
13
  P as CueProjectView,
14
14
  j as CueProjects,
15
15
  m as CueSignal,
16
- h as CueSyncApi,
17
- p as CueTables,
18
- R as REQUIRED_ROLES,
19
- S as configureScanWasm,
16
+ S as CueStorage,
17
+ g as CueSyncApi,
18
+ h as CueTables,
19
+ p as REQUIRED_ROLES,
20
+ R as configureScanWasm,
20
21
  f as cueComputed,
21
- g as staleWhileRevalidate
22
+ E as staleWhileRevalidate
22
23
  };
package/lib/cue.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { FirebaseApp } from 'firebase/app';
2
+ import { FirebaseStorage } from 'firebase/storage';
2
3
  import { CueAuth } from './auth';
4
+ import { CueStorage } from './storage';
3
5
  import { CueApi } from './api';
4
6
  import { CueGis } from './gis';
5
7
  import { CueProjects } from './project';
@@ -7,6 +9,8 @@ import { CueProfile } from './profile';
7
9
  import { CuePrivileges } from './privileges';
8
10
  import { CueCache } from './cache';
9
11
  import { CueProjectView, CueProjectViewOptions } from './project-view';
12
+ import { CueProjectEntities } from './entities';
13
+ import { CueProjectDocuments } from './documents';
10
14
  import { CueEndpoints, CueSdkConfig, QueryCache } from './models';
11
15
  /**
12
16
  * Main entry point for the QAECY SDK (browser-safe).
@@ -24,9 +28,12 @@ export declare class Cue {
24
28
  readonly profile: CueProfile;
25
29
  readonly privileges: CuePrivileges;
26
30
  readonly cache: CueCache;
31
+ readonly storage: CueStorage;
27
32
  protected readonly _app: FirebaseApp;
28
33
  protected readonly _endpoints: CueEndpoints;
29
34
  protected readonly _isEmulator: boolean;
35
+ protected _storageRaw: FirebaseStorage;
36
+ protected _storageProcessed: FirebaseStorage;
30
37
  private _gis;
31
38
  /**
32
39
  * Reactive GIS service. Lazily constructed on first access.
@@ -79,4 +86,46 @@ export declare class Cue {
79
86
  createProjectView(projectId: string, opts: Omit<CueProjectViewOptions, 'queryCache'> & {
80
87
  queryCache?: QueryCache;
81
88
  }): CueProjectView;
89
+ /**
90
+ * Creates a `CueProjectEntities` instance for the given project, with the
91
+ * SDK query cache wired automatically.
92
+ *
93
+ * Prefer this over `new CueProjectEntities(cue.api, projectId)` — it avoids
94
+ * the manual cache setup and keeps the instance bound to the correct API.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const entities = cue.createProjectEntities('my-project');
99
+ * entities.requestEntityData(['uuid1']);
100
+ * const info = entities.entityInfoMap.get()['uuid1'];
101
+ *
102
+ * // Promise-based (no signal polling needed):
103
+ * const graph = await entities.buildSummaryGraph('graph');
104
+ * ```
105
+ */
106
+ createProjectEntities(projectId: string, opts?: {
107
+ rdfBase?: string;
108
+ graphType?: string;
109
+ queryCache?: QueryCache;
110
+ }): CueProjectEntities;
111
+ /**
112
+ * Creates a `CueProjectDocuments` instance for the given project, with the
113
+ * SDK query cache wired automatically.
114
+ *
115
+ * Prefer this over `new CueProjectDocuments(cue.api, projectId)` — it avoids
116
+ * the manual cache setup and keeps the instance bound to the correct API.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const docs = cue.createProjectDocuments('my-project');
121
+ * await docs.fetchOverview();
122
+ * const data = await docs.fetchDocumentData(['uuid1', 'uuid2']);
123
+ * ```
124
+ */
125
+ createProjectDocuments(projectId: string, opts?: {
126
+ language?: string;
127
+ rdfBase?: string;
128
+ graphType?: string;
129
+ queryCache?: QueryCache;
130
+ }): CueProjectDocuments;
82
131
  }
@@ -73,11 +73,48 @@ export declare class CueProjectDocuments {
73
73
  * once the SPARQL response arrives.
74
74
  */
75
75
  requestDocumentData(uuids: string[]): void;
76
+ /**
77
+ * Promise-based alternative to {@link requestDocumentData} for non-reactive contexts.
78
+ *
79
+ * Resolves with the `DocumentInfo` entries for every requested UUID once the
80
+ * SPARQL response arrives. UUIDs already present in the cache are returned
81
+ * immediately without a network request. The result is also written into
82
+ * `documentInfoMap` so reactive consumers stay in sync.
83
+ *
84
+ * UUIDs not found in the triplestore are omitted from the returned map.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const docs = await cueProjectDocs.fetchDocumentData(['uuid1', 'uuid2']);
89
+ * console.log(docs['uuid1'].subject);
90
+ * ```
91
+ */
92
+ fetchDocumentData(uuids: string[]): Promise<Record<string, DocumentInfo>>;
93
+ /**
94
+ * Returns the alternative representations of the given document UUID.
95
+ *
96
+ * Alternative representations are derived artefacts stored under
97
+ * `qcy:alternativeRepresentation` in the triplestore — for example a
98
+ * `.fragments` BIM tile derived from an `.ifc` source file.
99
+ *
100
+ * The returned `DocumentInfo` entries are also merged into
101
+ * `documentInfoMap` so reactive consumers stay in sync.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const alts = await docs.fetchAlternativeRepresentations('abc-123');
106
+ * // alts[0].suffix => '.fragments'
107
+ * ```
108
+ */
109
+ fetchAlternativeRepresentations(uuid: string): Promise<DocumentInfo[]>;
76
110
  /**
77
111
  * Returns a single arbitrary file path from the project's triplestore.
78
112
  * Useful for pre-filling path-based query inputs with a realistic example.
79
113
  */
80
114
  randomFilePath(): Promise<string | null>;
115
+ /** Executes the document-info SPARQL query for the given UUIDs, merges results
116
+ * into `documentInfoMap`, and returns the newly fetched entries. */
117
+ private _fetchDocumentInfoBatch;
81
118
  private _fetchDocumentsBySuffix;
82
119
  private _buildDocumentsBySuffixQuery;
83
120
  private _runDocumentsBySuffixQuery;
@@ -0,0 +1,26 @@
1
+ import { FirebaseStorage } from 'firebase/storage';
2
+ export type StorageBucket = 'raw' | 'processed';
3
+ /**
4
+ * Provides document download URL resolution against the Cue Firebase Storage buckets.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const url = await cue.storage.getDownloadUrl('my-project', 'abc123', '.pdf');
9
+ * ```
10
+ */
11
+ export declare class CueStorage {
12
+ private readonly _storageRaw;
13
+ private readonly _storageProcessed;
14
+ constructor(_storageRaw: FirebaseStorage, _storageProcessed: FirebaseStorage);
15
+ /**
16
+ * Returns a Firebase authenticated download URL for a document stored in Cue.
17
+ *
18
+ * The storage path is `{projectId}/{uuid}{suffix}`, e.g. `my-project/abc-123.pdf`.
19
+ *
20
+ * @param projectId - The Cue project (space) ID.
21
+ * @param uuid - The document UUID.
22
+ * @param suffix - File suffix including the leading dot, e.g. `'.pdf'`, `'.ifc'`.
23
+ * @param bucket - `'raw'` (default, original uploads) or `'processed'` (derived artefacts).
24
+ */
25
+ getDownloadUrl(projectId: string, uuid: string, suffix: string, bucket?: StorageBucket): Promise<string>;
26
+ }
package/node.js CHANGED
@@ -1,57 +1,58 @@
1
- import { C as _, B as E, q as l, r as S, t as m, u as P, v as d, m as U, w as B, a as R } from "./cue-DiFnK22Q.js";
2
- import { b as y, c as I, d as L, e as O, f as v, g as x, h as D, i as H, j as N, k as W, l as G, n as k, R as q, o as Q, p as V, s as z } from "./cue-DiFnK22Q.js";
3
- import { getStorage as s, connectStorageEmulator as o } from "firebase/storage";
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-yUoyoy61.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-yUoyoy61.js";
3
+ import { getStorage as e, connectStorageEmulator as b } from "firebase/storage";
4
4
  import "firebase/firestore";
5
- class f extends _ {
6
- constructor(t) {
7
- super(t);
5
+ class A extends h {
6
+ constructor(s) {
7
+ super(s);
8
8
  }
9
- _buildApi(t) {
10
- const C = s(this._app, E), p = s(this._app, l), i = s(this._app, S), g = s(this._app, m), r = s(this._app, P), n = s(this._app, d);
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);
11
11
  if (this._isEmulator) {
12
- const e = this._endpoints.storageEmulatorHost, a = this._endpoints.storageEmulatorPort;
13
- o(i, e, a), o(r, e, a), o(n, e, a);
12
+ const p = this._endpoints.storageEmulatorHost, g = this._endpoints.storageEmulatorPort;
13
+ b(t, p, g);
14
14
  }
15
- const h = new B({
16
- storageChatSessions: C,
17
- storageLogs: p,
18
- storageRaw: i,
19
- storagePersistence: g,
20
- storageProcessed: r,
21
- storagePublic: n
22
- }), u = new U(
15
+ const C = new P({
16
+ storageChatSessions: r,
17
+ storageLogs: i,
18
+ storageRaw: n,
19
+ storagePersistence: u,
20
+ storageProcessed: c,
21
+ storagePublic: t
22
+ }), a = new m(
23
23
  this.auth,
24
- t,
25
- h,
24
+ s,
25
+ C,
26
26
  this._endpoints.gatewayUrl
27
- ), c = new R(
27
+ ), o = new d(
28
28
  this.auth,
29
29
  this._endpoints.gatewayUrl,
30
- t,
31
- u
30
+ s,
31
+ a
32
32
  );
33
- return u._bindApi(c), c;
33
+ return a._bindApi(o), o;
34
34
  }
35
35
  }
36
36
  export {
37
- _ as Cue,
38
- R as CueApi,
39
- y as CueAuth,
40
- I as CueCache,
41
- L as CueGis,
42
- f as CueNode,
43
- O as CuePrivileges,
44
- v as CueProfile,
45
- x as CueProjectDocuments,
46
- D as CueProjectEntities,
37
+ h as Cue,
38
+ d as CueApi,
39
+ j as CueAuth,
40
+ y as CueCache,
41
+ I as CueGis,
42
+ A as CueNode,
43
+ K as CuePrivileges,
44
+ L as CueProfile,
45
+ v as CueProjectDocuments,
46
+ x as CueProjectEntities,
47
47
  H as CueProjectSchema,
48
48
  N as CueProjectView,
49
- W as CueProjects,
50
- G as CueSignal,
51
- U as CueSyncApi,
52
- k as CueTables,
53
- q as REQUIRED_ROLES,
54
- Q as configureScanWasm,
55
- V as cueComputed,
56
- z as staleWhileRevalidate
49
+ O as CueProjects,
50
+ D as CueSignal,
51
+ G as CueStorage,
52
+ m as CueSyncApi,
53
+ W as CueTables,
54
+ k as REQUIRED_ROLES,
55
+ q as configureScanWasm,
56
+ Q as cueComputed,
57
+ V as staleWhileRevalidate
57
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaecy/cue-sdk",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",