@roxyon/api-client 0.5.0 → 0.7.0

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/dist/index.d.cts CHANGED
@@ -531,10 +531,19 @@ interface CreateDatabaseInput {
531
531
  subscription?: string;
532
532
  /** Omit to have the platform generate one. */
533
533
  password?: string;
534
+ /**
535
+ * `mysql` (default: MySQL/MariaDB on the shared cluster) or `postgres` (PostgreSQL 15 inside the account's own hosting
536
+ * container, at localhost:5432; the first one installs it, a few minutes). Every hosting account has both.
537
+ */
538
+ engine?: 'mysql' | 'postgres';
534
539
  }
535
540
  interface CreateDatabaseResult {
536
541
  ok: boolean;
537
542
  objectId: string;
543
+ engine?: 'mysql' | 'postgres';
544
+ port?: number;
545
+ /** How to connect (PostgreSQL: the URL shape and the no-password psql login over SSH). */
546
+ note?: string;
538
547
  name: string;
539
548
  username: string;
540
549
  /** Shown once — not retrievable afterwards. */
@@ -549,6 +558,8 @@ interface DatabaseSummary {
549
558
  Name: string;
550
559
  Username: string;
551
560
  Status: string;
561
+ /** `postgres` for PostgreSQL; empty or `mysql` for MySQL/MariaDB. */
562
+ Engine?: string;
552
563
  }
553
564
  interface DeleteDatabaseResult {
554
565
  ok: boolean;
@@ -556,10 +567,11 @@ interface DeleteDatabaseResult {
556
567
  status: 'deleting' | 'deleted' | 'failed';
557
568
  error?: string;
558
569
  }
559
- /** Databases (MySQL/MariaDB on the shared Galera cluster) attached to a subscription. */
570
+ /** Databases attached to a subscription: MySQL/MariaDB (shared Galera cluster) or PostgreSQL (in the account's container). */
560
571
  declare class DatabasesApi {
561
572
  private readonly client;
562
573
  constructor(client: RoxyonClient);
574
+ /** `POST /databases/list` — through the console, because PAT/OAuth callers can't read /Databases directly. */
563
575
  list(subscriptionId: string): Promise<DatabaseSummary[]>;
564
576
  /** `POST /databases/create` — provision a database + user; the reconciler does the rest. */
565
577
  create(input: CreateDatabaseInput): Promise<CreateDatabaseResult>;
@@ -643,6 +655,7 @@ interface DeleteEmailResult {
643
655
  declare class EmailApi {
644
656
  private readonly client;
645
657
  constructor(client: RoxyonClient);
658
+ /** `POST /emails/list` — through the console, because PAT/OAuth callers can't read /Emails directly. */
646
659
  list(subscriptionId: string): Promise<EmailSummary[]>;
647
660
  /** `POST /emails/create` — provision a mailbox; the reconciler does the rest. */
648
661
  create(input: CreateEmailInput): Promise<CreateEmailResult>;
package/dist/index.d.ts CHANGED
@@ -531,10 +531,19 @@ interface CreateDatabaseInput {
531
531
  subscription?: string;
532
532
  /** Omit to have the platform generate one. */
533
533
  password?: string;
534
+ /**
535
+ * `mysql` (default: MySQL/MariaDB on the shared cluster) or `postgres` (PostgreSQL 15 inside the account's own hosting
536
+ * container, at localhost:5432; the first one installs it, a few minutes). Every hosting account has both.
537
+ */
538
+ engine?: 'mysql' | 'postgres';
534
539
  }
535
540
  interface CreateDatabaseResult {
536
541
  ok: boolean;
537
542
  objectId: string;
543
+ engine?: 'mysql' | 'postgres';
544
+ port?: number;
545
+ /** How to connect (PostgreSQL: the URL shape and the no-password psql login over SSH). */
546
+ note?: string;
538
547
  name: string;
539
548
  username: string;
540
549
  /** Shown once — not retrievable afterwards. */
@@ -549,6 +558,8 @@ interface DatabaseSummary {
549
558
  Name: string;
550
559
  Username: string;
551
560
  Status: string;
561
+ /** `postgres` for PostgreSQL; empty or `mysql` for MySQL/MariaDB. */
562
+ Engine?: string;
552
563
  }
553
564
  interface DeleteDatabaseResult {
554
565
  ok: boolean;
@@ -556,10 +567,11 @@ interface DeleteDatabaseResult {
556
567
  status: 'deleting' | 'deleted' | 'failed';
557
568
  error?: string;
558
569
  }
559
- /** Databases (MySQL/MariaDB on the shared Galera cluster) attached to a subscription. */
570
+ /** Databases attached to a subscription: MySQL/MariaDB (shared Galera cluster) or PostgreSQL (in the account's container). */
560
571
  declare class DatabasesApi {
561
572
  private readonly client;
562
573
  constructor(client: RoxyonClient);
574
+ /** `POST /databases/list` — through the console, because PAT/OAuth callers can't read /Databases directly. */
563
575
  list(subscriptionId: string): Promise<DatabaseSummary[]>;
564
576
  /** `POST /databases/create` — provision a database + user; the reconciler does the rest. */
565
577
  create(input: CreateDatabaseInput): Promise<CreateDatabaseResult>;
@@ -643,6 +655,7 @@ interface DeleteEmailResult {
643
655
  declare class EmailApi {
644
656
  private readonly client;
645
657
  constructor(client: RoxyonClient);
658
+ /** `POST /emails/list` — through the console, because PAT/OAuth callers can't read /Emails directly. */
646
659
  list(subscriptionId: string): Promise<EmailSummary[]>;
647
660
  /** `POST /emails/create` — provision a mailbox; the reconciler does the rest. */
648
661
  create(input: CreateEmailInput): Promise<CreateEmailResult>;
package/dist/index.js CHANGED
@@ -746,14 +746,14 @@ var DatabasesApi = class {
746
746
  this.client = client;
747
747
  }
748
748
  client;
749
+ /** `POST /databases/list` — through the console, because PAT/OAuth callers can't read /Databases directly. */
749
750
  async list(subscriptionId) {
750
- const r = await this.client.get("/Databases", {
751
- fields: "objectId,Name,Username,Status",
752
- limit: -1,
753
- order: "-createdAt",
754
- where: { Subscription: subscriptionId, eye: { in: "1,0" } }
751
+ const r = await this.client.console("POST", "/databases/list", {
752
+ body: { subscription: subscriptionId },
753
+ tolerateHttpError: true
755
754
  });
756
- return r.results ?? [];
755
+ if (!r?.ok) throw new RoxyonApiError(r?.error || "Could not list the databases.", { body: r });
756
+ return r.databases ?? [];
757
757
  }
758
758
  /** `POST /databases/create` — provision a database + user; the reconciler does the rest. */
759
759
  async create(input) {
@@ -811,14 +811,11 @@ var EmailApi = class {
811
811
  this.client = client;
812
812
  }
813
813
  client;
814
+ /** `POST /emails/list` — through the console, because PAT/OAuth callers can't read /Emails directly. */
814
815
  async list(subscriptionId) {
815
- const r = await this.client.get("/Emails", {
816
- fields: "objectId,Email,LocalPart,Status,Quota",
817
- limit: -1,
818
- order: "-createdAt",
819
- where: { Subscription: subscriptionId, eye: { in: "1,0" } }
820
- });
821
- return r.results ?? [];
816
+ const r = await this.client.console("POST", "/emails/list", { body: { subscription: subscriptionId }, tolerateHttpError: true });
817
+ if (!r?.ok) throw new RoxyonApiError(r?.error || "Could not list the mailboxes.", { body: r });
818
+ return (r.emails ?? []).map((e) => ({ ...e, LocalPart: e.Email.split("@")[0] ?? "" }));
822
819
  }
823
820
  /** `POST /emails/create` — provision a mailbox; the reconciler does the rest. */
824
821
  async create(input) {