@qaecy/cue-sdk 0.0.25 → 0.0.27

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-ztX7FTFH.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-CzxsQ6aP.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
  /**
@@ -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
+ }
@@ -2,11 +2,15 @@ import { ReadonlySignal } from './signal';
2
2
  /** Roles ordered from highest to lowest privilege. */
3
3
  declare const ROLE_HIERARCHY: readonly ["superadmin", "admin", "syncer", "member"];
4
4
  export type UserProjectRole = (typeof ROLE_HIERARCHY)[number];
5
+ /** Role a user can have within an organization. */
6
+ export type UserOrgRole = 'admin' | 'member';
5
7
  export interface Privileges {
6
8
  changeContentCategories: boolean;
7
9
  createEntities: boolean;
10
+ createProject: boolean;
8
11
  createProvider: boolean;
9
12
  deleteDocuments: boolean;
13
+ deleteProject: boolean;
10
14
  deleteUserFromProject: boolean;
11
15
  downloadDocuments: boolean;
12
16
  editContentCategories: boolean;
@@ -17,21 +21,29 @@ export interface Privileges {
17
21
  uploadDocuments: boolean;
18
22
  viewEntities: boolean;
19
23
  }
20
- /** Minimum role required for each privilege. */
21
- export declare const REQUIRED_ROLES: Record<keyof Privileges, UserProjectRole>;
24
+ /**
25
+ * Minimum project role required for each privilege.
26
+ * Note: `createProject` is intentionally absent — it is gated by the
27
+ * user's organisation role, not their project role.
28
+ */
29
+ export declare const REQUIRED_ROLES: Record<Exclude<keyof Privileges, 'createProject'>, UserProjectRole>;
22
30
  /**
23
31
  * Manages role-based access control for the current user + selected project.
24
32
  *
25
33
  * - Call `setProjectRoles()` whenever the selected project changes.
34
+ * - Call `setOrgRole()` whenever the selected project's organisation changes.
26
35
  * - Read `privileges` (a `ReadonlySignal<Privileges>`) for reactive access.
27
36
  *
28
37
  * @example
29
38
  * cue.privileges.setProjectRoles(['admin']);
39
+ * cue.privileges.setOrgRole('admin');
30
40
  * const canUpload = cue.privileges.privileges.get().uploadDocuments; // true
41
+ * const canCreate = cue.privileges.privileges.get().createProject; // true
31
42
  */
32
43
  export declare class CuePrivileges {
33
44
  private readonly _isSuperAdmin;
34
45
  private readonly _projectRoles;
46
+ private readonly _orgRole;
35
47
  /**
36
48
  * Reactive signal — current user's privileges for the selected project.
37
49
  * Recomputes automatically when `setProjectRoles()` is called or when
@@ -39,6 +51,13 @@ export declare class CuePrivileges {
39
51
  */
40
52
  readonly privileges: ReadonlySignal<Privileges>;
41
53
  constructor(_isSuperAdmin: ReadonlySignal<boolean>);
54
+ /**
55
+ * Set the user's role within the organisation that owns the selected project.
56
+ * Pass `null` to clear the organisation role (e.g. when deselecting a project).
57
+ *
58
+ * Only organisation admins (and superadmins) may create projects.
59
+ */
60
+ setOrgRole(role: UserOrgRole | null): void;
42
61
  /**
43
62
  * Set the user's roles for the currently selected project.
44
63
  *
package/lib/project.d.ts CHANGED
@@ -37,5 +37,9 @@ export declare class CueProjects {
37
37
  changeUserRoleOnProject(uid: string, projectId: string, role: ProjectRole): Promise<void>;
38
38
  /** Remove a member from a project. */
39
39
  removeUserFromProject(uid: string, projectId: string): Promise<void>;
40
+ /**
41
+ * Delete a project by ID. Requires superadmin privileges on the server.
42
+ */
43
+ deleteProject(projectId: string): Promise<void>;
40
44
  }
41
45
  export {};
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-ztX7FTFH.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-ztX7FTFH.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-CzxsQ6aP.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-CzxsQ6aP.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.25",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/variables.d.ts CHANGED
@@ -27,6 +27,7 @@ export declare const ENDPOINT_COMMANDS_PROFILE_API_KEYS = "/commands/admin/profi
27
27
  export declare const ENDPOINT_COMMANDS_PROFILE_TERMS = "/commands/admin/profile/terms";
28
28
  export declare const ENDPOINT_ORG_MEMBERS: (orgId: string) => string;
29
29
  export declare const ENDPOINT_CREATE_PROJECT = "/commands/admin/project";
30
+ export declare const ENDPOINT_DELETE_PROJECT: (projectId: string) => string;
30
31
  export declare const ENDPOINT_SEARCH = "/assistant/search";
31
32
  export declare const ENDPOINT_FUSEKI_QUERY = "/triplestore/query";
32
33
  export declare const ENDPOINT_FUSEKI_UPDATE = "/triplestore/update";