@centia-io/sdk 0.0.44 → 0.0.45

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