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