@qaecy/cue-sdk 0.0.52 → 0.0.54

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as C, C as u, a as i, b as r, c as o, d as t, e as S, f as n, g as c, h as E, i as m, j as p, k as A, l, m as P, n as R, o as _, p as I, q as d, r as g, s as T, t as D, u as O, v as N, w as U, x as G, y as h, z as f, A as j, D as v, E as x, F as M, G as y, H as B, I as F, J as L, K as H, L as b, M as K, N as q, O as w, P as Q, Q as V, R as W, S as X, T as Y, U as k, V as z, W as J, X as Z, Y as $, Z as ee, _ as ae, $ as se, a0 as Ce, a1 as ue, a2 as ie, a3 as re } from "./document-filter-BuFNMQwr.js";
1
+ import { B as C, C as u, a as i, b as r, c as o, d as t, e as S, f as n, g as c, h as E, i as m, j as p, k as A, l, m as P, n as R, o as _, p as I, q as d, r as g, s as T, t as D, u as O, v as N, w as U, x as G, y as h, z as f, A as j, D as v, E as x, F as M, G as y, H as B, I as F, J as L, K as H, L as b, M as K, N as q, O as w, P as Q, Q as V, R as W, S as X, T as Y, U as k, V as z, W as J, X as Z, Y as $, Z as ee, _ as ae, $ as se, a0 as Ce, a1 as ue, a2 as ie, a3 as re } from "./document-filter-BSiwWQ5L.js";
2
2
  import "uuid";
3
3
  export {
4
4
  C as BASE_CURRENCY,
package/lib/auth.d.ts CHANGED
@@ -12,6 +12,7 @@ export declare class CueAuth {
12
12
  private readonly _isSuperAdminSignal;
13
13
  private readonly _userIdsSignal;
14
14
  private readonly _stopTokenListener;
15
+ private _ssoPending;
15
16
  /** Reactive auth state — emits the signed-in `User`, or `null` when signed out. */
16
17
  readonly user: ReadonlySignal<User | null>;
17
18
  /** Reactive Firebase ID token — refreshes automatically; `null` when signed out. */
@@ -21,6 +22,7 @@ export declare class CueAuth {
21
22
  /** All unique UIDs for the current user (Firebase UID + linked provider UIDs). */
22
23
  readonly userIds: ReadonlySignal<string[]>;
23
24
  constructor(app: FirebaseApp, useEmulator: boolean | undefined, endpoints: CueEndpoints);
25
+ private _publish;
24
26
  /** Stop all internal Firebase listeners. Call when the `Cue` instance is no longer needed. */
25
27
  destroy(): void;
26
28
  /** Sign in with Google or Microsoft via browser popup */
@@ -39,6 +41,13 @@ export declare class CueAuth {
39
41
  * Call this once on app startup before showing a sign-in UI.
40
42
  */
41
43
  checkRedirectResult(): Promise<User | null>;
44
+ /**
45
+ * SSO may sign in to an existing account but never create one. Firebase
46
+ * creates the account before we can object, so the backend checks it
47
+ * afterwards and deletes it if it is a fresh sign-up; we sign out and throw.
48
+ * Fails closed: if the check cannot be made, the session is dropped.
49
+ */
50
+ private _confirmSsoSignIn;
42
51
  /**
43
52
  * One-shot async check — returns `true` if the current user has the
44
53
  * `superadmin` custom claim. For reactive use, read `cue.auth.isSuperAdmin`
@@ -0,0 +1,12 @@
1
+ import { FirebaseApp } from 'firebase/app';
2
+ import { CueBlobStorage } from '../../databases/src/index';
3
+ import { CueAuth } from './auth';
4
+ import { CueEndpoints, CueStorageConfig } from './models';
5
+ /**
6
+ * The SDK's one blob store, shared by `new Cue()` and `Cue.fromApp()`.
7
+ *
8
+ * A bucket on the `firebase` driver gets a `FirebaseStorage` for its bucket
9
+ * name; a bucket on the `gateway` driver gets none, so a deployment with no
10
+ * Firebase Storage at all never touches it.
11
+ */
12
+ export declare function createBlobStorage(app: FirebaseApp, auth: CueAuth, endpoints: CueEndpoints, config?: CueStorageConfig, connectEmulator?: boolean): CueBlobStorage;
package/lib/cache.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { FirebaseStorage } from 'firebase/storage';
1
+ import { CueBlobStorage } from '../../databases/src/index';
2
2
  /** Shape stored by the query cache. */
3
3
  export interface QueryCacheEntry {
4
4
  query: string;
@@ -13,8 +13,8 @@ export interface QueryCacheEntry {
13
13
  * - User-project data: `portal/projects/{pid}/users/{uid}/{id}.json.gz`
14
14
  */
15
15
  export declare class CueCache {
16
- private readonly _storage;
17
- constructor(_storage: FirebaseStorage);
16
+ private readonly _blob;
17
+ constructor(_blob: CueBlobStorage);
18
18
  getQueryCache(projectId: string, id: string): Promise<QueryCacheEntry | undefined>;
19
19
  setQueryCache(projectId: string, id: string, payload: QueryCacheEntry): Promise<void>;
20
20
  getAgentSessionCache(projectId: string, id: string): Promise<object | undefined>;
package/lib/cue.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { FirebaseApp } from 'firebase/app';
2
- import { FirebaseStorage } from 'firebase/storage';
3
2
  import { CueBlobStorage } from '../../databases/src/index';
4
3
  import { CueAuth } from './auth';
5
4
  import { CueSignUp } from './signup';
@@ -42,8 +41,11 @@ export declare class Cue {
42
41
  protected readonly _app: FirebaseApp;
43
42
  protected readonly _endpoints: CueEndpoints;
44
43
  protected readonly _isEmulator: boolean;
45
- protected _storageRaw: FirebaseStorage;
46
- protected _storageProcessed: FirebaseStorage;
44
+ /**
45
+ * Object storage, per bucket on Firebase Storage or the gateway (see
46
+ * `CueSdkConfig.storage`). What sync, data sources and the cache use.
47
+ */
48
+ readonly blob: CueBlobStorage;
47
49
  private _gis;
48
50
  private readonly _projectDocuments;
49
51
  private readonly _verbose;
package/lib/models.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { SupportedCurrency } from './currency';
2
2
  import { ComparisonResult } from '../../sync-tools/src/index';
3
+ import { BlobBucket, BlobDriverKind } from '../../databases/src/index';
3
4
  export type CueEnvironment = 'production' | 'emulator';
4
5
  export interface CueEndpoints {
5
6
  /** API gateway base URL */
@@ -12,10 +13,6 @@ export interface CueEndpoints {
12
13
  storageEmulatorHost: string;
13
14
  /** Firebase Storage emulator port (emulator mode only, default: 9199) */
14
15
  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
16
  }
20
17
  export interface CueSdkConfig {
21
18
  /** Firebase API key for this project. Defaults to the QAECY demo app if omitted. */
@@ -30,6 +27,18 @@ export interface CueSdkConfig {
30
27
  endpoints?: Partial<CueEndpoints>;
31
28
  /** Enable verbose debug logging for all entity/document store operations. */
32
29
  verbose?: boolean;
30
+ /** How the SDK reaches object storage. Defaults to Firebase Storage for every bucket. */
31
+ storage?: CueStorageConfig;
32
+ }
33
+ export interface CueStorageConfig {
34
+ /**
35
+ * Per-bucket driver. `firebase` (the default) uses Firebase Storage and its
36
+ * security rules; `gateway` uses the gateway's `/commands/storage` endpoints,
37
+ * which work on any backend the deployment runs (GCS, MinIO, S3).
38
+ */
39
+ drivers?: Partial<Record<BlobBucket, BlobDriverKind>>;
40
+ /** Firebase Storage bucket names, for buckets on the `firebase` driver. */
41
+ buckets?: Partial<Record<BlobBucket, string>>;
33
42
  }
34
43
  export type SsoProvider = 'google' | 'microsoft';
35
44
  export interface PasswordCredentials {
@@ -752,15 +761,16 @@ export type ProcessingStage = 'idle' | 'processing' | 'writing' | 'loading' | 'e
752
761
  *
753
762
  * - `uploaded` — in storage, no processor output yet
754
763
  * - `processing` — a processor has emitted artifacts (markdown, images, fragments)
755
- * - `extracting` — RDF exists but is not all committed to the ledger
756
- * - `stored` — every `.ttl` produced so far is committed
764
+ * - `extracting` — RDF exists; processing or extraction is still outstanding
765
+ * - `ready` — done up to and including extraction; waiting to be bundled
766
+ * - `stored` — ready, and every `.ttl` produced so far is bundled
757
767
  * - `failed` — processing errored
758
768
  *
759
769
  * `stored` is not strictly final: an enricher producing further RDF later moves
760
- * the document back to `extracting`, which is a faithful description of reality
761
- * rather than a bug.
770
+ * the document back to `ready` until that RDF is bundled too, which is a
771
+ * faithful description of reality rather than a bug.
762
772
  */
763
- export type DocumentProcessingStage = 'uploaded' | 'processing' | 'extracting' | 'stored' | 'failed';
773
+ export type DocumentProcessingStage = 'uploaded' | 'processing' | 'extracting' | 'ready' | 'stored' | 'failed';
764
774
  /** Per-document pipeline progress for one uploaded file. */
765
775
  export interface DocumentProgress {
766
776
  documentUUID: string;
@@ -780,6 +790,8 @@ export interface DocumentProgress {
780
790
  contributors: string[];
781
791
  rdfCount: number;
782
792
  rdfStoredCount: number;
793
+ /** What was missing when the document went ready, e.g. `extraction failed: 2`. */
794
+ gaps?: string[];
783
795
  error?: string;
784
796
  }
785
797
  /** Counts-only per-project rollup, streamed by {@link CueProcessingApi.watchMyStatus}. */
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, app: FirebaseApp, useEmulator: boolean, _gatewayUrl: string);
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. */
package/lib/project.d.ts CHANGED
@@ -1,4 +1,3 @@
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';
@@ -12,7 +11,6 @@ export interface ProjectUpdate {
12
11
  }
13
12
  export declare class CueProjects {
14
13
  private readonly _auth;
15
- private readonly _db;
16
14
  private readonly _gatewayUrl;
17
15
  private readonly _projects;
18
16
  /**
@@ -21,7 +19,7 @@ export declare class CueProjects {
21
19
  * without every caller having to remember to re-fetch the whole list.
22
20
  */
23
21
  readonly projects: ReadonlySignal<ProjectData[] | undefined>;
24
- constructor(_auth: CueAuth, app: FirebaseApp, useEmulator?: boolean, endpoints?: CueEndpoints);
22
+ constructor(_auth: CueAuth, endpoints?: CueEndpoints);
25
23
  /**
26
24
  * Create a new project. The authenticated user is automatically set as admin, syncer, and member.
27
25
  * Throws if a project with the given ID already exists.
@@ -38,11 +36,6 @@ export declare class CueProjects {
38
36
  * single project look like the user's entire project set.
39
37
  */
40
38
  private _patchProject;
41
- /**
42
- * Atomically increments `unitsConsumed` on the top-level `clientSync/{projectId}`
43
- * document, creating it if it doesn't exist. Intended for pre-flight checks.
44
- */
45
- incrementUnitsConsumed(projectId: string, units: number, userId: string): Promise<void>;
46
39
  /**
47
40
  * Invite a user to a project by email. Returns the invited user's uid.
48
41
  * Throws if no account exists yet for that email — the gateway route supports
@@ -1,4 +1,4 @@
1
- import { EntityCategory, ProjectSchema } from '../../models/src/index';
1
+ import { ContentCategory, EntityCategory, ProjectSchema } from '../../models/src/index';
2
2
  import { CueAuth } from './auth';
3
3
  export interface MutationResult {
4
4
  message: string;
@@ -114,6 +114,12 @@ export declare class CueSemanticTemplate {
114
114
  * starting point — the same list for every caller, nothing project-specific about it.
115
115
  */
116
116
  getDefaultEntities(projectId: string): Promise<EntityCategory[]>;
117
+ /**
118
+ * The QAECY catalogues' content categories — the document types a term can be limited to —
119
+ * with pinned IRIs stripped, so each is referenced by its bare `key`. The same list for every
120
+ * caller.
121
+ */
122
+ getDefaultContentCategories(projectId: string): Promise<ContentCategory[]>;
117
123
  /** Re-pushes the project's currently stored template into its `databases-cue` schema graph, without mutating it. */
118
124
  reloadSchema(projectId: string): Promise<MutationResult>;
119
125
  private _get;
package/node.js CHANGED
@@ -1,5 +1,5 @@
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";
1
+ import { c as s } from "./document-filter-BSiwWQ5L.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-BSiwWQ5L.js";
3
3
  import "uuid";
4
4
  class r extends s {
5
5
  constructor(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaecy/cue-sdk",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/variables.d.ts CHANGED
@@ -26,6 +26,7 @@ export declare const ENDPOINT_PROFILE_ORGANIZATIONS = "/data-views/admin/profile
26
26
  export declare const ENDPOINT_PROFILE_API_KEYS = "/data-views/admin/profile/api-keys";
27
27
  export declare const ENDPOINT_COMMANDS_PROFILE_API_KEYS = "/commands/admin/profile/api-keys";
28
28
  export declare const ENDPOINT_COMMANDS_PROFILE_TERMS = "/commands/admin/profile/terms";
29
+ export declare const ENDPOINT_COMMANDS_PROFILE_SSO_SIGN_IN = "/commands/admin/profile/sso-sign-in";
29
30
  export declare const ENDPOINT_COMMANDS_PROFILE_ANALYTICS_NOTICE = "/commands/admin/profile/analytics-notice";
30
31
  export declare const ENDPOINT_COMMANDS_USAGE_VIEW = "/commands/admin/usage/view";
31
32
  export declare const ENDPOINT_ORG_MEMBERS: (orgId: string) => string;