@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/lib/profile.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { UserInfo } from 'firebase/auth';
2
- import { APIKeyDoc, APIKeyInfo, FileTypeBreakdownDto, OrgConsumptionReportDto, OrgCreditsDto, OrgMember, OrganizationData, ProfileSSOAccount, TrafficReportDto, UsageReportDto } from './models';
2
+ import { APIKeyDoc, APIKeyInfo, FileTypeBreakdownDto, OrgConsumptionReportDto, OrgCredits, OrgCreditsDto, OrgMember, OrganizationData, ProfileSSOAccount, TrafficReportDto, UsageReportDto } from './models';
3
3
  import { CueAuth } from './auth';
4
4
  import { ReadonlySignal } from './signal';
5
+ import { OrgSignUpPlan } from './signup';
5
6
  export declare class CueProfile {
6
7
  private readonly _auth;
7
8
  private readonly _gatewayUrl;
@@ -11,10 +12,12 @@ export declare class CueProfile {
11
12
  * by `getOrgCredits()` and by the sync layer after every `previewSync`/
12
13
  * `sync`/`computeCredits` call, so consumers that bind to this signal see
13
14
  * balance changes (e.g. after an upload) without polling or manually
14
- * re-fetching. Angular consumers bridge via
15
+ * re-fetching. The value carries the `orgId` it belongs to: fetches for
16
+ * different orgs can resolve out of order, so check it against the org on
17
+ * screen before showing the balance. Angular consumers bridge via
15
18
  * `effect(() => sig.set(cue.profile.orgCredits.get()))` + `.subscribe(...)`.
16
19
  */
17
- readonly orgCredits: ReadonlySignal<OrgCreditsDto | undefined>;
20
+ readonly orgCredits: ReadonlySignal<OrgCredits | undefined>;
18
21
  constructor(_auth: CueAuth, _gatewayUrl: string);
19
22
  private _url;
20
23
  private _fetch;
@@ -46,6 +49,39 @@ export declare class CueProfile {
46
49
  listOrganizations(): Promise<(Pick<OrganizationData, 'id' | 'name'> & {
47
50
  isAdmin: boolean;
48
51
  })[]>;
52
+ /**
53
+ * Creates an organisation with the current user as its admin — for a user
54
+ * who belongs to none. It claims the user's email domain when that email is
55
+ * verified, not a free-mail provider and not claimed already; otherwise it is
56
+ * created without a domain. Throws `CueRequestError` with `code`
57
+ * 'alreadyInOrganisation' when the user already belongs to one.
58
+ */
59
+ createOwnOrganization(orgName: string, plan: OrgSignUpPlan): Promise<{
60
+ orgId: string;
61
+ orgName: string;
62
+ domains: string[];
63
+ checkoutUrl?: string;
64
+ }>;
65
+ /**
66
+ * Asks to join the organisation owning `domain` (e.g. `qaecy.com`); its
67
+ * admins get an email. Resolves the same whether or not any organisation
68
+ * owns the domain, so it can't be used to find out. Throws `CueRequestError`
69
+ * with `code` 'emailNotVerified' | 'invalidDomain'.
70
+ */
71
+ requestToJoinOrganization(domain: string): Promise<void>;
72
+ /**
73
+ * Joins the organisation owning the current user's email domain — only once
74
+ * that email is verified, which is why sign-up itself never joins one. Call
75
+ * it when a signed-in user has no organisation; `joined` is false when the
76
+ * email is unverified or no organisation owns the domain.
77
+ */
78
+ joinOrganizationByEmailDomain(): Promise<{
79
+ joined: boolean;
80
+ orgId?: string;
81
+ orgName?: string;
82
+ }>;
83
+ /** POSTs JSON and surfaces the backend's error `code`, for calls whose failures a UI maps. */
84
+ private _fetchCoded;
49
85
  /** Returns all members of the given organisation. Caller must be an org admin or superadmin. */
50
86
  getOrgMembers(orgId: string): Promise<OrgMember[]>;
51
87
  /** Returns just the given organisation's admins. Caller must be a member (or admin/superadmin). */
@@ -32,6 +32,37 @@ export interface EntityRelationshipInput extends EntityCategoryInput {
32
32
  sources: string[];
33
33
  targets: string[];
34
34
  }
35
+ /** A declared canonical's new value. Changing it changes the canonical's IRI, and everything pointing at it moves too. */
36
+ export interface RenameCanonicalInput {
37
+ categoryKey: string;
38
+ canonicalKey: string;
39
+ newValue: string;
40
+ /** The schema revision the caller read; a stale one is refused. */
41
+ revision: number;
42
+ /** When the new value is already a canonical of the category. Defaults to `merge`. */
43
+ onCollision?: 'merge' | 'refuse';
44
+ /** Record the old value as a resolved form of the new canonical. Defaults to `false`. */
45
+ keepOldAsAlias?: boolean;
46
+ /** Report what would change and write nothing. */
47
+ dryRun?: boolean;
48
+ }
49
+ export interface RenameCanonicalResult {
50
+ oldIri: string;
51
+ newIri: string;
52
+ collision: boolean;
53
+ /** Set when the collision is with another canonical declared in the schema. */
54
+ collidesWithKey?: string;
55
+ dryRun: boolean;
56
+ quads: number;
57
+ mentions: number;
58
+ files: number;
59
+ graphs: number;
60
+ dataSources: number;
61
+ /** The saved schema's revision; absent on a dry run. */
62
+ revision?: number;
63
+ /** Follow-up steps that failed after the graph moved — running the same rename again finishes them. */
64
+ warnings: string[];
65
+ }
35
66
  /**
36
67
  * One project the caller could take an existing schema from — what
37
68
  * `listSchemaSources` lists.
@@ -53,7 +84,7 @@ export interface SchemaSource {
53
84
  relations: number;
54
85
  }
55
86
  /**
56
- * Client for writers-commands' semantic-template CRUD endpoints — persists a
87
+ * Client for writers-cue-bff's semantic-template CRUD endpoints — persists a
57
88
  * project's custom extraction/classification schema (content categories,
58
89
  * entity categories, entity relationships) and reloads the project's
59
90
  * `databases-cue` schema graph after every mutation.
@@ -124,6 +155,11 @@ export declare class CueSemanticTemplate {
124
155
  reloadSchema(projectId: string): Promise<MutationResult>;
125
156
  private _get;
126
157
  private _send;
158
+ /**
159
+ * Changes a declared canonical's value. Needs the syncer or admin role. Run it with `dryRun`
160
+ * first to see what would move and whether the new value collides.
161
+ */
162
+ renameCanonical(projectId: string, input: RenameCanonicalInput): Promise<RenameCanonicalResult>;
127
163
  private _post;
128
164
  private _delete;
129
165
  private _errorMessage;
package/lib/signup.d.ts CHANGED
@@ -39,17 +39,16 @@ export declare class CueSignUp {
39
39
  private readonly _gatewayUrl;
40
40
  constructor(_gatewayUrl: string);
41
41
  /**
42
- * Register a new user by name and email.
43
- * The backend validates that the email domain belongs to an existing organisation,
44
- * creates the Firebase Auth account, assigns org membership, and — when no
45
- * `password` is given — dispatches a "set your password" email to the
46
- * address provided. `termsVersion`, when given, is recorded as accepted
47
- * immediately so the user isn't asked again on their next sign-in.
48
- * Returns the new user's UID and the organisation name on success.
42
+ * Register a new user by name and email. The account starts without an
43
+ * organisation and the answer is the same whatever the email's domain; the
44
+ * user joins the organisation owning that domain once the email is verified
45
+ * (see `CueProfile.joinOrganizationByEmailDomain`). When no `password` is
46
+ * given, a "set your password" email is sent. `termsVersion`, when given, is
47
+ * recorded as accepted immediately so the user isn't asked again on their
48
+ * next sign-in.
49
49
  */
50
50
  signUp(name: string, email: string, password?: string, termsVersion?: string): Promise<{
51
51
  uid: string;
52
- orgName: string;
53
52
  }>;
54
53
  /**
55
54
  * Self-service sign-up that creates a new organisation together with its
@@ -3,7 +3,7 @@ import { CueAuth } from './auth';
3
3
  * Records portal view-opens for usage reporting (per-user, per-view, per-project) —
4
4
  * fed into the same GCS-aggregate pipeline as gateway traffic tracking, but written
5
5
  * by the frontend directly instead of Kong's `http-log` plugin. See
6
- * apps/writers/commands/src/app/admin/usage/usage-ingest.service.ts.
6
+ * apps/writers/cue-bff/src/app/admin/usage/usage-ingest.service.ts.
7
7
  */
8
8
  export declare class CueUsageStats {
9
9
  private readonly _auth;