@centia-io/sdk 0.0.44 → 0.0.46

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.
@@ -441,128 +441,231 @@
441
441
  };
442
442
 
443
443
  //#endregion
444
- //#region src/util/request-headers.ts
444
+ //#region src/http/errors.ts
445
445
  /**
446
- * @author Martin Høgh <mh@mapcentia.com>
447
- * @copyright 2013-2026 MapCentia ApS
448
- * @license https://opensource.org/license/mit The MIT License
449
- *
446
+ * Normalized error thrown by all SDK HTTP operations.
447
+ * CLI and Web should catch this type for consistent error handling.
450
448
  */
451
- const getHeaders = async (contentType = "application/json") => {
452
- if (!await isLogin(new Gc2Service(getOptions()))) return Promise.reject("Is not logged in");
453
- const { accessToken } = getTokens();
454
- const headers = {
455
- Accept: "application/json",
456
- Cookie: "XDEBUG_SESSION=XDEBUG_ECLIPSE",
457
- Authorization: accessToken ? "Bearer " + accessToken : null
458
- };
459
- if (contentType) headers["Content-Type"] = contentType;
460
- return headers;
449
+ var CentiaApiError = class extends Error {
450
+ constructor(opts) {
451
+ super(opts.message);
452
+ this.name = "CentiaApiError";
453
+ if (opts.cause !== void 0) this.cause = opts.cause;
454
+ this.status = opts.status;
455
+ this.code = opts.code;
456
+ this.details = opts.details;
457
+ this.requestId = opts.requestId;
458
+ this.method = opts.method;
459
+ this.url = opts.url;
460
+ }
461
461
  };
462
- var request_headers_default = getHeaders;
462
+ /** Type guard for CentiaApiError. */
463
+ function isCentiaApiError(e) {
464
+ return e instanceof CentiaApiError;
465
+ }
463
466
 
464
467
  //#endregion
465
- //#region src/util/make-request.ts
468
+ //#region src/http/client.ts
466
469
  /**
467
- * @author Martin Høgh <mh@mapcentia.com>
468
- * @copyright 2013-2026 MapCentia ApS
469
- * @license https://opensource.org/license/mit The MIT License
470
- *
470
+ * Unified HTTP client for the Centia API.
471
+ * Works in both Node.js and browser environments.
471
472
  */
472
- const make = async (version, resource, method, payload, contentType = "application/json") => {
473
- const options = getOptions();
474
- let request = {
475
- method,
476
- headers: await request_headers_default(contentType),
477
- redirect: "manual"
478
- };
479
- if (payload) request.body = contentType === "application/json" ? JSON.stringify(payload) : payload;
480
- if (version !== null) return await fetch(options.host + `/api/v${version}/${resource}`, request);
481
- else return await fetch(options.host + `/api/${resource}`, request);
473
+ var CentiaHttpClient = class {
474
+ constructor(config) {
475
+ this.baseUrl = config.baseUrl.replace(/\/+$/, "");
476
+ this.auth = config.auth ?? {};
477
+ this.fetchFn = config.fetch ?? globalThis.fetch.bind(globalThis);
478
+ this.userAgent = config.userAgent;
479
+ }
480
+ /**
481
+ * Execute an HTTP request against the Centia API.
482
+ * Returns parsed JSON on success. Throws CentiaApiError on non-expected status.
483
+ */
484
+ async request(opts) {
485
+ return (await this.requestFull(opts)).body;
486
+ }
487
+ /**
488
+ * Execute an HTTP request and return the full response including headers.
489
+ * Useful for operations that return Location headers (POST 201, PATCH 303).
490
+ */
491
+ async requestFull(opts) {
492
+ const url = this.buildUrl(opts.path, opts.query);
493
+ const headers = await this.buildHeaders(opts);
494
+ const init = {
495
+ method: opts.method,
496
+ headers,
497
+ redirect: "manual"
498
+ };
499
+ if (opts.body !== void 0 && opts.body !== null) init.body = this.resolveContentType(opts.contentType) === "application/json" ? JSON.stringify(opts.body) : opts.body;
500
+ const response = await this.fetchFn(url, init);
501
+ if (response.type === "opaqueredirect") {
502
+ if ((opts.expectedStatus ?? 200) === 303) return {
503
+ body: null,
504
+ status: 303,
505
+ getHeader: (name) => name.toLowerCase() === "location" ? response.url : null
506
+ };
507
+ }
508
+ return {
509
+ body: await this.handleResponse(response, opts, url),
510
+ status: response.status,
511
+ getHeader: (name) => response.headers.get(name)
512
+ };
513
+ }
514
+ buildUrl(path, query) {
515
+ const cleanPath = path.replace(/^\/+/, "");
516
+ let url = `${this.baseUrl}/${cleanPath}`;
517
+ if (query) {
518
+ const params = new URLSearchParams(query);
519
+ url += `?${params.toString()}`;
520
+ }
521
+ return url;
522
+ }
523
+ async buildHeaders(opts) {
524
+ const headers = { "Accept": opts.accept ?? "application/json" };
525
+ if (this.auth.getAccessToken) {
526
+ const token = await this.auth.getAccessToken();
527
+ if (token) headers["Authorization"] = `Bearer ${token}`;
528
+ }
529
+ if (this.auth.getHeaders) {
530
+ const authHeaders = await this.auth.getHeaders();
531
+ Object.assign(headers, authHeaders);
532
+ }
533
+ if (this.userAgent && typeof navigator === "undefined") headers["User-Agent"] = this.userAgent;
534
+ const ct = this.resolveContentType(opts.contentType);
535
+ if (ct) headers["Content-Type"] = ct;
536
+ return headers;
537
+ }
538
+ resolveContentType(contentType) {
539
+ if (contentType === null) return null;
540
+ return contentType ?? "application/json";
541
+ }
542
+ async handleResponse(response, opts, url) {
543
+ const expectedStatus = opts.expectedStatus ?? 200;
544
+ let bodyText = "";
545
+ try {
546
+ bodyText = await response.text();
547
+ } catch {}
548
+ let parsed = null;
549
+ if (bodyText) try {
550
+ parsed = JSON.parse(bodyText);
551
+ } catch {}
552
+ if (response.status !== expectedStatus) throw new CentiaApiError({
553
+ message: (parsed?.message ?? parsed?.error ?? bodyText) || `Unexpected status ${response.status}`,
554
+ status: response.status,
555
+ code: parsed?.code,
556
+ details: parsed,
557
+ requestId: response.headers.get("x-request-id") ?? void 0,
558
+ method: opts.method,
559
+ url
560
+ });
561
+ return parsed ?? (bodyText || null);
562
+ }
482
563
  };
483
- var make_request_default = make;
564
+ /**
565
+ * Create a new Centia HTTP client.
566
+ *
567
+ * Node.js usage:
568
+ * ```ts
569
+ * const client = createCentiaClient({
570
+ * baseUrl: 'https://example.centia.io',
571
+ * auth: { getAccessToken: async () => process.env.CENTIA_TOKEN },
572
+ * });
573
+ * ```
574
+ *
575
+ * Browser usage:
576
+ * ```ts
577
+ * const client = createCentiaClient({
578
+ * baseUrl: 'https://example.centia.io',
579
+ * auth: { getAccessToken: async () => getStoredToken() },
580
+ * });
581
+ * ```
582
+ */
583
+ function createCentiaClient(config) {
584
+ return new CentiaHttpClient(config);
585
+ }
484
586
 
485
587
  //#endregion
486
- //#region src/util/get-response.ts
588
+ //#region src/http/legacy.ts
487
589
  /**
488
590
  * @author Martin Høgh <mh@mapcentia.com>
489
591
  * @copyright 2013-2026 MapCentia ApS
490
592
  * @license https://opensource.org/license/mit The MIT License
491
593
  *
594
+ * Legacy bridge: creates a CentiaHttpClient from storage-based options/tokens.
595
+ * Used by existing SDK modules when no explicit client is provided.
492
596
  */
493
- const get = async (response, expectedCode) => {
494
- let res = null;
495
- let bodyText = "";
496
- try {
497
- bodyText = await response.text();
498
- } catch (e) {}
499
- if (bodyText) try {
500
- res = JSON.parse(bodyText);
501
- } catch (e) {}
502
- if (response.status !== expectedCode) {
503
- const msg = res && (res.message || res.error) || bodyText || `Unexpected status ${response.status}`;
504
- throw new Error(msg);
505
- }
506
- return res;
507
- };
508
- var get_response_default = get;
597
+ /**
598
+ * Create a CentiaHttpClient backed by the legacy storage-based auth.
599
+ * The auth callback reads fresh tokens from storage on each request
600
+ * and auto-refreshes expired access tokens via the refresh token.
601
+ */
602
+ function getLegacyClient() {
603
+ return new CentiaHttpClient({
604
+ baseUrl: getOptions().host,
605
+ auth: { getAccessToken: async () => {
606
+ if (!await isLogin(new Gc2Service(getOptions()))) return;
607
+ return getTokens().accessToken || void 0;
608
+ } }
609
+ });
610
+ }
509
611
 
510
612
  //#endregion
511
613
  //#region src/Sql.ts
512
- /**
513
- * @author Martin Høgh <mh@mapcentia.com>
514
- * @copyright 2013-2026 MapCentia ApS
515
- * @license https://opensource.org/license/mit The MIT License
516
- *
517
- */
518
614
  var Sql = class {
615
+ constructor(client) {
616
+ this.client = client ?? getLegacyClient();
617
+ }
519
618
  async exec(request) {
520
- return await get_response_default(await make_request_default("4", `sql`, "POST", request), 200);
619
+ return this.client.request({
620
+ path: "api/v4/sql",
621
+ method: "POST",
622
+ body: request
623
+ });
521
624
  }
522
625
  };
523
626
 
524
627
  //#endregion
525
628
  //#region src/Rpc.ts
526
- /**
527
- * @author Martin Høgh <mh@mapcentia.com>
528
- * @copyright 2013-2026 MapCentia ApS
529
- * @license https://opensource.org/license/mit The MIT License
530
- *
531
- */
532
629
  var Rpc = class {
630
+ constructor(client) {
631
+ this.client = client ?? getLegacyClient();
632
+ }
533
633
  async call(request) {
534
- return await get_response_default(await make_request_default("4", `call`, "POST", request), 200);
634
+ return this.client.request({
635
+ path: "api/v4/call",
636
+ method: "POST",
637
+ body: request
638
+ });
535
639
  }
536
640
  };
537
641
 
538
642
  //#endregion
539
643
  //#region src/Gql.ts
540
- /**
541
- * @author Martin Høgh <mh@mapcentia.com>
542
- * @copyright 2013-2026 MapCentia ApS
543
- * @license https://opensource.org/license/mit The MIT License
544
- *
545
- */
546
644
  var Gql = class {
547
- constructor(schema) {
645
+ constructor(schema, client) {
548
646
  this.schema = schema;
647
+ this.client = client ?? getLegacyClient();
549
648
  }
550
649
  async request(request) {
551
- return await get_response_default(await make_request_default(null, `graphql/schema/${this.schema}`, "POST", request), 200);
650
+ return this.client.request({
651
+ path: `api/graphql/schema/${this.schema}`,
652
+ method: "POST",
653
+ body: request
654
+ });
552
655
  }
553
656
  };
554
657
 
555
658
  //#endregion
556
659
  //#region src/Meta.ts
557
- /**
558
- * @author Martin Høgh <mh@mapcentia.com>
559
- * @copyright 2013-2026 MapCentia ApS
560
- * @license https://opensource.org/license/mit The MIT License
561
- *
562
- */
563
660
  var Meta = class {
661
+ constructor(client) {
662
+ this.client = client ?? getLegacyClient();
663
+ }
564
664
  async query(rel) {
565
- return await get_response_default(await make_request_default("3", `meta/${rel}`, "GET", null), 200);
665
+ return this.client.request({
666
+ path: `api/v4/meta/${rel}`,
667
+ method: "GET"
668
+ });
566
669
  }
567
670
  };
568
671
 
@@ -601,15 +704,15 @@
601
704
 
602
705
  //#endregion
603
706
  //#region src/Users.ts
604
- /**
605
- * @author Martin Høgh <mh@mapcentia.com>
606
- * @copyright 2013-2026 MapCentia ApS
607
- * @license https://opensource.org/license/mit The MIT License
608
- *
609
- */
610
707
  var Users = class {
708
+ constructor(client) {
709
+ this.client = client ?? getLegacyClient();
710
+ }
611
711
  async get(user) {
612
- return await get_response_default(await make_request_default("4", `users/${user}`, "GET", null), 200);
712
+ return this.client.request({
713
+ path: `api/v4/users/${user}`,
714
+ method: "GET"
715
+ });
613
716
  }
614
717
  };
615
718
 
@@ -657,49 +760,55 @@
657
760
 
658
761
  //#endregion
659
762
  //#region src/Stats.ts
660
- /**
661
- * @author Martin Høgh <mh@mapcentia.com>
662
- * @copyright 2013-2026 MapCentia ApS
663
- * @license https://opensource.org/license/mit The MIT License
664
- *
665
- */
666
763
  var Stats = class {
764
+ constructor(client) {
765
+ this.client = client ?? getLegacyClient();
766
+ }
667
767
  async get() {
668
- return await get_response_default(await make_request_default("4", `stats`, "GET", null), 200);
768
+ return this.client.request({
769
+ path: "api/v4/stats",
770
+ method: "GET"
771
+ });
669
772
  }
670
773
  };
671
774
 
672
775
  //#endregion
673
776
  //#region src/Tables.ts
674
- /**
675
- * @author Martin Høgh <mh@mapcentia.com>
676
- * @copyright 2013-2026 MapCentia ApS
677
- * @license https://opensource.org/license/mit The MIT License
678
- *
679
- */
680
777
  var Tables = class {
778
+ constructor(client) {
779
+ this.client = client ?? getLegacyClient();
780
+ }
681
781
  async get(schema, table) {
682
- return await get_response_default(await make_request_default("4", `schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`, "GET", null), 200);
782
+ return this.client.request({
783
+ path: `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`,
784
+ method: "GET"
785
+ });
683
786
  }
684
787
  async create(schema, table, payload) {
685
- return await get_response_default(await make_request_default("4", `schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`, "POST", payload), 200);
788
+ return this.client.request({
789
+ path: `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`,
790
+ method: "POST",
791
+ body: payload
792
+ });
686
793
  }
687
794
  async patch(schema, table, payload) {
688
- return await get_response_default(await make_request_default("4", `schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`, "PATCH", payload), 200);
795
+ return this.client.request({
796
+ path: `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`,
797
+ method: "PATCH",
798
+ body: payload
799
+ });
689
800
  }
690
801
  async delete(schema, table) {
691
- return await get_response_default(await make_request_default("4", `schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`, "DELETE", null), 204);
802
+ return this.client.request({
803
+ path: `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}`,
804
+ method: "DELETE",
805
+ expectedStatus: 204
806
+ });
692
807
  }
693
808
  };
694
809
 
695
810
  //#endregion
696
811
  //#region src/Api.ts
697
- /**
698
- * @author Martin Høgh <mh@mapcentia.com>
699
- * @copyright 2013-2026 MapCentia ApS
700
- * @license https://opensource.org/license/mit The MIT License
701
- *
702
- */
703
812
  function isPlainObject$1(v) {
704
813
  return typeof v === "object" && v !== null && !Array.isArray(v);
705
814
  }
@@ -721,26 +830,26 @@
721
830
  if (!err || typeof err !== "object") throw new TypeError(`createApi: Invalid RPC error for method "${method}". Expected 'error' to be an object.`);
722
831
  const code = err.code;
723
832
  const message = err.message;
724
- const data$1 = err.data;
833
+ const data = err.data;
725
834
  const codeIsNum = typeof code === "number" && Number.isFinite(code);
726
835
  const details = typeof message === "string" && message.length > 0 ? message : "Unknown error";
727
836
  const e = /* @__PURE__ */ new Error(`createApi: RPC error for method "${method}"${codeIsNum ? ` (${code})` : ""}: ${details}`);
728
837
  e.code = code;
729
- if (data$1 !== void 0) e.data = data$1;
838
+ if (data !== void 0) e.data = data;
730
839
  e.method = method;
731
840
  e.name = "JsonRpcError";
732
841
  throw e;
733
842
  }
734
843
  const result = res.result;
735
844
  if (!result || typeof result !== "object") throw new TypeError(`createApi: Invalid RPC response for method "${method}". Missing result object.`);
736
- const data = result.data;
737
- if (!Array.isArray(data)) throw new TypeError(`createApi: Invalid RPC response for method "${method}". Expected result.data to be an array.`);
738
- return data;
845
+ const dataArr = result.data;
846
+ if (!Array.isArray(dataArr)) throw new TypeError(`createApi: Invalid RPC response for method "${method}". Expected result.data to be an array.`);
847
+ return dataArr;
739
848
  }
740
- async function dispatch(name, paramsLike) {
849
+ async function dispatch(name, paramsLike, client) {
741
850
  if (typeof name !== "string" || name.length === 0) throw new TypeError("createApi: RPC method name must be a non-empty string.");
742
851
  const params = validateParamsForMethod(String(name), paramsLike);
743
- const rpc = new Rpc();
852
+ const rpc = new Rpc(client);
744
853
  const request = {
745
854
  jsonrpc: "2.0",
746
855
  method: name,
@@ -750,11 +859,11 @@
750
859
  const res = await rpc.call(request);
751
860
  return extractDataFromResponse(String(name), res);
752
861
  }
753
- function createApi() {
862
+ function createApi(client) {
754
863
  return new Proxy({}, { get(_target, prop) {
755
864
  if (typeof prop !== "string") return void 0;
756
865
  return (...args) => {
757
- return dispatch(prop, args.length === 0 ? {} : args.length === 1 ? args[0] : args);
866
+ return dispatch(prop, args.length === 0 ? {} : args.length === 1 ? args[0] : args, client);
758
867
  };
759
868
  } });
760
869
  }
@@ -1351,36 +1460,35 @@
1351
1460
  returning: []
1352
1461
  };
1353
1462
  return new class {
1354
- constructor() {
1355
- this.returning = (cols) => {
1356
- state.returning = cols || [];
1357
- return this;
1358
- };
1359
- this.toSql = () => {
1360
- const cols = [];
1361
- const vals = [];
1362
- const params = {};
1363
- const type_hints = {};
1364
- let p = 0;
1365
- for (const key in state.values) {
1366
- const value = state.values[key];
1367
- const col = findColumn(table, key);
1368
- p += 1;
1369
- const paramName = `${table.name}_${key}_${p}`;
1370
- cols.push(`"${key}"`);
1371
- vals.push(`:${paramName}`);
1372
- params[paramName] = value;
1373
- addTypeHintForParam(type_hints, paramName, col, value);
1374
- }
1375
- const parts = [];
1376
- parts.push(`insert into "${schema.name}"."${table.name}" (${cols.join(", ")}) values (${vals.join(", ")})`);
1377
- if (state.returning.length) parts.push("returning " + state.returning.join(", "));
1378
- return {
1379
- q: parts.join(" "),
1380
- params: Object.keys(params).length > 0 ? params : void 0,
1381
- type_hints: Object.keys(type_hints).length ? type_hints : void 0
1382
- };
1463
+ returning(cols) {
1464
+ state.returning = cols || [];
1465
+ return this;
1466
+ }
1467
+ toSql() {
1468
+ const colsArr = [];
1469
+ const vals = [];
1470
+ const params = {};
1471
+ const type_hints = {};
1472
+ let p = 0;
1473
+ for (const key in state.values) {
1474
+ const value = state.values[key];
1475
+ const col = findColumn(table, key);
1476
+ p += 1;
1477
+ const paramName = `${table.name}_${key}_${p}`;
1478
+ colsArr.push(`"${key}"`);
1479
+ vals.push(`:${paramName}`);
1480
+ params[paramName] = value;
1481
+ addTypeHintForParam(type_hints, paramName, col, value);
1482
+ }
1483
+ const parts = [];
1484
+ parts.push(`insert into "${schema.name}"."${table.name}" (${colsArr.join(", ")}) values (${vals.join(", ")})`);
1485
+ if (state.returning.length) parts.push("returning " + state.returning.join(", "));
1486
+ const req = {
1487
+ q: parts.join(" "),
1488
+ params: Object.keys(params).length > 0 ? params : void 0,
1489
+ type_hints: Object.keys(type_hints).length ? type_hints : void 0
1383
1490
  };
1491
+ return state.returning.length ? req : req;
1384
1492
  }
1385
1493
  }();
1386
1494
  }
@@ -1424,55 +1532,56 @@
1424
1532
  }
1425
1533
  return this;
1426
1534
  };
1427
- this.returning = (cols) => {
1428
- state.returning = cols || [];
1429
- return this;
1430
- };
1431
- this.toSql = () => {
1432
- const params = {};
1433
- const type_hints = {};
1434
- let p = 0;
1435
- const setParts = [];
1436
- for (const key in state.values) {
1437
- const value = state.values[key];
1438
- const col = findColumn(table, key);
1439
- p += 1;
1440
- const paramName = `${table.name}_${key}_${p}`;
1441
- setParts.push(`"${key}" = :${paramName}`);
1535
+ }
1536
+ returning(cols) {
1537
+ state.returning = cols || [];
1538
+ return this;
1539
+ }
1540
+ toSql() {
1541
+ const params = {};
1542
+ const type_hints = {};
1543
+ let p = 0;
1544
+ const setParts = [];
1545
+ for (const key in state.values) {
1546
+ const value = state.values[key];
1547
+ const col = findColumn(table, key);
1548
+ p += 1;
1549
+ const paramName = `${table.name}_${key}_${p}`;
1550
+ setParts.push(`"${key}" = :${paramName}`);
1551
+ params[paramName] = value;
1552
+ addTypeHintForParam(type_hints, paramName, col, value);
1553
+ }
1554
+ const whereClauses = [];
1555
+ for (const key in state.where) {
1556
+ const value = state.where[key];
1557
+ const col = findColumn(table, key);
1558
+ p += 1;
1559
+ const paramName = `${table.name}_${key}_${p}`;
1560
+ if (value === null) {
1561
+ if (!col.is_nullable) throw new Error(`Column ${table.name}.${key} is not nullable; cannot compare to null`);
1562
+ whereClauses.push(`"${key}" is null`);
1563
+ } else if (Array.isArray(value) && !isArrayShapedGeomScalarValue(col, value)) {
1564
+ validateInArrayValues(col, key, value, "in");
1565
+ whereClauses.push(`"${key}" = ANY(:${paramName})`);
1566
+ params[paramName] = value;
1567
+ addTypeHintForParam(type_hints, paramName, col, value);
1568
+ } else {
1569
+ validateScalarForColumn(col, value, `column ${key}`);
1570
+ whereClauses.push(`"${key}" = :${paramName}`);
1442
1571
  params[paramName] = value;
1443
1572
  addTypeHintForParam(type_hints, paramName, col, value);
1444
1573
  }
1445
- const whereClauses = [];
1446
- for (const key in state.where) {
1447
- const value = state.where[key];
1448
- const col = findColumn(table, key);
1449
- p += 1;
1450
- const paramName = `${table.name}_${key}_${p}`;
1451
- if (value === null) {
1452
- if (!col.is_nullable) throw new Error(`Column ${table.name}.${key} is not nullable; cannot compare to null`);
1453
- whereClauses.push(`"${key}" is null`);
1454
- } else if (Array.isArray(value) && !isArrayShapedGeomScalarValue(col, value)) {
1455
- validateInArrayValues(col, key, value, "in");
1456
- whereClauses.push(`"${key}" = ANY(:${paramName})`);
1457
- params[paramName] = value;
1458
- addTypeHintForParam(type_hints, paramName, col, value);
1459
- } else {
1460
- validateScalarForColumn(col, value, `column ${key}`);
1461
- whereClauses.push(`"${key}" = :${paramName}`);
1462
- params[paramName] = value;
1463
- addTypeHintForParam(type_hints, paramName, col, value);
1464
- }
1465
- }
1466
- const parts = [];
1467
- parts.push(`update "${schema.name}"."${table.name}" set ${setParts.join(", ")}`);
1468
- if (whereClauses.length) parts.push("where " + whereClauses.join(" and "));
1469
- if (state.returning.length) parts.push("returning " + state.returning.join(", "));
1470
- return {
1471
- q: parts.join(" "),
1472
- params: Object.keys(params).length > 0 ? params : void 0,
1473
- type_hints: Object.keys(type_hints).length ? type_hints : void 0
1474
- };
1574
+ }
1575
+ const parts = [];
1576
+ parts.push(`update "${schema.name}"."${table.name}" set ${setParts.join(", ")}`);
1577
+ if (whereClauses.length) parts.push("where " + whereClauses.join(" and "));
1578
+ if (state.returning.length) parts.push("returning " + state.returning.join(", "));
1579
+ const req = {
1580
+ q: parts.join(" "),
1581
+ params: Object.keys(params).length > 0 ? params : void 0,
1582
+ type_hints: Object.keys(type_hints).length ? type_hints : void 0
1475
1583
  };
1584
+ return state.returning.length ? req : req;
1476
1585
  }
1477
1586
  }();
1478
1587
  }
@@ -1507,45 +1616,46 @@
1507
1616
  }
1508
1617
  return this;
1509
1618
  };
1510
- this.returning = (cols) => {
1511
- state.returning = cols || [];
1512
- return this;
1513
- };
1514
- this.toSql = () => {
1515
- const params = {};
1516
- const type_hints = {};
1517
- let p = 0;
1518
- const whereClauses = [];
1519
- for (const key in state.where) {
1520
- const value = state.where[key];
1521
- const col = findColumn(table, key);
1522
- p += 1;
1523
- const paramName = `${table.name}_${key}_${p}`;
1524
- if (value === null) {
1525
- if (!col.is_nullable) throw new Error(`Column ${table.name}.${key} is not nullable; cannot compare to null`);
1526
- whereClauses.push(`"${key}" is null`);
1527
- } else if (Array.isArray(value)) {
1528
- validateInArrayValues(col, key, value, "in");
1529
- whereClauses.push(`"${key}" = ANY(:${paramName})`);
1530
- params[paramName] = value;
1531
- addTypeHintForParam(type_hints, paramName, col, value);
1532
- } else {
1533
- validateScalarForColumn(col, value, `column ${key}`);
1534
- whereClauses.push(`"${key}" = :${paramName}`);
1535
- params[paramName] = value;
1536
- addTypeHintForParam(type_hints, paramName, col, value);
1537
- }
1619
+ }
1620
+ returning(cols) {
1621
+ state.returning = cols || [];
1622
+ return this;
1623
+ }
1624
+ toSql() {
1625
+ const params = {};
1626
+ const type_hints = {};
1627
+ let p = 0;
1628
+ const whereClauses = [];
1629
+ for (const key in state.where) {
1630
+ const value = state.where[key];
1631
+ const col = findColumn(table, key);
1632
+ p += 1;
1633
+ const paramName = `${table.name}_${key}_${p}`;
1634
+ if (value === null) {
1635
+ if (!col.is_nullable) throw new Error(`Column ${table.name}.${key} is not nullable; cannot compare to null`);
1636
+ whereClauses.push(`"${key}" is null`);
1637
+ } else if (Array.isArray(value)) {
1638
+ validateInArrayValues(col, key, value, "in");
1639
+ whereClauses.push(`"${key}" = ANY(:${paramName})`);
1640
+ params[paramName] = value;
1641
+ addTypeHintForParam(type_hints, paramName, col, value);
1642
+ } else {
1643
+ validateScalarForColumn(col, value, `column ${key}`);
1644
+ whereClauses.push(`"${key}" = :${paramName}`);
1645
+ params[paramName] = value;
1646
+ addTypeHintForParam(type_hints, paramName, col, value);
1538
1647
  }
1539
- const parts = [];
1540
- parts.push(`delete from "${schema.name}"."${table.name}"`);
1541
- if (whereClauses.length) parts.push("where " + whereClauses.join(" and "));
1542
- if (state.returning.length) parts.push("returning " + state.returning.join(", "));
1543
- return {
1544
- q: parts.join(" "),
1545
- params: Object.keys(params).length > 0 ? params : void 0,
1546
- type_hints: Object.keys(type_hints).length ? type_hints : void 0
1547
- };
1648
+ }
1649
+ const parts = [];
1650
+ parts.push(`delete from "${schema.name}"."${table.name}"`);
1651
+ if (whereClauses.length) parts.push("where " + whereClauses.join(" and "));
1652
+ if (state.returning.length) parts.push("returning " + state.returning.join(", "));
1653
+ const req = {
1654
+ q: parts.join(" "),
1655
+ params: Object.keys(params).length > 0 ? params : void 0,
1656
+ type_hints: Object.keys(type_hints).length ? type_hints : void 0
1548
1657
  };
1658
+ return state.returning.length ? req : req;
1549
1659
  }
1550
1660
  }();
1551
1661
  }
@@ -1554,6 +1664,552 @@
1554
1664
  return { table: (name) => new TableQueryImpl(schema, String(name)) };
1555
1665
  }
1556
1666
 
1667
+ //#endregion
1668
+ //#region src/provisioning/Schemas.ts
1669
+ var Schemas = class {
1670
+ constructor(client) {
1671
+ this.client = client;
1672
+ }
1673
+ async getSchema(schema, opts) {
1674
+ const path = schema ? `api/v4/schemas/${encodeURIComponent(schema)}` : "api/v4/schemas";
1675
+ const query = {};
1676
+ if (opts?.namesOnly) query.namesOnly = "true";
1677
+ return this.client.request({
1678
+ path,
1679
+ method: "GET",
1680
+ query: Object.keys(query).length > 0 ? query : void 0
1681
+ });
1682
+ }
1683
+ async postSchema(body) {
1684
+ return { location: (await this.client.requestFull({
1685
+ path: "api/v4/schemas",
1686
+ method: "POST",
1687
+ body,
1688
+ expectedStatus: 201
1689
+ })).getHeader("Location") ?? "" };
1690
+ }
1691
+ async patchSchema(schema, body) {
1692
+ return { location: (await this.client.requestFull({
1693
+ path: `api/v4/schemas/${encodeURIComponent(schema)}`,
1694
+ method: "PATCH",
1695
+ body,
1696
+ expectedStatus: 303
1697
+ })).getHeader("Location") ?? "" };
1698
+ }
1699
+ async deleteSchema(schema) {
1700
+ await this.client.request({
1701
+ path: `api/v4/schemas/${encodeURIComponent(schema)}`,
1702
+ method: "DELETE",
1703
+ expectedStatus: 204
1704
+ });
1705
+ }
1706
+ };
1707
+
1708
+ //#endregion
1709
+ //#region src/provisioning/Columns.ts
1710
+ var Columns = class {
1711
+ constructor(client) {
1712
+ this.client = client;
1713
+ }
1714
+ basePath(schema, table) {
1715
+ return `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}/columns`;
1716
+ }
1717
+ async getColumn(schema, table, column) {
1718
+ const path = column ? `${this.basePath(schema, table)}/${encodeURIComponent(column)}` : this.basePath(schema, table);
1719
+ return this.client.request({
1720
+ path,
1721
+ method: "GET"
1722
+ });
1723
+ }
1724
+ async postColumn(schema, table, body) {
1725
+ return { location: (await this.client.requestFull({
1726
+ path: this.basePath(schema, table),
1727
+ method: "POST",
1728
+ body,
1729
+ expectedStatus: 201
1730
+ })).getHeader("Location") ?? "" };
1731
+ }
1732
+ async patchColumn(schema, table, column, body) {
1733
+ return { location: (await this.client.requestFull({
1734
+ path: `${this.basePath(schema, table)}/${encodeURIComponent(column)}`,
1735
+ method: "PATCH",
1736
+ body,
1737
+ expectedStatus: 303
1738
+ })).getHeader("Location") ?? "" };
1739
+ }
1740
+ async deleteColumn(schema, table, column) {
1741
+ await this.client.request({
1742
+ path: `${this.basePath(schema, table)}/${encodeURIComponent(column)}`,
1743
+ method: "DELETE",
1744
+ expectedStatus: 204
1745
+ });
1746
+ }
1747
+ };
1748
+
1749
+ //#endregion
1750
+ //#region src/provisioning/Constraints.ts
1751
+ var Constraints = class {
1752
+ constructor(client) {
1753
+ this.client = client;
1754
+ }
1755
+ basePath(schema, table) {
1756
+ return `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}/constraints`;
1757
+ }
1758
+ async getConstraint(schema, table, constraint) {
1759
+ const path = constraint ? `${this.basePath(schema, table)}/${encodeURIComponent(constraint)}` : this.basePath(schema, table);
1760
+ return this.client.request({
1761
+ path,
1762
+ method: "GET"
1763
+ });
1764
+ }
1765
+ async postConstraint(schema, table, body) {
1766
+ return { location: (await this.client.requestFull({
1767
+ path: this.basePath(schema, table),
1768
+ method: "POST",
1769
+ body,
1770
+ expectedStatus: 201
1771
+ })).getHeader("Location") ?? "" };
1772
+ }
1773
+ async deleteConstraint(schema, table, constraint) {
1774
+ await this.client.request({
1775
+ path: `${this.basePath(schema, table)}/${encodeURIComponent(constraint)}`,
1776
+ method: "DELETE",
1777
+ expectedStatus: 204
1778
+ });
1779
+ }
1780
+ };
1781
+
1782
+ //#endregion
1783
+ //#region src/provisioning/Indices.ts
1784
+ var Indices = class {
1785
+ constructor(client) {
1786
+ this.client = client;
1787
+ }
1788
+ basePath(schema, table) {
1789
+ return `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}/indices`;
1790
+ }
1791
+ async getIndex(schema, table, index) {
1792
+ const path = index ? `${this.basePath(schema, table)}/${encodeURIComponent(index)}` : this.basePath(schema, table);
1793
+ return this.client.request({
1794
+ path,
1795
+ method: "GET"
1796
+ });
1797
+ }
1798
+ async postIndex(schema, table, body) {
1799
+ return { location: (await this.client.requestFull({
1800
+ path: this.basePath(schema, table),
1801
+ method: "POST",
1802
+ body,
1803
+ expectedStatus: 201
1804
+ })).getHeader("Location") ?? "" };
1805
+ }
1806
+ async deleteIndex(schema, table, index) {
1807
+ await this.client.request({
1808
+ path: `${this.basePath(schema, table)}/${encodeURIComponent(index)}`,
1809
+ method: "DELETE",
1810
+ expectedStatus: 204
1811
+ });
1812
+ }
1813
+ };
1814
+
1815
+ //#endregion
1816
+ //#region src/provisioning/Sequences.ts
1817
+ var Sequences = class {
1818
+ constructor(client) {
1819
+ this.client = client;
1820
+ }
1821
+ basePath(schema) {
1822
+ return `api/v4/schemas/${encodeURIComponent(schema)}/sequences`;
1823
+ }
1824
+ async getSequence(schema, sequence) {
1825
+ const path = sequence ? `${this.basePath(schema)}/${encodeURIComponent(sequence)}` : this.basePath(schema);
1826
+ return this.client.request({
1827
+ path,
1828
+ method: "GET"
1829
+ });
1830
+ }
1831
+ async postSequence(schema, body) {
1832
+ return { location: (await this.client.requestFull({
1833
+ path: this.basePath(schema),
1834
+ method: "POST",
1835
+ body,
1836
+ expectedStatus: 201
1837
+ })).getHeader("Location") ?? "" };
1838
+ }
1839
+ async patchSequence(schema, sequence, body) {
1840
+ return { location: (await this.client.requestFull({
1841
+ path: `${this.basePath(schema)}/${encodeURIComponent(sequence)}`,
1842
+ method: "PATCH",
1843
+ body,
1844
+ expectedStatus: 303
1845
+ })).getHeader("Location") ?? "" };
1846
+ }
1847
+ async deleteSequence(schema, sequence) {
1848
+ await this.client.request({
1849
+ path: `${this.basePath(schema)}/${encodeURIComponent(sequence)}`,
1850
+ method: "DELETE",
1851
+ expectedStatus: 204
1852
+ });
1853
+ }
1854
+ };
1855
+
1856
+ //#endregion
1857
+ //#region src/provisioning/Tables.ts
1858
+ var ProvisioningTables = class {
1859
+ constructor(client) {
1860
+ this.client = client;
1861
+ }
1862
+ basePath(schema) {
1863
+ return `api/v4/schemas/${encodeURIComponent(schema)}/tables`;
1864
+ }
1865
+ async getTable(schema, table) {
1866
+ const path = table ? `${this.basePath(schema)}/${encodeURIComponent(table)}` : this.basePath(schema);
1867
+ return this.client.request({
1868
+ path,
1869
+ method: "GET"
1870
+ });
1871
+ }
1872
+ async postTable(schema, body) {
1873
+ return { location: (await this.client.requestFull({
1874
+ path: this.basePath(schema),
1875
+ method: "POST",
1876
+ body,
1877
+ expectedStatus: 201
1878
+ })).getHeader("Location") ?? "" };
1879
+ }
1880
+ async patchTable(schema, table, body) {
1881
+ return { location: (await this.client.requestFull({
1882
+ path: `${this.basePath(schema)}/${encodeURIComponent(table)}`,
1883
+ method: "PATCH",
1884
+ body,
1885
+ expectedStatus: 303
1886
+ })).getHeader("Location") ?? "" };
1887
+ }
1888
+ async deleteTable(schema, table) {
1889
+ await this.client.request({
1890
+ path: `${this.basePath(schema)}/${encodeURIComponent(table)}`,
1891
+ method: "DELETE",
1892
+ expectedStatus: 204
1893
+ });
1894
+ }
1895
+ };
1896
+
1897
+ //#endregion
1898
+ //#region src/provisioning/Users.ts
1899
+ var ProvisioningUsers = class {
1900
+ constructor(client) {
1901
+ this.client = client;
1902
+ }
1903
+ async getUser(name) {
1904
+ const path = name ? `api/v4/users/${encodeURIComponent(name)}` : "api/v4/users";
1905
+ return this.client.request({
1906
+ path,
1907
+ method: "GET"
1908
+ });
1909
+ }
1910
+ async postUser(body) {
1911
+ return { location: (await this.client.requestFull({
1912
+ path: "api/v4/users",
1913
+ method: "POST",
1914
+ body,
1915
+ expectedStatus: 201
1916
+ })).getHeader("Location") ?? "" };
1917
+ }
1918
+ async patchUser(name, body) {
1919
+ return { location: (await this.client.requestFull({
1920
+ path: `api/v4/users/${encodeURIComponent(name)}`,
1921
+ method: "PATCH",
1922
+ body,
1923
+ expectedStatus: 303
1924
+ })).getHeader("Location") ?? "" };
1925
+ }
1926
+ async deleteUser(name) {
1927
+ await this.client.request({
1928
+ path: `api/v4/users/${encodeURIComponent(name)}`,
1929
+ method: "DELETE",
1930
+ expectedStatus: 204
1931
+ });
1932
+ }
1933
+ };
1934
+
1935
+ //#endregion
1936
+ //#region src/provisioning/Clients.ts
1937
+ var ProvisioningClients = class {
1938
+ constructor(client) {
1939
+ this.client = client;
1940
+ }
1941
+ async getClient(id) {
1942
+ const path = id ? `api/v4/clients/${encodeURIComponent(id)}` : "api/v4/clients";
1943
+ return this.client.request({
1944
+ path,
1945
+ method: "GET"
1946
+ });
1947
+ }
1948
+ async postClient(body) {
1949
+ const res = await this.client.requestFull({
1950
+ path: "api/v4/clients",
1951
+ method: "POST",
1952
+ body,
1953
+ expectedStatus: 201
1954
+ });
1955
+ return {
1956
+ location: res.getHeader("Location") ?? "",
1957
+ secret: res.body.secret
1958
+ };
1959
+ }
1960
+ async patchClient(id, body) {
1961
+ return { location: (await this.client.requestFull({
1962
+ path: `api/v4/clients/${encodeURIComponent(id)}`,
1963
+ method: "PATCH",
1964
+ body,
1965
+ expectedStatus: 303
1966
+ })).getHeader("Location") ?? "" };
1967
+ }
1968
+ async deleteClient(id) {
1969
+ await this.client.request({
1970
+ path: `api/v4/clients/${encodeURIComponent(id)}`,
1971
+ method: "DELETE",
1972
+ expectedStatus: 204
1973
+ });
1974
+ }
1975
+ };
1976
+
1977
+ //#endregion
1978
+ //#region src/provisioning/Rules.ts
1979
+ var Rules = class {
1980
+ constructor(client) {
1981
+ this.client = client;
1982
+ }
1983
+ async getRule(id) {
1984
+ const path = id != null ? `api/v4/rules/${encodeURIComponent(id)}` : "api/v4/rules";
1985
+ return this.client.request({
1986
+ path,
1987
+ method: "GET"
1988
+ });
1989
+ }
1990
+ async postRule(body) {
1991
+ return this.client.request({
1992
+ path: "api/v4/rules",
1993
+ method: "POST",
1994
+ body,
1995
+ expectedStatus: 201
1996
+ });
1997
+ }
1998
+ async patchRule(id, body) {
1999
+ return this.client.request({
2000
+ path: `api/v4/rules/${encodeURIComponent(id)}`,
2001
+ method: "PATCH",
2002
+ body
2003
+ });
2004
+ }
2005
+ async deleteRule(id) {
2006
+ await this.client.request({
2007
+ path: `api/v4/rules/${encodeURIComponent(id)}`,
2008
+ method: "DELETE",
2009
+ expectedStatus: 204
2010
+ });
2011
+ }
2012
+ };
2013
+
2014
+ //#endregion
2015
+ //#region src/provisioning/Privileges.ts
2016
+ var Privileges = class {
2017
+ constructor(client) {
2018
+ this.client = client;
2019
+ }
2020
+ async getPrivileges(schema, table) {
2021
+ return this.client.request({
2022
+ path: `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}/privileges`,
2023
+ method: "GET"
2024
+ });
2025
+ }
2026
+ async patchPrivileges(schema, table, body) {
2027
+ return this.client.request({
2028
+ path: `api/v4/schemas/${encodeURIComponent(schema)}/tables/${encodeURIComponent(table)}/privileges`,
2029
+ method: "PATCH",
2030
+ body
2031
+ });
2032
+ }
2033
+ };
2034
+
2035
+ //#endregion
2036
+ //#region src/provisioning/RpcMethods.ts
2037
+ var RpcMethods = class {
2038
+ constructor(client) {
2039
+ this.client = client;
2040
+ }
2041
+ async getRpc(method) {
2042
+ const path = method ? `api/v4/methods/${encodeURIComponent(method)}` : "api/v4/methods";
2043
+ return this.client.request({
2044
+ path,
2045
+ method: "GET"
2046
+ });
2047
+ }
2048
+ async postRpc(body) {
2049
+ return { location: (await this.client.requestFull({
2050
+ path: "api/v4/methods",
2051
+ method: "POST",
2052
+ body,
2053
+ expectedStatus: 201
2054
+ })).getHeader("Location") ?? "" };
2055
+ }
2056
+ async patchRpc(method, body) {
2057
+ return { location: (await this.client.requestFull({
2058
+ path: `api/v4/methods/${encodeURIComponent(method)}`,
2059
+ method: "PATCH",
2060
+ body,
2061
+ expectedStatus: 303
2062
+ })).getHeader("Location") ?? "" };
2063
+ }
2064
+ async deleteRpc(method) {
2065
+ await this.client.request({
2066
+ path: `api/v4/methods/${encodeURIComponent(method)}`,
2067
+ method: "DELETE",
2068
+ expectedStatus: 204
2069
+ });
2070
+ }
2071
+ async postCallDry(body) {
2072
+ return this.client.request({
2073
+ path: "api/v4/call/dry",
2074
+ method: "POST",
2075
+ body
2076
+ });
2077
+ }
2078
+ };
2079
+
2080
+ //#endregion
2081
+ //#region src/provisioning/MetadataWrite.ts
2082
+ var MetadataWrite = class {
2083
+ constructor(client) {
2084
+ this.client = client;
2085
+ }
2086
+ async patchMetaData(body) {
2087
+ return this.client.request({
2088
+ path: "api/v4/meta",
2089
+ method: "PATCH",
2090
+ body
2091
+ });
2092
+ }
2093
+ };
2094
+
2095
+ //#endregion
2096
+ //#region src/provisioning/TypeScriptInterfaces.ts
2097
+ var TypeScriptInterfaces = class {
2098
+ constructor(client) {
2099
+ this.client = client;
2100
+ }
2101
+ async getTypeScript() {
2102
+ return this.client.request({
2103
+ path: "api/v4/interfaces",
2104
+ method: "GET",
2105
+ accept: "text/plain"
2106
+ });
2107
+ }
2108
+ };
2109
+
2110
+ //#endregion
2111
+ //#region src/provisioning/FileImport.ts
2112
+ var FileImport = class {
2113
+ constructor(client) {
2114
+ this.client = client;
2115
+ }
2116
+ /**
2117
+ * Upload a file via multipart/form-data.
2118
+ * In Node.js, pass a FormData instance. In browsers, pass a native FormData.
2119
+ */
2120
+ async postFileUpload(formData) {
2121
+ return this.client.request({
2122
+ path: "api/v4/file/upload",
2123
+ method: "POST",
2124
+ body: formData,
2125
+ contentType: null,
2126
+ expectedStatus: 201
2127
+ });
2128
+ }
2129
+ async postFileProcess(body) {
2130
+ return this.client.request({
2131
+ path: "api/v4/file/process",
2132
+ method: "POST",
2133
+ body,
2134
+ expectedStatus: 201
2135
+ });
2136
+ }
2137
+ };
2138
+
2139
+ //#endregion
2140
+ //#region src/provisioning/GitCommit.ts
2141
+ var GitCommit = class {
2142
+ constructor(client) {
2143
+ this.client = client;
2144
+ }
2145
+ async postCommit(body) {
2146
+ return this.client.request({
2147
+ path: "api/v4/commit",
2148
+ method: "POST",
2149
+ body
2150
+ });
2151
+ }
2152
+ };
2153
+
2154
+ //#endregion
2155
+ //#region src/provisioning/SqlNoToken.ts
2156
+ var SqlNoToken = class {
2157
+ constructor(client) {
2158
+ this.client = client;
2159
+ }
2160
+ async postSqlNoToken(database, body) {
2161
+ return this.client.request({
2162
+ path: `api/v4/sql/database/${encodeURIComponent(database)}`,
2163
+ method: "POST",
2164
+ body
2165
+ });
2166
+ }
2167
+ };
2168
+
2169
+ //#endregion
2170
+ //#region src/admin.ts
2171
+ /**
2172
+ * @author Martin Høgh <mh@mapcentia.com>
2173
+ * @copyright 2013-2026 MapCentia ApS
2174
+ * @license https://opensource.org/license/mit The MIT License
2175
+ */
2176
+ /**
2177
+ * Create a Centia admin client with access to provisioning operations.
2178
+ *
2179
+ * ```ts
2180
+ * const client = createCentiaAdminClient({
2181
+ * baseUrl: 'https://example.centia.io',
2182
+ * auth: { getAccessToken: async () => token },
2183
+ * });
2184
+ *
2185
+ * await client.provisioning.schemas.postSchema({ name: 'myschema' });
2186
+ * ```
2187
+ */
2188
+ function createCentiaAdminClient(config) {
2189
+ const http = new CentiaHttpClient(config);
2190
+ return {
2191
+ http,
2192
+ provisioning: {
2193
+ schemas: new Schemas(http),
2194
+ tables: new ProvisioningTables(http),
2195
+ columns: new Columns(http),
2196
+ constraints: new Constraints(http),
2197
+ indices: new Indices(http),
2198
+ sequences: new Sequences(http),
2199
+ users: new ProvisioningUsers(http),
2200
+ clients: new ProvisioningClients(http),
2201
+ rules: new Rules(http),
2202
+ privileges: new Privileges(http),
2203
+ rpcMethods: new RpcMethods(http),
2204
+ metadata: new MetadataWrite(http),
2205
+ typeScript: new TypeScriptInterfaces(http),
2206
+ fileImport: new FileImport(http),
2207
+ gitCommit: new GitCommit(http),
2208
+ sqlNoToken: new SqlNoToken(http)
2209
+ }
2210
+ };
2211
+ }
2212
+
1557
2213
  //#endregion
1558
2214
  //#region src/index.ts
1559
2215
  /**
@@ -1564,6 +2220,7 @@
1564
2220
  */
1565
2221
 
1566
2222
  //#endregion
2223
+ exports.CentiaApiError = CentiaApiError;
1567
2224
  exports.Claims = Claims;
1568
2225
  exports.CodeFlow = CodeFlow;
1569
2226
  exports.Gql = Gql;
@@ -1578,5 +2235,8 @@ exports.Tables = Tables;
1578
2235
  exports.Users = Users;
1579
2236
  exports.Ws = Ws;
1580
2237
  exports.createApi = createApi;
2238
+ exports.createCentiaAdminClient = createCentiaAdminClient;
2239
+ exports.createCentiaClient = createCentiaClient;
1581
2240
  exports.createSqlBuilder = createSqlBuilder;
2241
+ exports.isCentiaApiError = isCentiaApiError;
1582
2242
  });