@qaecy/cue-sdk 0.0.54 → 0.0.55

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
@@ -3,7 +3,7 @@ export { CueGis } from './lib/gis';
3
3
  export { CueStorage } from './lib/storage';
4
4
  export type { StorageBucket } from './lib/storage';
5
5
  export type { GisBBox, GisCategoryDescriptor, GisFeature, GisFeaturesMap, FeatureCategory } from './lib/gis';
6
- export { CueAuth } from './lib/auth';
6
+ export { CueAuth, CueAuthError } from './lib/auth';
7
7
  export { CueSignUp, CueRequestError } from './lib/signup';
8
8
  export type { OrgSignUpPayload, OrgSignUpPlan } from './lib/signup';
9
9
  export { CueApi } from './lib/api';
@@ -27,7 +27,7 @@ export { CueProjects } from './lib/project';
27
27
  export type { ProjectUpdate } from './lib/project';
28
28
  export { CueProfile } from './lib/profile';
29
29
  export { CueAdmin } from './lib/admin';
30
- export type { AdminOrgSearchResult, AdminUserSearchResult, AdminProjectSearchResult, AdminUserOrgSummary, AdminUserProjectSummary, AdminUserDetail, AdminDeletedUserOrgRef, AdminDeletedUserProjectRef, AdminDeletedUserSummary, AdminRestoreUserResult, } from './lib/models';
30
+ export type { AdminOrgSearchResult, AdminUserSearchResult, AdminProjectSearchResult, AdminUserOrgSummary, AdminUserProjectSummary, AdminUserDetail, AdminDeletedUserOrgRef, AdminDeletedUserProjectRef, AdminDeletedUserSummary, AdminRestoreUserResult, TransferProjectRequest, TransferProjectResult, ProjectOwnershipPeriod, } from './lib/models';
31
31
  export { CuePrivileges, REQUIRED_ROLES } from './lib/privileges';
32
32
  export type { UserProjectRole, Privileges } from './lib/privileges';
33
33
  export { CueSignal, cueComputed } from './lib/signal';
@@ -36,7 +36,7 @@ export { CueCache } from './lib/cache';
36
36
  export type { QueryCacheEntry } from './lib/cache';
37
37
  export { CueCurrency, SUPPORTED_CURRENCIES, BASE_CURRENCY } from './lib/currency';
38
38
  export type { SupportedCurrency, CurrencyRates } from './lib/currency';
39
- export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, SearchResponse, SearchSource, SearchOptions, ProjectData, ProjectSettings, QleverStats, CreateProjectOptions, SyncOptions, SyncResult, SyncPreview, ScanOutputRecord, UnitCreditMap, UnitsConsumedDto, OrgCreditsDto, OrgPlanSummary, MonthlyConsumptionDto, ProjectConsumptionReportDto, OrgConsumptionReportDto, FileTypeConsumptionDto, FileTypeBreakdownDto, RouteTrafficDto, DayTrafficDto, MonthTrafficDto, TrafficReportDto, ViewUsageDto, DayUsageDto, MonthUsageDto, UsageReportDto, OrganizationData, OrgMember, ProfileSSOAccount, APIKeyInfo, APIKeyDoc, ProjectDoc, OrganizationDoc, UserDoc, UserSettings, CustomAppRecord, CustomAppWithHtml, CreateCustomAppOptions, UpdateCustomAppOptions, RDFWritingDoc, ProcessingStatus, ProcessingStage, DocumentProcessingStage, DocumentProgress, ProjectProcessingSummary, MyProcessingStatus, DocumentReprocessJob, ReprocessJobStatus, ViewDefinition, QueryCache, LangMap, CategoryDef, RelationshipDef, EntityCoreData, EntityRelationship, EntityRelationships, MapGeometry, EntityDetailedData, ProjectEntitiesData, SummaryGraphData, PrototypeCategoryCount, PrototypeSummary, PrototypeProperty, PrototypeInstance, EntityAtExpressId, EntityModelLocation, ModelExpressIds, PrototypeCategoryExpressIds, DocumentInfo, DocumentSummary, ProjectDocumentsData, } from './lib/models';
39
+ export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, SearchResponse, SearchSource, SearchOptions, ProjectData, ProjectSettings, QleverStats, CreateProjectOptions, SyncOptions, SyncResult, SyncPreview, ScanOutputRecord, UnitCreditMap, UnitsConsumedDto, OrgCredits, OrgCreditsDto, OrgPlanSummary, MonthlyConsumptionDto, ProjectConsumptionReportDto, OrgConsumptionReportDto, FileTypeConsumptionDto, FileTypeBreakdownDto, RouteTrafficDto, DayTrafficDto, MonthTrafficDto, TrafficReportDto, ViewUsageDto, DayUsageDto, MonthUsageDto, UsageReportDto, OrganizationData, OrgMember, ProfileSSOAccount, APIKeyInfo, APIKeyDoc, ProjectDoc, OrganizationDoc, UserDoc, UserSettings, CustomAppRecord, CustomAppWithHtml, CreateCustomAppOptions, UpdateCustomAppOptions, RDFWritingDoc, ProcessingStatus, ProcessingStage, DocumentProcessingStage, DocumentStageCounts, DocumentProgress, ProjectProcessingSummary, MyProcessingStatus, DocumentReprocessJob, ReprocessJobStatus, ReprocessDocumentOptions, ReprocessAccepted, ReprocessPlan, EntityMentionInput, EntityMentionDeletion, SelectorInput, ContentCategoryChange, EditResult, BatchEditResult, ViewDefinition, QueryCache, LangMap, CategoryDef, RelationshipDef, EntityCoreData, EntityRelationship, EntityRelationships, MapGeometry, EntityDetailedData, ProjectEntitiesData, SummaryGraphData, PrototypeCategoryCount, PrototypeSummary, PrototypeProperty, PrototypeInstance, EntityAtExpressId, EntityModelLocation, ModelExpressIds, PrototypeCategoryExpressIds, DocumentInfo, DocumentSummary, ProjectDocumentsData, } from './lib/models';
40
40
  export type { AuthStateListener, Unsubscribe } from './lib/auth';
41
41
  export { CueTables } from './lib/tables';
42
42
  export type { ProjectTable } from './lib/tables';
@@ -48,8 +48,10 @@ export { CueDataSources } from './lib/data-sources';
48
48
  export type { DataSourceRecord, XToRdfConfig, RmlXToRdfConfig, GraphXToRdfConfig, TypeMappingConfiguration, UploadDataSourceMode, UploadDataSourceResult, } from './lib/data-sources';
49
49
  export { CueGisSources } from './lib/gis-sources';
50
50
  export type { GisSourceRecord, GisSourceUploadFormat, GisSourceCrs } from './lib/gis-sources';
51
+ export { CueEdits } from './lib/edits';
52
+ export { isReprocessPlan } from './lib/models';
51
53
  export { CueSemanticTemplate } from './lib/semantic-template';
52
- export type { MutationResult as SemanticTemplateMutationResult, BatchMutationResult as SemanticTemplateBatchMutationResult, ContentCategoryInput, EntityCategoryInput, EntityRelationshipInput, SchemaSource, } from './lib/semantic-template';
54
+ export type { MutationResult as SemanticTemplateMutationResult, BatchMutationResult as SemanticTemplateBatchMutationResult, ContentCategoryInput, EntityCategoryInput, EntityRelationshipInput, SchemaSource, RenameCanonicalInput, RenameCanonicalResult, } from './lib/semantic-template';
53
55
  export { CueSchemaSuggestion } from './lib/schema-suggestion';
54
56
  export { ENDPOINT_SCHEMA_SUGGESTION_FROM_PROSE, ENDPOINT_SCHEMA_SUGGESTION_CATALOGS, } from './lib/schema-suggestion';
55
57
  export type { SuggestSchemaFromProseRequest, SuggestSchemaFromProseResponse, SchemaSuggestionUsage, } from './lib/schema-suggestion';
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-BSiwWQ5L.js";
1
+ import { B as C, C as u, a as i, b as r, c as o, d as t, e as n, f as S, 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 d, q as I, r as g, s as T, t as D, u as O, v as N, w as U, x as h, y as G, 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 aa, _ as ea, $ as sa, a0 as Ca, a1 as ua, a2 as ia, a3 as ra, a4 as oa, a5 as ta, a6 as na } from "./models-DytxsTwc.js";
2
2
  import "uuid";
3
3
  export {
4
4
  C as BASE_CURRENCY,
@@ -7,56 +7,59 @@ export {
7
7
  r as CatalogKind,
8
8
  o as Cue,
9
9
  t as CueAdmin,
10
- S as CueApi,
11
- n as CueAppData,
10
+ n as CueApi,
11
+ S as CueAppData,
12
12
  c as CueApps,
13
13
  E as CueAuth,
14
- m as CueCache,
15
- p as CueContexts,
16
- A as CueCurrency,
17
- l as CueDataSources,
18
- P as CueDmsApi,
19
- R as CueDocumentFilter,
20
- _ as CueExtraction,
21
- I as CueGis,
22
- d as CueGisSources,
23
- g as CueIndexApi,
24
- T as CueLlmTools,
25
- D as CueMcp,
26
- O as CuePrivileges,
27
- N as CueProcessingApi,
28
- U as CueProfile,
29
- G as CueProjectDocuments,
30
- h as CueProjectEntities,
31
- f as CueProjectSchema,
32
- j as CueProjectView,
33
- v as CueProjects,
34
- x as CueRequestError,
35
- M as CueSchemaSuggestion,
36
- y as CueSemanticTemplate,
37
- B as CueSignUp,
38
- F as CueSignal,
39
- L as CueStorage,
40
- H as CueSyncApi,
41
- b as CueTables,
42
- K as CueUserSettings,
43
- q as DEFAULT_SCHEMA_BASE,
44
- w as ENDPOINT_SCHEMA_SUGGESTION_CATALOGS,
45
- Q as ENDPOINT_SCHEMA_SUGGESTION_FROM_PROSE,
46
- V as EmbeddingBasis,
47
- W as NumeralRole,
48
- X as Provenance,
49
- Y as REQUIRED_ROLES,
50
- k as ResolutionIdentity,
51
- z as SUPPORTED_CURRENCIES,
52
- J as SchemaTermKind,
53
- Z as configureScanWasm,
54
- $ as cueComputed,
55
- ee as deriveIri,
56
- ae as expandCurie,
57
- se as isCurie,
58
- Ce as rdfBase,
59
- ue as resolveIri,
60
- ie as resolveRef,
61
- re as schemaGraphIri
14
+ m as CueAuthError,
15
+ p as CueCache,
16
+ A as CueContexts,
17
+ l as CueCurrency,
18
+ P as CueDataSources,
19
+ R as CueDmsApi,
20
+ _ as CueDocumentFilter,
21
+ d as CueEdits,
22
+ I as CueExtraction,
23
+ g as CueGis,
24
+ T as CueGisSources,
25
+ D as CueIndexApi,
26
+ O as CueLlmTools,
27
+ N as CueMcp,
28
+ U as CuePrivileges,
29
+ h as CueProcessingApi,
30
+ G as CueProfile,
31
+ f as CueProjectDocuments,
32
+ j as CueProjectEntities,
33
+ v as CueProjectSchema,
34
+ x as CueProjectView,
35
+ M as CueProjects,
36
+ y as CueRequestError,
37
+ B as CueSchemaSuggestion,
38
+ F as CueSemanticTemplate,
39
+ L as CueSignUp,
40
+ H as CueSignal,
41
+ b as CueStorage,
42
+ K as CueSyncApi,
43
+ q as CueTables,
44
+ w as CueUserSettings,
45
+ Q as DEFAULT_SCHEMA_BASE,
46
+ V as ENDPOINT_SCHEMA_SUGGESTION_CATALOGS,
47
+ W as ENDPOINT_SCHEMA_SUGGESTION_FROM_PROSE,
48
+ X as EmbeddingBasis,
49
+ Y as NumeralRole,
50
+ k as Provenance,
51
+ z as REQUIRED_ROLES,
52
+ J as ResolutionIdentity,
53
+ Z as SUPPORTED_CURRENCIES,
54
+ $ as SchemaTermKind,
55
+ aa as configureScanWasm,
56
+ ea as cueComputed,
57
+ sa as deriveIri,
58
+ Ca as expandCurie,
59
+ ua as isCurie,
60
+ ia as isReprocessPlan,
61
+ ra as rdfBase,
62
+ oa as resolveIri,
63
+ ta as resolveRef,
64
+ na as schemaGraphIri
62
65
  };
package/lib/admin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CueAuth } from './auth';
2
- import { AdminDeletedOrganizationSummary, AdminDeletedUserSummary, AdminOrganization, AdminOrgSearchResult, AdminOrphanedOrganization, AdminOrphanedProject, AdminOrphanedUser, AdminProjectSearchResult, AdminRestoreOrganizationResult, AdminRestoreUserResult, AdminUserDetail, AdminUserSearchResult, OrganizationData, ProjectData } from './models';
2
+ import { AdminDeletedOrganizationSummary, AdminDeletedUserSummary, AdminOrganization, AdminOrgSearchResult, AdminOrphanedOrganization, AdminOrphanedProject, AdminOrphanedUser, AdminProjectSearchResult, AdminRestoreOrganizationResult, AdminRestoreUserResult, AdminUserDetail, AdminUserSearchResult, OrganizationData, ProjectData, TransferProjectRequest, TransferProjectResult } from './models';
3
3
  /**
4
4
  * Cross-organisation lookup for platform superadmins.
5
5
  *
@@ -10,7 +10,7 @@ import { AdminDeletedOrganizationSummary, AdminDeletedUserSummary, AdminOrganiza
10
10
  *
11
11
  * Search is substring matching done server-side over a capped scan (Firestore
12
12
  * has no substring index), so results are best-effort rather than exhaustive on
13
- * very large collections — see the service-side notes in `data-views`.
13
+ * very large collections — see the service-side notes in `writers-cue-bff`'s read side.
14
14
  *
15
15
  * @example
16
16
  * ```ts
@@ -54,6 +54,18 @@ export declare class CueAdmin {
54
54
  * teardown, not normal superadmin use, since a hard delete cannot be undone.
55
55
  */
56
56
  deleteUser(uid: string, hard?: boolean): Promise<void>;
57
+ /**
58
+ * Overwrites a user's display name (Auth `displayName` and profile doc) — e.g.
59
+ * for accounts created before a name was required. Any user, any org.
60
+ */
61
+ renameUser(uid: string, name: string): Promise<void>;
62
+ /**
63
+ * Hands a project to another organisation. Consumption up to now stays on the
64
+ * current owner's balance; only later uploads count against the new one.
65
+ * Members and roles are unchanged. Throws a `CueRequestError` with status 409
66
+ * when the project no longer belongs to `expectedCurrentOrganizationID`.
67
+ */
68
+ transferProject(projectId: string, request: TransferProjectRequest): Promise<TransferProjectResult>;
57
69
  /**
58
70
  * Undoes `deleteUser`: recreates the Auth account (same uid) and profile doc,
59
71
  * and re-grants the recorded org/project roles where those still exist.
package/lib/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CueBlobStorage } from '../../databases/src/index';
2
2
  import { CueAuth } from './auth';
3
- import { SearchRequest, SearchResponse, ShaclValidationReport, UnitsConsumedDto } from './models';
3
+ import { ReprocessAccepted, ReprocessDocumentOptions, ReprocessPlan, SearchRequest, SearchResponse, ShaclValidationReport, UnitsConsumedDto } from './models';
4
4
  import { CueProjects } from './project';
5
5
  import { CueSyncApi } from './sync';
6
6
  import { CueTables } from './tables';
@@ -18,6 +18,7 @@ import { CueDataSources } from './data-sources';
18
18
  import { CueGisSources } from './gis-sources';
19
19
  import { CueSchemaSuggestion } from './schema-suggestion';
20
20
  import { CueSemanticTemplate } from './semantic-template';
21
+ import { CueEdits } from './edits';
21
22
  export interface PutAlternativeRepresentationResult {
22
23
  success: boolean;
23
24
  contentIRI: string;
@@ -61,6 +62,8 @@ export declare class CueApi {
61
62
  readonly semanticTemplate: CueSemanticTemplate;
62
63
  /** Prose into a proposed `ProjectSchema`, selected from the published term catalogues. */
63
64
  readonly schemaSuggestion: CueSchemaSuggestion;
65
+ /** Hand-made graph edits from the document viewer — entity mentions, selectors, content categories. */
66
+ readonly edits: CueEdits;
64
67
  /** Active language used for language-sensitive SPARQL queries across all project classes. */
65
68
  language: string;
66
69
  /** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
@@ -134,4 +137,13 @@ export declare class CueApi {
134
137
  processorId?: string;
135
138
  comment?: string;
136
139
  }): Promise<PutAlternativeRepresentationResult>;
140
+ /**
141
+ * Purges everything derived from a document and republishes its initial
142
+ * processing event (superadmin only).
143
+ *
144
+ * Answers 202 with a process id; progress arrives on the project's
145
+ * processing-status socket as a `reprocessJobs` entry with the same id. With
146
+ * `dryRun`, nothing is mutated and the resolved plan comes back instead.
147
+ */
148
+ reprocessDocument(projectId: string, documentUUID: string, options?: ReprocessDocumentOptions): Promise<ReprocessAccepted | ReprocessPlan>;
137
149
  }
package/lib/apps.d.ts CHANGED
@@ -19,6 +19,12 @@ export declare class CueApps {
19
19
  create(options: CreateCustomAppOptions): Promise<CustomAppRecord>;
20
20
  /** Update an existing custom app. Only the original author or an organization admin may do this. */
21
21
  update(id: string, options: UpdateCustomAppOptions): Promise<CustomAppRecord>;
22
+ /**
23
+ * Copy a custom app into another organization, e.g. after moving a project there. The caller
24
+ * must belong to both organizations (superadmins always may). Repeating the call returns the
25
+ * earlier copy instead of making another.
26
+ */
27
+ copy(id: string, organizationID: string): Promise<CustomAppRecord>;
22
28
  /** Delete a custom app. Only the original author or an organization admin may do this. */
23
29
  remove(id: string): Promise<void>;
24
30
  }
package/lib/auth.d.ts CHANGED
@@ -4,6 +4,18 @@ import { CueEndpoints, PasswordCredentials, SsoProvider } from './models';
4
4
  import { ReadonlySignal } from './signal';
5
5
  export type AuthStateListener = (user: User | null) => void;
6
6
  export type Unsubscribe = () => void;
7
+ /**
8
+ * Error thrown by sign-in and password reset. `message` is safe to show to the
9
+ * user; `code` is Firebase's (e.g. 'auth/invalid-credential') when it came from
10
+ * Firebase, or 'cue/sso-no-account' | 'cue/sso-unconfirmed' when the backend
11
+ * refused an SSO sign-in. UIs should translate by `code`, not show `message`.
12
+ * The original error is kept as `cause`.
13
+ */
14
+ export declare class CueAuthError extends Error {
15
+ readonly code?: string | undefined;
16
+ readonly cause?: unknown | undefined;
17
+ constructor(message: string, code?: string | undefined, cause?: unknown | undefined);
18
+ }
7
19
  export declare class CueAuth {
8
20
  private readonly _auth;
9
21
  private readonly _endpoints;
@@ -42,9 +54,9 @@ export declare class CueAuth {
42
54
  */
43
55
  checkRedirectResult(): Promise<User | null>;
44
56
  /**
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.
57
+ * Lets the backend see every SSO sign-in: a first-time user gets a profile
58
+ * without an organisation. A 403 (older backends refused SSO sign-ups and
59
+ * deleted the account) signs out and throws.
48
60
  * Fails closed: if the check cannot be made, the session is dropped.
49
61
  */
50
62
  private _confirmSsoSignIn;
@@ -68,6 +80,12 @@ export declare class CueAuth {
68
80
  * restored auth state.
69
81
  */
70
82
  mintAppSessionToken(): Promise<string>;
83
+ /**
84
+ * Send a password-reset email. Firebase's email-enumeration protection makes
85
+ * this succeed silently for unknown addresses, so callers should word their
86
+ * confirmation as "if an account exists…".
87
+ */
88
+ resetPassword(email: string): Promise<void>;
71
89
  /** Sign out the current user */
72
90
  signOut(): Promise<void>;
73
91
  /** Currently signed-in user, or null if not authenticated */
@@ -309,7 +309,7 @@ export interface SheetFileLinkage {
309
309
  * self-describing: what a stored mapping does to its input is not the query alone, and neither a
310
310
  * human reading the config nor a future engine should have to know about an implicit post-pass.
311
311
  * Order is significant. An absent `postProcessing` means "the default for this config type" —
312
- * see `_postProcessingSteps` in writers-commands' data-sources.service.ts, which is also where the legacy
312
+ * see `_postProcessingSteps` in writers-cue-bff's data-sources.service.ts, which is also where the legacy
313
313
  * behaviour for configs saved before this field existed is pinned down.
314
314
  */
315
315
  export type XToRdfPostProcessingStep = MintCanonicalEntitiesStep;
@@ -382,8 +382,8 @@ export interface DataSourceProgressEvent {
382
382
  * re-applied to every subsequent data upload. Uploaded data's derived triples
383
383
  * land in the data source's own named graph.
384
384
  *
385
- * Mutations (create/update/delete/uploadData) go through writers-commands and
386
- * require the syncer role; reads (list/get) go through data-views.
385
+ * Mutations (create/update/delete/uploadData) require the syncer role; reads
386
+ * (list/get) need only membership. Both go to `writers-cue-bff`.
387
387
  *
388
388
  * Exposed as `cue.api.dataSources`.
389
389
  */
@@ -426,7 +426,21 @@ export declare class CueDataSources {
426
426
  * built from the stream's `error` line (a non-2xx HTTP status, e.g. an auth/guard rejection
427
427
  * before the handler even runs, is still thrown from `response.ok` as before).
428
428
  */
429
+ /**
430
+ * Where an API client posts a data source's files directly (multipart `files` plus `mode`),
431
+ * for showing to users who script uploads with an API key. `uploadData` itself stages
432
+ * through storage instead, to stay under the request-size limit.
433
+ */
434
+ uploadEndpointUrl(id: string): string;
429
435
  uploadData(projectId: string, id: string, files: Blob[], mode: UploadDataSourceMode, onProgress?: (event: DataSourceProgressEvent) => void): Promise<UploadDataSourceResult>;
436
+ /**
437
+ * Same as `uploadData`, but over the source file(s) the data source's config already stores
438
+ * (`config.sourceFiles`, persisted by `DataSourceHandlers.uploadSourceFile` when the mapping was
439
+ * saved) — nothing is uploaded. What a mapping edit wants: the file it was built from is already
440
+ * in storage, so sending it back up only costs the transfer. Refused for a data source that
441
+ * stores no source file. Same NDJSON progress stream and `{added, removed}` result.
442
+ */
443
+ uploadDataFromSource(projectId: string, id: string, mode: UploadDataSourceMode, onProgress?: (event: DataSourceProgressEvent) => void): Promise<UploadDataSourceResult>;
430
444
  /**
431
445
  * Re-runs a data source that has no uploaded input — today only a `files` config, whose input is
432
446
  * the project's own file locations. This is how "new files have arrived since this ran" is
@@ -453,7 +467,7 @@ export declare class CueDataSources {
453
467
  }>;
454
468
  /**
455
469
  * Uploads every file straight to the raw bucket's `${projectId}/_tmp-uploads/` prefix (server
456
- * deletes each one right after processing it — see writers-commands' `_withTempFiles`), so
470
+ * deletes each one right after processing it — see writers-cue-bff's `_withTempFiles`), so
457
471
  * `uploadData`/`previewTransform`'s own request only ever carries small JSON references —
458
472
  * bytes never cross Cloud Run's request-size cap, no matter how large the file. Reports
459
473
  * upload-byte progress through `onProgress` as `phase: 'uploading'`, aggregated across every
package/lib/edits.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { CueAuth } from './auth';
2
+ import { BatchEditResult, ContentCategoryChange, EditResult, EntityMentionDeletion, EntityMentionInput, SelectorInput } from './models';
3
+ /**
4
+ * Hand-made edits to a project's graph — the annotations a user adds or removes
5
+ * in the document viewer. Each call is one ledger commit on the service side.
6
+ * Writes need the `member` role on the project.
7
+ */
8
+ export declare class CueEdits {
9
+ private readonly _auth;
10
+ private readonly _gatewayUrl;
11
+ constructor(_auth: CueAuth, _gatewayUrl: string);
12
+ /** Creates entity mentions in one batch. */
13
+ createEntityMentions(projectId: string, items: EntityMentionInput[], batchComment?: string): Promise<BatchEditResult>;
14
+ /** Deletes entity mentions in one batch. */
15
+ deleteEntityMentions(projectId: string, items: EntityMentionDeletion[], batchComment?: string): Promise<BatchEditResult>;
16
+ /** Creates selectors (the text spans mentions point at) in one batch. */
17
+ createSelectors(projectId: string, items: SelectorInput[], batchComment?: string): Promise<BatchEditResult>;
18
+ /** Replaces a document's content categories: `existingValues` out, `newValues` in. */
19
+ changeContentCategory(projectId: string, change: ContentCategoryChange): Promise<EditResult>;
20
+ private _send;
21
+ }
@@ -31,8 +31,8 @@ export interface GisSourceRecord {
31
31
  * every other (WFS-backed) category. Reprojection to WGS84 (from LV95/LV03) happens server-side
32
32
  * at upload time — `featureCollection` is always WGS84.
33
33
  *
34
- * Mutations (create/update/delete) go through writers-commands and require the syncer role;
35
- * reads (list/get) go through data-views.
34
+ * Mutations (create/update/delete) require the syncer role; reads (list/get) need only
35
+ * membership. Both go to `writers-cue-bff`.
36
36
  *
37
37
  * Exposed as `cue.api.gisSources`.
38
38
  */
package/lib/models.d.ts CHANGED
@@ -33,7 +33,7 @@ export interface CueSdkConfig {
33
33
  export interface CueStorageConfig {
34
34
  /**
35
35
  * Per-bucket driver. `firebase` (the default) uses Firebase Storage and its
36
- * security rules; `gateway` uses the gateway's `/commands/storage` endpoints,
36
+ * security rules; `gateway` uses the gateway's `/bff/storage` endpoints,
37
37
  * which work on any backend the deployment runs (GCS, MinIO, S3).
38
38
  */
39
39
  drivers?: Partial<Record<BlobBucket, BlobDriverKind>>;
@@ -180,7 +180,7 @@ export interface ProjectSettings {
180
180
  * Absent means English only, which is what every project resolved to before
181
181
  * this field existed.
182
182
  *
183
- * Read by `writers-commands` (stamped onto `ProjectSchema.languages` on every
183
+ * Read by `writers-cue-bff` (stamped onto `ProjectSchema.languages` on every
184
184
  * schema write), the schema-suggestion endpoint (which languages a proposed
185
185
  * term is translated into), and the translation enricher (its targets, minus
186
186
  * the pivot).
@@ -257,6 +257,35 @@ export interface ProjectData {
257
257
  /** Set by a superadmin's soft delete — the project doc, index, and storage remain intact. */
258
258
  deleted?: boolean;
259
259
  deletedAt?: string | null;
260
+ /** Who owned the project when — absent until the first transfer (see `CueAdmin.transferProject`). */
261
+ ownershipHistory?: ProjectOwnershipPeriod[];
262
+ /** Orgs that owned the project before; their earlier consumption stays on their balance. */
263
+ formerOrganizationIDs?: string[];
264
+ }
265
+ /** One stretch of ownership, running from `from` until the next period's `from`. */
266
+ export interface ProjectOwnershipPeriod {
267
+ organizationID: string;
268
+ from: string;
269
+ transferId?: string;
270
+ transferredBy?: string;
271
+ /** Credits moved from the previous owner as part of the transfer (0 = none). */
272
+ creditTransfer?: number;
273
+ }
274
+ /** Body of `CueAdmin.transferProject`. */
275
+ export interface TransferProjectRequest {
276
+ organizationID: string;
277
+ /** The owner the caller saw — the server answers 409 if it has changed since. */
278
+ expectedCurrentOrganizationID: string;
279
+ /** Credits to move from the current owner to the new one; required, 0 = none. */
280
+ creditTransfer: number;
281
+ /** Client-generated UUID. Repeat it to retry a failed credit transfer. */
282
+ transferId: string;
283
+ }
284
+ /** `creditTransferFailed` means the project moved but its credits did not — retry with the same `transferId`. */
285
+ export interface TransferProjectResult {
286
+ project: ProjectData;
287
+ creditTransferFailed: boolean;
288
+ creditTransferError?: string;
260
289
  }
261
290
  export interface CreateProjectOptions {
262
291
  /** The organization this project belongs to */
@@ -590,6 +619,10 @@ export interface OrgCreditsDto {
590
619
  available: number;
591
620
  plan: OrgPlanSummary;
592
621
  }
622
+ /** An {@link OrgCreditsDto} tagged with the org it was fetched for — what `CueProfile.orgCredits` holds. */
623
+ export interface OrgCredits extends OrgCreditsDto {
624
+ orgId: string;
625
+ }
593
626
  /** Consumption for a single calendar month (`YYYY-MM`, UTC), keyed by the file's own upload time. */
594
627
  export interface MonthlyConsumptionDto {
595
628
  unitsConsumed: number;
@@ -601,6 +634,12 @@ export interface ProjectConsumptionReportDto {
601
634
  name?: string;
602
635
  /** Keyed by `YYYY-MM` (UTC). */
603
636
  monthly: Record<string, MonthlyConsumptionDto>;
637
+ /** Set when the org handed the project to another org; `monthly` then covers only its own ownership. */
638
+ transferredTo?: {
639
+ organizationID: string;
640
+ name?: string;
641
+ at: string;
642
+ };
604
643
  }
605
644
  /** Per-project, per-month consumption breakdown for an org — see {@link OrgCreditsDto} for the org-level totals. */
606
645
  export interface OrgConsumptionReportDto {
@@ -718,6 +757,8 @@ export interface CustomAppRecord {
718
757
  tone: string;
719
758
  authorId: string;
720
759
  authorName: string;
760
+ /** Set on a copy made into another organization via `cue.api.apps.copy` — the id of the original. */
761
+ copiedFrom?: string;
721
762
  createdAt: string;
722
763
  updatedAt: string;
723
764
  }
@@ -750,10 +791,10 @@ export interface RDFWritingDoc {
750
791
  lastRDFWrite: string;
751
792
  }
752
793
  /**
753
- * `processing` covers the upload→artifact window: a file has been uploaded and a
754
- * processor is working on it, but no `.ttl` exists yet so none of the RDF
755
- * write/load/resolution tracking has begun. It is the *lowest*-precedence stage,
756
- * so a project already committing RDF never appears to fall back to it.
794
+ * The project's stage, derived from its documents: `processing` while any
795
+ * document is on its way to `stored`, `enriching` while resolution runs. The
796
+ * detail is in `documentCounts`. `writing` and `loading` are no longer emitted
797
+ * by current servers.
757
798
  */
758
799
  export type ProcessingStage = 'idle' | 'processing' | 'writing' | 'loading' | 'enriching';
759
800
  /**
@@ -761,16 +802,17 @@ export type ProcessingStage = 'idle' | 'processing' | 'writing' | 'loading' | 'e
761
802
  *
762
803
  * - `uploaded` — in storage, no processor output yet
763
804
  * - `processing` — a processor has emitted artifacts (markdown, images, fragments)
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
805
+ * - `extracting` — processing or extraction outstanding, or its RDF not yet bundled
806
+ * - `stored` — done through extraction, and every `.ttl` produced so far is bundled
767
807
  * - `failed` — processing errored
768
808
  *
769
- * `stored` is not strictly final: an enricher producing further RDF later moves
770
- * the document back to `ready` until that RDF is bundled too, which is a
771
- * faithful description of reality rather than a bug.
809
+ * Partial problems (a page whose extraction failed) do not fail the document;
810
+ * they are listed in `gaps`. `stored` is not strictly final: RDF arriving later
811
+ * moves the document back to `extracting` until it is bundled too.
772
812
  */
773
- export type DocumentProcessingStage = 'uploaded' | 'processing' | 'extracting' | 'ready' | 'stored' | 'failed';
813
+ export type DocumentProcessingStage = 'uploaded' | 'processing' | 'extracting' | 'stored' | 'failed';
814
+ /** How many of a project's documents are in each stage. */
815
+ export type DocumentStageCounts = Record<DocumentProcessingStage, number>;
774
816
  /** Per-document pipeline progress for one uploaded file. */
775
817
  export interface DocumentProgress {
776
818
  documentUUID: string;
@@ -798,6 +840,8 @@ export interface DocumentProgress {
798
840
  export interface ProjectProcessingSummary {
799
841
  projectId: string;
800
842
  stage: ProcessingStage;
843
+ /** Absent on older servers. */
844
+ documentCounts?: DocumentStageCounts;
801
845
  pendingDocumentCount: number;
802
846
  failedDocumentCount: number;
803
847
  lastActivityAt?: string;
@@ -818,10 +862,98 @@ export interface MyProcessingStatus {
818
862
  */
819
863
  truncated?: boolean;
820
864
  }
865
+ /** Options for `CueApi.reprocessDocument` — mirrors the service's `ReprocessDocumentDto`. */
866
+ export interface ReprocessDocumentOptions {
867
+ removeGraphs?: boolean;
868
+ removeProcessed?: boolean;
869
+ /** Publish even when the raw blob carries `skip_processing` (does not clear the flag). */
870
+ force?: boolean;
871
+ resetAttempts?: boolean;
872
+ dryRun?: boolean;
873
+ }
874
+ /** 202 body: the reprocess is running, follow `processId` on the status socket. */
875
+ export interface ReprocessAccepted {
876
+ processId: string;
877
+ projectId: string;
878
+ documentUUID: string;
879
+ status: string;
880
+ }
881
+ /** 200 body for a `dryRun` request — what a real run would purge. */
882
+ export interface ReprocessPlan {
883
+ dryRun: true;
884
+ projectId: string;
885
+ documentUUID: string;
886
+ graphs: string[];
887
+ quads: number;
888
+ blobs: string[];
889
+ rawBlobPresent: boolean;
890
+ /**
891
+ * Count of this document's mentions already resolved into a canonical entity
892
+ * elsewhere in the project — purging leaves that entity's link dangling until
893
+ * the pipeline re-resolves the same text.
894
+ */
895
+ resolvedMentionsAtRisk: number;
896
+ }
897
+ export declare const isReprocessPlan: (r: ReprocessAccepted | ReprocessPlan) => r is ReprocessPlan;
898
+ /** One entity mention to create — mirrors the service's `CreateEntityMentionDto`. */
899
+ export interface EntityMentionInput {
900
+ mention: {
901
+ iri: string;
902
+ value: string;
903
+ entityCategories: string[];
904
+ description?: string | null;
905
+ resolvesTo?: string | null;
906
+ properties?: string[];
907
+ /** Subjects (e.g. selectors) this mention is made in. */
908
+ mentions?: string[];
909
+ relationships?: {
910
+ predicate: string;
911
+ objectIri: string;
912
+ }[];
913
+ };
914
+ namedGraph: string;
915
+ comment?: string;
916
+ }
917
+ /** One entity mention to delete — mirrors the service's `DeleteEntityMentionDto`. */
918
+ export interface EntityMentionDeletion {
919
+ iri: string;
920
+ comment?: string;
921
+ }
922
+ /** One selector to create — mirrors the service's `CreateSelectorDto`. */
923
+ export interface SelectorInput {
924
+ iri: string;
925
+ type: string;
926
+ selectorSubjects: string[];
927
+ selectorObject: string;
928
+ value: string;
929
+ namedGraph: string;
930
+ comment?: string;
931
+ }
932
+ /** Replaces a subject's content categories — mirrors the service's `ChangeObjectIRIRequestDto`. */
933
+ export interface ContentCategoryChange {
934
+ subject: string;
935
+ existingValues: string[];
936
+ newValues: string[];
937
+ comment?: string;
938
+ }
939
+ /** Outcome of one graph edit — mirrors the service's `MutationResult`. */
940
+ export interface EditResult {
941
+ message: string;
942
+ success: boolean;
943
+ insertCount?: number;
944
+ iri?: string;
945
+ errorCode?: string;
946
+ }
947
+ /** Outcome of a batch of graph edits — mirrors the service's `BatchMutationResult`. */
948
+ export interface BatchEditResult {
949
+ results: EditResult[];
950
+ successCount: number;
951
+ failureCount: number;
952
+ }
821
953
  /** Lifecycle of a superadmin document-reprocess request. */
822
954
  export type ReprocessJobStatus = 'queued' | 'purging-rdf' | 'purging-blobs' | 'publishing' | 'succeeded' | 'failed';
823
955
  /**
824
- * Progress of one document reprocess (`POST /commands/document/:uuid/reprocess`),
956
+ * Progress of one document reprocess (`POST /bff/document/:uuid/reprocess`),
825
957
  * pushed on the same socket as the rest of the pipeline status.
826
958
  */
827
959
  export interface DocumentReprocessJob {
@@ -843,7 +975,7 @@ export interface DocumentReprocessJob {
843
975
  finishedAt?: string;
844
976
  }
845
977
  /**
846
- * Aggregated, per-project pipeline status pushed live by the `accessors-data-views`
978
+ * Aggregated, per-project pipeline status pushed live by the `writers-cue-bff`
847
979
  * processing-status WebSocket (see `CueProcessingApi.watchStatus`). Shape mirrors
848
980
  * `cue-ui`'s `ProcessingStatus` (views/project-settings/models.ts) so it can be
849
981
  * passed straight through to `<cue-project-settings>` / `<cue-portal-upload>`.
@@ -873,9 +1005,11 @@ export interface ProcessingStatus {
873
1005
  * this as "the recent ones" and rely on the counts below for totals.
874
1006
  */
875
1007
  documents?: DocumentProgress[];
1008
+ /** How many documents are in each stage. Exact. Absent on older servers. */
1009
+ documentCounts?: DocumentStageCounts;
876
1010
  /**
877
1011
  * Documents not yet in a terminal stage. Exact even when `documents` was
878
- * truncated. Optional because a client may be talking to a data-views
1012
+ * truncated. Optional because a client may be talking to a writers-cue-bff
879
1013
  * deployment predating per-document tracking, which omits it — treat absent as
880
1014
  * "unknown", not zero.
881
1015
  */
@@ -14,7 +14,7 @@ export interface MyProcessingStatusWatcher {
14
14
  close(): void;
15
15
  }
16
16
  /**
17
- * Live pipeline-progress status, pushed by the `accessors-data-views`
17
+ * Live pipeline-progress status, pushed by `writers-cue-bff`'s
18
18
  * processing-status WebSockets. Backs the upload modal, the project-settings
19
19
  * "processing" indicators, and the header's cross-project badge.
20
20
  */