@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.
@@ -96,6 +96,107 @@ declare class PasswordFlow {
96
96
  signOut(): void;
97
97
  clear(): void;
98
98
  }
99
+ //#endregion
100
+ //#region src/http/types.d.ts
101
+ /**
102
+ * @author Martin Høgh <mh@mapcentia.com>
103
+ * @copyright 2013-2026 MapCentia ApS
104
+ * @license https://opensource.org/license/mit The MIT License
105
+ */
106
+ /** Auth injection callbacks for the HTTP client. */
107
+ interface CentiaAuth {
108
+ /** Returns a Bearer token. Called before each request. */
109
+ getAccessToken?: () => Promise<string | undefined>;
110
+ /**
111
+ * Returns additional headers. Merged after getAccessToken,
112
+ * so it can override Authorization if needed.
113
+ */
114
+ getHeaders?: () => Promise<Record<string, string>>;
115
+ }
116
+ /** Configuration for createCentiaClient(). */
117
+ interface CentiaClientConfig {
118
+ /** Base URL of the Centia API (e.g. "https://example.centia.io"). */
119
+ baseUrl: string;
120
+ /** Auth injection. If omitted, requests are unauthenticated. */
121
+ auth?: CentiaAuth;
122
+ /** Custom fetch implementation. Defaults to globalThis.fetch. */
123
+ fetch?: typeof globalThis.fetch;
124
+ /** User-Agent header (ignored in browsers). */
125
+ userAgent?: string;
126
+ }
127
+ /** Options for a single HTTP request via CentiaHttpClient. */
128
+ interface RequestOptions {
129
+ /** URL path relative to baseUrl (e.g. "api/v4/sql"). Leading slash is stripped. */
130
+ path: string;
131
+ /** HTTP method. */
132
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
133
+ /** Request body. Serialized as JSON unless contentType overrides. */
134
+ body?: unknown;
135
+ /** Query parameters appended to the URL. */
136
+ query?: Record<string, string>;
137
+ /** Content-Type header. Defaults to "application/json". Set to null to omit. */
138
+ contentType?: string | null;
139
+ /** Accept header. Defaults to "application/json". */
140
+ accept?: string;
141
+ /** Expected HTTP status code. Defaults to 200. Non-match throws CentiaApiError. */
142
+ expectedStatus?: number;
143
+ }
144
+ /** Full HTTP response with metadata, returned by CentiaHttpClient.requestFull(). */
145
+ interface FullResponse<T> {
146
+ /** Parsed response body (null for empty responses like 204). */
147
+ body: T;
148
+ /** HTTP status code. */
149
+ status: number;
150
+ /** Get a response header value by name. */
151
+ getHeader(name: string): string | null;
152
+ }
153
+ //#endregion
154
+ //#region src/http/client.d.ts
155
+ /**
156
+ * Unified HTTP client for the Centia API.
157
+ * Works in both Node.js and browser environments.
158
+ */
159
+ declare class CentiaHttpClient {
160
+ private readonly baseUrl;
161
+ private readonly auth;
162
+ private readonly fetchFn;
163
+ private readonly userAgent;
164
+ constructor(config: CentiaClientConfig);
165
+ /**
166
+ * Execute an HTTP request against the Centia API.
167
+ * Returns parsed JSON on success. Throws CentiaApiError on non-expected status.
168
+ */
169
+ request<T = unknown>(opts: RequestOptions): Promise<T>;
170
+ /**
171
+ * Execute an HTTP request and return the full response including headers.
172
+ * Useful for operations that return Location headers (POST 201, PATCH 303).
173
+ */
174
+ requestFull<T = unknown>(opts: RequestOptions): Promise<FullResponse<T>>;
175
+ private buildUrl;
176
+ private buildHeaders;
177
+ private resolveContentType;
178
+ private handleResponse;
179
+ }
180
+ /**
181
+ * Create a new Centia HTTP client.
182
+ *
183
+ * Node.js usage:
184
+ * ```ts
185
+ * const client = createCentiaClient({
186
+ * baseUrl: 'https://example.centia.io',
187
+ * auth: { getAccessToken: async () => process.env.CENTIA_TOKEN },
188
+ * });
189
+ * ```
190
+ *
191
+ * Browser usage:
192
+ * ```ts
193
+ * const client = createCentiaClient({
194
+ * baseUrl: 'https://example.centia.io',
195
+ * auth: { getAccessToken: async () => getStoredToken() },
196
+ * });
197
+ * ```
198
+ */
199
+ declare function createCentiaClient(config: CentiaClientConfig): CentiaHttpClient;
99
200
  declare namespace pgTypes_d_exports {
100
201
  export { BPChar, Box, Char, Circle, ColumnSchemaMeta, DataRow, DateRange, DateString, DecimalString, GqlRequest, GqlResponse, Int4Range, Int8Range, IntervalValue, JsonArray, JsonObject, JsonPrimitive, JsonValue, Line, Lseg, NumRange, NumericString, Path, PgArray, PgBoolean, Point, Polygon, Range, RowValue, RpcRequest, RpcResponse, SqlRequest, SqlResponse, Text, TimeString, TimestampString, TimestamptzString, TimetzString, TsRange, TstzRange, TypedSqlRequest, Varchar };
101
202
  }
@@ -215,30 +316,31 @@ interface RpcResponse<Row extends DataRow = DataRow> {
215
316
  //#endregion
216
317
  //#region src/Sql.d.ts
217
318
  declare class Sql {
319
+ private client;
320
+ constructor(client?: CentiaHttpClient);
218
321
  exec<R$1 extends DataRow>(request: TypedSqlRequest<R$1>): Promise<SqlResponse<R$1>>;
219
322
  exec(request: SqlRequest): Promise<SqlResponse<DataRow>>;
220
323
  }
221
324
  //#endregion
222
325
  //#region src/Rpc.d.ts
223
326
  declare class Rpc {
327
+ private client;
328
+ constructor(client?: CentiaHttpClient);
224
329
  call(request: RpcRequest): Promise<RpcResponse>;
225
330
  }
226
331
  //#endregion
227
332
  //#region src/Gql.d.ts
228
333
  declare class Gql {
229
334
  private schema;
230
- constructor(schema: string);
335
+ private client;
336
+ constructor(schema: string, client?: CentiaHttpClient);
231
337
  request(request: GqlRequest): Promise<GqlResponse>;
232
338
  }
233
339
  //#endregion
234
340
  //#region src/Meta.d.ts
235
- /**
236
- * @author Martin Høgh <mh@mapcentia.com>
237
- * @copyright 2013-2026 MapCentia ApS
238
- * @license https://opensource.org/license/mit The MIT License
239
- *
240
- */
241
341
  declare class Meta {
342
+ private client;
343
+ constructor(client?: CentiaHttpClient);
242
344
  query(rel: string): Promise<any>;
243
345
  }
244
346
  //#endregion
@@ -266,13 +368,9 @@ declare class Claims {
266
368
  }
267
369
  //#endregion
268
370
  //#region src/Users.d.ts
269
- /**
270
- * @author Martin Høgh <mh@mapcentia.com>
271
- * @copyright 2013-2026 MapCentia ApS
272
- * @license https://opensource.org/license/mit The MIT License
273
- *
274
- */
275
371
  declare class Users {
372
+ private client;
373
+ constructor(client?: CentiaHttpClient);
276
374
  get(user: string): Promise<any>;
277
375
  }
278
376
  //#endregion
@@ -284,24 +382,16 @@ declare class Ws {
284
382
  }
285
383
  //#endregion
286
384
  //#region src/Stats.d.ts
287
- /**
288
- * @author Martin Høgh <mh@mapcentia.com>
289
- * @copyright 2013-2026 MapCentia ApS
290
- * @license https://opensource.org/license/mit The MIT License
291
- *
292
- */
293
385
  declare class Stats {
386
+ private client;
387
+ constructor(client?: CentiaHttpClient);
294
388
  get(): Promise<any>;
295
389
  }
296
390
  //#endregion
297
391
  //#region src/Tables.d.ts
298
- /**
299
- * @author Martin Høgh <mh@mapcentia.com>
300
- * @copyright 2013-2026 MapCentia ApS
301
- * @license https://opensource.org/license/mit The MIT License
302
- *
303
- */
304
392
  declare class Tables {
393
+ private client;
394
+ constructor(client?: CentiaHttpClient);
305
395
  get(schema: string, table: string): Promise<any>;
306
396
  create(schema: string, table: string, payload: any): Promise<any>;
307
397
  patch(schema: string, table: string, payload: any): Promise<any>;
@@ -309,19 +399,13 @@ declare class Tables {
309
399
  }
310
400
  //#endregion
311
401
  //#region src/Api.d.ts
312
- /**
313
- * @author Martin Høgh <mh@mapcentia.com>
314
- * @copyright 2013-2026 MapCentia ApS
315
- * @license https://opensource.org/license/mit The MIT License
316
- *
317
- */
318
402
  type MethodsOf<T> = { [K in keyof T]: T[K] extends ((...args: infer A) => infer R) ? (...args: A) => R : never };
319
403
  type RowOfApiCall<F> = F extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E : R : never;
320
404
  type RowsOfApiCall<F> = F extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E[] : R[] : never;
321
405
  type RowOfApiMethod<A$1, K$1 extends keyof A$1> = A$1[K$1] extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E : R : never;
322
406
  type RowsOfApiMethod<A$1, K$1 extends keyof A$1> = A$1[K$1] extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E[] : R[] : never;
323
407
  type ParamsOfApiMethod<A$1, K$1 extends keyof A$1> = A$1[K$1] extends ((...args: infer P) => any) ? P[0] : never;
324
- declare function createApi<T>(): MethodsOf<T>;
408
+ declare function createApi<T>(client?: CentiaHttpClient): MethodsOf<T>;
325
409
  //#endregion
326
410
  //#region src/SignUp.d.ts
327
411
  declare class SignUp {
@@ -340,7 +424,7 @@ interface ColumnDef {
340
424
  type?: string;
341
425
  [key: string]: any;
342
426
  }
343
- interface ConstraintDef {
427
+ interface ConstraintDef$1 {
344
428
  name: string;
345
429
  constraint: "primary" | "foreign" | string;
346
430
  columns?: readonly string[];
@@ -351,7 +435,7 @@ interface ConstraintDef {
351
435
  interface TableDef {
352
436
  name: string;
353
437
  columns: readonly ColumnDef[];
354
- constraints?: readonly ConstraintDef[];
438
+ constraints?: readonly ConstraintDef$1[];
355
439
  [key: string]: any;
356
440
  }
357
441
  interface DBSchema {
@@ -398,7 +482,9 @@ interface SqlBuilder<S extends DBSchema> {
398
482
  }
399
483
  type RowForTable<S extends DBSchema, TN extends string> = { [K in ColumnNames<S, TN>]: ColumnValueFor<S, TN, K> };
400
484
  type PickRow<S extends DBSchema, TN extends string, C$1 extends ReadonlyArray<ColumnNames<S, TN>>> = { [K in C$1[number]]: ColumnValueFor<S, TN, K> };
401
- type RowOfSelect<Q> = Q extends SelectQuery<any, any, infer R> ? R : never;
485
+ type RowOfSelect<Q> = Q extends {
486
+ toSql: () => TypedSqlRequest<infer R>;
487
+ } ? R : never;
402
488
  type RowsOfSelect<Q> = RowOfSelect<Q>[];
403
489
  type RowOfRequest<Rq> = Rq extends TypedSqlRequest<infer R> ? R : never;
404
490
  type RowsOfRequest<Rq> = RowOfRequest<Rq>[];
@@ -426,24 +512,633 @@ interface SelectQuery<S extends DBSchema, TN extends string, R$1 extends DataRow
426
512
  join: <JT extends TableNames<S>>(table: JT, type?: "inner" | "left" | "right" | "full") => SelectQuery<S, TN, R$1>;
427
513
  toSql: () => TypedSqlRequest<R$1>;
428
514
  }
515
+ interface InsertReturningQuery<S extends DBSchema, TN extends string, R$1 extends DataRow> {
516
+ returning(): InsertReturningQuery<S, TN, RowForTable<S, TN>>;
517
+ returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): InsertReturningQuery<S, TN, PickRow<S, TN, C$1>>;
518
+ toSql(): TypedSqlRequest<R$1>;
519
+ }
520
+ interface UpdateReturningQuery<S extends DBSchema, TN extends string, R$1 extends DataRow> {
521
+ where: (where: WhereForTable<S, TN>) => UpdateReturningQuery<S, TN, R$1>;
522
+ wherePk: (pk: PrimaryKeyValue<S, TN>) => UpdateReturningQuery<S, TN, R$1>;
523
+ returning(): UpdateReturningQuery<S, TN, RowForTable<S, TN>>;
524
+ returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): UpdateReturningQuery<S, TN, PickRow<S, TN, C$1>>;
525
+ toSql(): TypedSqlRequest<R$1>;
526
+ }
527
+ interface DeleteReturningQuery<S extends DBSchema, TN extends string, R$1 extends DataRow> {
528
+ where: (where: WhereForTable<S, TN>) => DeleteReturningQuery<S, TN, R$1>;
529
+ wherePk: (pk: PrimaryKeyValue<S, TN>) => DeleteReturningQuery<S, TN, R$1>;
530
+ returning(): DeleteReturningQuery<S, TN, RowForTable<S, TN>>;
531
+ returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): DeleteReturningQuery<S, TN, PickRow<S, TN, C$1>>;
532
+ toSql(): TypedSqlRequest<R$1>;
533
+ }
429
534
  interface InsertQuery<S extends DBSchema, TN extends string> {
430
- returning: (cols?: ReadonlyArray<ColumnNames<S, TN>>) => InsertQuery<S, TN>;
431
- toSql: () => SqlRequest<Record<string, unknown>>;
535
+ returning(): InsertReturningQuery<S, TN, RowForTable<S, TN>>;
536
+ returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): InsertReturningQuery<S, TN, PickRow<S, TN, C$1>>;
537
+ toSql(): SqlRequest<Record<string, unknown>>;
432
538
  }
433
539
  interface UpdateQuery<S extends DBSchema, TN extends string> {
434
540
  where: (where: WhereForTable<S, TN>) => UpdateQuery<S, TN>;
435
541
  wherePk: (pk: PrimaryKeyValue<S, TN>) => UpdateQuery<S, TN>;
436
- returning: (cols?: ReadonlyArray<ColumnNames<S, TN>>) => UpdateQuery<S, TN>;
437
- toSql: () => SqlRequest<Record<string, unknown>>;
542
+ returning(): UpdateReturningQuery<S, TN, RowForTable<S, TN>>;
543
+ returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): UpdateReturningQuery<S, TN, PickRow<S, TN, C$1>>;
544
+ toSql(): SqlRequest<Record<string, unknown>>;
438
545
  }
439
546
  interface DeleteQuery<S extends DBSchema, TN extends string> {
440
547
  where: (where: WhereForTable<S, TN>) => DeleteQuery<S, TN>;
441
548
  wherePk: (pk: PrimaryKeyValue<S, TN>) => DeleteQuery<S, TN>;
442
- returning: (cols?: ReadonlyArray<ColumnNames<S, TN>>) => DeleteQuery<S, TN>;
443
- toSql: () => SqlRequest<Record<string, unknown>>;
549
+ returning(): DeleteReturningQuery<S, TN, RowForTable<S, TN>>;
550
+ returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): DeleteReturningQuery<S, TN, PickRow<S, TN, C$1>>;
551
+ toSql(): SqlRequest<Record<string, unknown>>;
444
552
  }
445
553
  declare function createSqlBuilder<S extends DBSchema>(schema: S): SqlBuilder<S>;
446
554
  //#endregion
555
+ //#region src/http/errors.d.ts
556
+ /**
557
+ * @author Martin Høgh <mh@mapcentia.com>
558
+ * @copyright 2013-2026 MapCentia ApS
559
+ * @license https://opensource.org/license/mit The MIT License
560
+ */
561
+ interface CentiaApiErrorOptions {
562
+ message: string;
563
+ status?: number;
564
+ code?: string;
565
+ details?: unknown;
566
+ requestId?: string;
567
+ method: string;
568
+ url: string;
569
+ cause?: unknown;
570
+ }
571
+ /**
572
+ * Normalized error thrown by all SDK HTTP operations.
573
+ * CLI and Web should catch this type for consistent error handling.
574
+ */
575
+ declare class CentiaApiError extends Error {
576
+ readonly name = "CentiaApiError";
577
+ readonly status: number | undefined;
578
+ readonly code: string | undefined;
579
+ readonly details: unknown;
580
+ readonly requestId: string | undefined;
581
+ readonly method: string;
582
+ readonly url: string;
583
+ constructor(opts: CentiaApiErrorOptions);
584
+ }
585
+ /** Type guard for CentiaApiError. */
586
+ declare function isCentiaApiError(e: unknown): e is CentiaApiError;
587
+ //#endregion
588
+ //#region src/provisioning/types.d.ts
589
+ /**
590
+ * @author Martin Høgh <mh@mapcentia.com>
591
+ * @copyright 2013-2026 MapCentia ApS
592
+ * @license https://opensource.org/license/mit The MIT License
593
+ */
594
+ type ConstraintType = 'primary' | 'foreign' | 'unique' | 'check';
595
+ type IndexMethod = 'btree' | 'brin' | 'gin' | 'gist' | 'hash';
596
+ type IdentityGeneration = 'always' | 'by default';
597
+ type SequenceDataType = 'smallint' | 'integer' | 'bigint';
598
+ interface LocationResponse {
599
+ location: string;
600
+ }
601
+ interface CreateSchemaRequest {
602
+ name: string;
603
+ tables?: TableDef$1[];
604
+ sequences?: SequenceDef[];
605
+ }
606
+ interface RenameSchemaRequest {
607
+ name: string;
608
+ }
609
+ interface GetSchemaOptions {
610
+ namesOnly?: boolean;
611
+ }
612
+ interface SchemaInfo {
613
+ name: string;
614
+ tables?: TableInfo[];
615
+ sequences?: SequenceInfo[];
616
+ }
617
+ interface TableDef$1 {
618
+ name: string;
619
+ columns?: ColumnDef$1[];
620
+ constraints?: ConstraintDef[];
621
+ indices?: IndexDef[];
622
+ comment?: string;
623
+ }
624
+ interface TableInfo {
625
+ name: string;
626
+ columns?: ColumnInfo[];
627
+ constraints?: ConstraintInfo[];
628
+ indices?: IndexInfo[];
629
+ comment?: string;
630
+ }
631
+ interface ColumnDef$1 {
632
+ name?: string;
633
+ type?: string;
634
+ is_nullable?: boolean;
635
+ default_value?: string;
636
+ identity_generation?: IdentityGeneration;
637
+ comment?: string;
638
+ }
639
+ interface CreateColumnRequest {
640
+ name: string;
641
+ type: string;
642
+ is_nullable?: boolean;
643
+ default_value?: string;
644
+ identity_generation?: IdentityGeneration;
645
+ comment?: string;
646
+ }
647
+ interface PatchColumnRequest {
648
+ name?: string;
649
+ type?: string;
650
+ is_nullable?: boolean;
651
+ default_value?: string;
652
+ identity_generation?: IdentityGeneration;
653
+ comment?: string;
654
+ }
655
+ interface ColumnInfo {
656
+ name: string;
657
+ type: string;
658
+ is_nullable: boolean;
659
+ default_value: string | null;
660
+ identity_generation?: string | null;
661
+ comment?: string | null;
662
+ _num?: number;
663
+ _typname?: string;
664
+ _is_array?: boolean;
665
+ _character_maximum_length?: number | null;
666
+ _numeric_precision?: number | null;
667
+ _numeric_scale?: number | null;
668
+ _max_bytes?: number;
669
+ _reference?: string[] | null;
670
+ _is_unique?: boolean;
671
+ _is_primary?: boolean;
672
+ _index_method?: string[] | null;
673
+ _checks?: unknown[] | null;
674
+ }
675
+ interface ConstraintDef {
676
+ constraint: ConstraintType;
677
+ columns: string[];
678
+ name?: string;
679
+ check?: string;
680
+ referenced_table?: string;
681
+ referenced_columns?: string[];
682
+ }
683
+ interface CreateConstraintRequest {
684
+ constraint: ConstraintType;
685
+ columns: string[];
686
+ name?: string;
687
+ check?: string;
688
+ referenced_table?: string;
689
+ referenced_columns?: string[];
690
+ }
691
+ interface ConstraintInfo {
692
+ name: string;
693
+ constraint: ConstraintType;
694
+ columns: string[];
695
+ referenced_table?: string;
696
+ referenced_columns?: string[];
697
+ check?: string;
698
+ }
699
+ interface IndexDef {
700
+ columns: string[];
701
+ method?: IndexMethod;
702
+ name?: string;
703
+ }
704
+ interface CreateIndexRequest {
705
+ columns: string[];
706
+ method?: IndexMethod;
707
+ name?: string;
708
+ }
709
+ interface IndexInfo {
710
+ name: string;
711
+ method: IndexMethod;
712
+ columns: string[];
713
+ unique?: boolean;
714
+ }
715
+ interface SequenceDef {
716
+ name: string;
717
+ data_type?: SequenceDataType;
718
+ increment_by?: number;
719
+ min_value?: number;
720
+ max_value?: number;
721
+ start_value?: number;
722
+ cache_size?: number;
723
+ owned_by?: string;
724
+ }
725
+ interface CreateSequenceRequest {
726
+ name: string;
727
+ data_type?: SequenceDataType;
728
+ increment_by?: number;
729
+ min_value?: number;
730
+ max_value?: number;
731
+ start_value?: number;
732
+ cache_size?: number;
733
+ owned_by?: string;
734
+ }
735
+ interface PatchSequenceRequest {
736
+ name: string;
737
+ data_type?: SequenceDataType;
738
+ increment_by?: number;
739
+ min_value?: number;
740
+ max_value?: number;
741
+ start_value?: number;
742
+ cache_size?: number;
743
+ owned_by?: string;
744
+ }
745
+ interface SequenceInfo {
746
+ name: string;
747
+ data_type: SequenceDataType;
748
+ increment_by: number;
749
+ min_value: number;
750
+ max_value: number;
751
+ start_value: number;
752
+ cache_size: number;
753
+ owned_by?: string;
754
+ }
755
+ interface CreateUserRequest {
756
+ name: string;
757
+ email: string;
758
+ password: string;
759
+ default_user?: boolean;
760
+ properties?: unknown;
761
+ }
762
+ interface PatchUserRequest {
763
+ email: string;
764
+ password: string | null;
765
+ default_user?: boolean;
766
+ properties?: unknown;
767
+ user_group?: string;
768
+ }
769
+ interface UserInfo {
770
+ name: string;
771
+ email: string;
772
+ default_user: boolean;
773
+ user_group?: string;
774
+ properties?: unknown;
775
+ }
776
+ interface CreateClientRequest {
777
+ name: string;
778
+ id?: string;
779
+ description?: string | null;
780
+ redirect_uri?: string[];
781
+ homepage?: string;
782
+ public?: boolean;
783
+ confirm?: boolean;
784
+ two_factor?: boolean;
785
+ allow_signup?: boolean;
786
+ social_signup?: boolean;
787
+ }
788
+ interface PatchClientRequest {
789
+ name?: string;
790
+ description?: string | null;
791
+ redirect_uri?: string[];
792
+ homepage?: string;
793
+ public?: boolean;
794
+ confirm?: boolean;
795
+ two_factor?: boolean;
796
+ allow_signup?: boolean;
797
+ social_signup?: boolean;
798
+ }
799
+ interface CreateClientResponse {
800
+ location: string;
801
+ secret: string;
802
+ }
803
+ interface ClientInfo {
804
+ id: string;
805
+ name: string;
806
+ description: string | null;
807
+ redirect_uri: string[];
808
+ homepage: string;
809
+ public: boolean;
810
+ confirm: boolean;
811
+ two_factor: boolean;
812
+ allow_signup: boolean;
813
+ social_signup: boolean;
814
+ }
815
+ type RuleAccess = 'allow' | 'limit' | 'deny';
816
+ type RuleRequest = 'select' | 'insert' | 'update' | 'delete';
817
+ type RuleService = 'sql' | 'ows' | 'wfst';
818
+ interface CreateRuleRequest {
819
+ access?: RuleAccess;
820
+ filter?: string;
821
+ id?: number;
822
+ iprange?: string;
823
+ priority?: number;
824
+ request?: RuleRequest;
825
+ schema?: string;
826
+ service?: RuleService;
827
+ table?: string;
828
+ username?: string;
829
+ }
830
+ interface PatchRuleRequest {
831
+ access?: RuleAccess;
832
+ filter?: string;
833
+ iprange?: string;
834
+ priority?: number;
835
+ request?: RuleRequest;
836
+ schema?: string;
837
+ service?: RuleService;
838
+ table?: string;
839
+ username?: string;
840
+ }
841
+ interface RuleInfo {
842
+ id: number;
843
+ access?: RuleAccess;
844
+ filter?: string;
845
+ iprange?: string;
846
+ priority?: number;
847
+ request?: RuleRequest;
848
+ schema?: string;
849
+ service?: RuleService;
850
+ table?: string;
851
+ username?: string;
852
+ }
853
+ type PrivilegeLevel = 'none' | 'read' | 'write';
854
+ interface PatchPrivilegeRequest {
855
+ subuser: string;
856
+ privilege: PrivilegeLevel;
857
+ }
858
+ interface PrivilegeInfo {
859
+ subuser: string;
860
+ privilege: PrivilegeLevel;
861
+ }
862
+ interface CreateRpcMethodRequest {
863
+ method: string;
864
+ q: string;
865
+ output_format?: string;
866
+ srs?: number;
867
+ type_formats?: Record<string, unknown>;
868
+ type_hints?: Record<string, unknown>;
869
+ }
870
+ interface PatchRpcMethodRequest {
871
+ q: string;
872
+ output_format?: string;
873
+ srs?: number;
874
+ type_formats?: Record<string, unknown>;
875
+ type_hints?: Record<string, unknown>;
876
+ }
877
+ interface RpcMethodInfo {
878
+ method: string;
879
+ q: string;
880
+ output_format?: string;
881
+ srs?: number;
882
+ type_formats?: Record<string, unknown>;
883
+ type_hints?: Record<string, unknown>;
884
+ }
885
+ interface MetadataFieldInfo {
886
+ alias?: string;
887
+ queryable?: boolean;
888
+ sort_id?: number;
889
+ }
890
+ interface MetadataRelationInfo {
891
+ title?: string;
892
+ abstract?: string;
893
+ group?: string;
894
+ sort_id?: number;
895
+ tags?: string[];
896
+ properties?: Record<string, unknown>;
897
+ fields?: Record<string, MetadataFieldInfo>;
898
+ }
899
+ interface PatchMetadataRequest {
900
+ relations: Record<string, MetadataRelationInfo>;
901
+ }
902
+ interface FileProcessRequest {
903
+ file: string;
904
+ schema: string;
905
+ import?: boolean;
906
+ append?: boolean;
907
+ truncate?: boolean;
908
+ p_multi?: boolean;
909
+ s_srs?: string;
910
+ t_srs?: string;
911
+ timestamp?: string;
912
+ x_possible_names?: string;
913
+ y_possible_names?: string;
914
+ }
915
+ interface FileProcessResult {
916
+ [key: string]: unknown;
917
+ }
918
+ interface CommitRequest {
919
+ schema: string;
920
+ repo: string;
921
+ message: string;
922
+ meta_query?: string;
923
+ }
924
+ interface CommitResult {
925
+ [key: string]: unknown;
926
+ }
927
+ //#endregion
928
+ //#region src/provisioning/Schemas.d.ts
929
+ declare class Schemas {
930
+ private readonly client;
931
+ constructor(client: CentiaHttpClient);
932
+ getSchema(schema?: undefined, opts?: GetSchemaOptions): Promise<SchemaInfo[]>;
933
+ getSchema(schema: string, opts?: GetSchemaOptions): Promise<SchemaInfo>;
934
+ postSchema(body: CreateSchemaRequest): Promise<LocationResponse>;
935
+ patchSchema(schema: string, body: RenameSchemaRequest): Promise<LocationResponse>;
936
+ deleteSchema(schema: string): Promise<void>;
937
+ }
938
+ //#endregion
939
+ //#region src/provisioning/Columns.d.ts
940
+ declare class Columns {
941
+ private readonly client;
942
+ constructor(client: CentiaHttpClient);
943
+ private basePath;
944
+ getColumn(schema: string, table: string): Promise<ColumnInfo[]>;
945
+ getColumn(schema: string, table: string, column: string): Promise<ColumnInfo>;
946
+ postColumn(schema: string, table: string, body: CreateColumnRequest): Promise<LocationResponse>;
947
+ patchColumn(schema: string, table: string, column: string, body: PatchColumnRequest): Promise<LocationResponse>;
948
+ deleteColumn(schema: string, table: string, column: string): Promise<void>;
949
+ }
950
+ //#endregion
951
+ //#region src/provisioning/Constraints.d.ts
952
+ declare class Constraints {
953
+ private readonly client;
954
+ constructor(client: CentiaHttpClient);
955
+ private basePath;
956
+ getConstraint(schema: string, table: string): Promise<ConstraintInfo[]>;
957
+ getConstraint(schema: string, table: string, constraint: string): Promise<ConstraintInfo>;
958
+ postConstraint(schema: string, table: string, body: CreateConstraintRequest): Promise<LocationResponse>;
959
+ deleteConstraint(schema: string, table: string, constraint: string): Promise<void>;
960
+ }
961
+ //#endregion
962
+ //#region src/provisioning/Indices.d.ts
963
+ declare class Indices {
964
+ private readonly client;
965
+ constructor(client: CentiaHttpClient);
966
+ private basePath;
967
+ getIndex(schema: string, table: string): Promise<IndexInfo[]>;
968
+ getIndex(schema: string, table: string, index: string): Promise<IndexInfo>;
969
+ postIndex(schema: string, table: string, body: CreateIndexRequest): Promise<LocationResponse>;
970
+ deleteIndex(schema: string, table: string, index: string): Promise<void>;
971
+ }
972
+ //#endregion
973
+ //#region src/provisioning/Sequences.d.ts
974
+ declare class Sequences {
975
+ private readonly client;
976
+ constructor(client: CentiaHttpClient);
977
+ private basePath;
978
+ getSequence(schema: string): Promise<SequenceInfo[]>;
979
+ getSequence(schema: string, sequence: string): Promise<SequenceInfo>;
980
+ postSequence(schema: string, body: CreateSequenceRequest): Promise<LocationResponse>;
981
+ patchSequence(schema: string, sequence: string, body: PatchSequenceRequest): Promise<LocationResponse>;
982
+ deleteSequence(schema: string, sequence: string): Promise<void>;
983
+ }
984
+ //#endregion
985
+ //#region src/provisioning/Tables.d.ts
986
+ declare class ProvisioningTables {
987
+ private readonly client;
988
+ constructor(client: CentiaHttpClient);
989
+ private basePath;
990
+ getTable(schema: string): Promise<TableInfo[]>;
991
+ getTable(schema: string, table: string): Promise<TableInfo>;
992
+ postTable(schema: string, body: {
993
+ name: string;
994
+ [key: string]: unknown;
995
+ }): Promise<LocationResponse>;
996
+ patchTable(schema: string, table: string, body: Record<string, unknown>): Promise<LocationResponse>;
997
+ deleteTable(schema: string, table: string): Promise<void>;
998
+ }
999
+ //#endregion
1000
+ //#region src/provisioning/Users.d.ts
1001
+ declare class ProvisioningUsers {
1002
+ private readonly client;
1003
+ constructor(client: CentiaHttpClient);
1004
+ getUser(): Promise<UserInfo[]>;
1005
+ getUser(name: string): Promise<UserInfo>;
1006
+ postUser(body: CreateUserRequest): Promise<LocationResponse>;
1007
+ patchUser(name: string, body: PatchUserRequest): Promise<LocationResponse>;
1008
+ deleteUser(name: string): Promise<void>;
1009
+ }
1010
+ //#endregion
1011
+ //#region src/provisioning/Clients.d.ts
1012
+ declare class ProvisioningClients {
1013
+ private readonly client;
1014
+ constructor(client: CentiaHttpClient);
1015
+ getClient(): Promise<ClientInfo[]>;
1016
+ getClient(id: string): Promise<ClientInfo>;
1017
+ postClient(body: CreateClientRequest): Promise<CreateClientResponse>;
1018
+ patchClient(id: string, body: PatchClientRequest): Promise<LocationResponse>;
1019
+ deleteClient(id: string): Promise<void>;
1020
+ }
1021
+ //#endregion
1022
+ //#region src/provisioning/Rules.d.ts
1023
+ declare class Rules {
1024
+ private readonly client;
1025
+ constructor(client: CentiaHttpClient);
1026
+ getRule(): Promise<RuleInfo[]>;
1027
+ getRule(id: number): Promise<RuleInfo>;
1028
+ postRule(body: CreateRuleRequest): Promise<RuleInfo>;
1029
+ patchRule(id: number, body: PatchRuleRequest): Promise<RuleInfo>;
1030
+ deleteRule(id: number): Promise<void>;
1031
+ }
1032
+ //#endregion
1033
+ //#region src/provisioning/Privileges.d.ts
1034
+ declare class Privileges {
1035
+ private readonly client;
1036
+ constructor(client: CentiaHttpClient);
1037
+ getPrivileges(schema: string, table: string): Promise<PrivilegeInfo[]>;
1038
+ patchPrivileges(schema: string, table: string, body: PatchPrivilegeRequest): Promise<PrivilegeInfo[]>;
1039
+ }
1040
+ //#endregion
1041
+ //#region src/provisioning/RpcMethods.d.ts
1042
+ declare class RpcMethods {
1043
+ private readonly client;
1044
+ constructor(client: CentiaHttpClient);
1045
+ getRpc(): Promise<RpcMethodInfo[]>;
1046
+ getRpc(method: string): Promise<RpcMethodInfo>;
1047
+ postRpc(body: CreateRpcMethodRequest): Promise<LocationResponse>;
1048
+ patchRpc(method: string, body: PatchRpcMethodRequest): Promise<LocationResponse>;
1049
+ deleteRpc(method: string): Promise<void>;
1050
+ postCallDry(body: unknown): Promise<unknown>;
1051
+ }
1052
+ //#endregion
1053
+ //#region src/provisioning/MetadataWrite.d.ts
1054
+ declare class MetadataWrite {
1055
+ private readonly client;
1056
+ constructor(client: CentiaHttpClient);
1057
+ patchMetaData(body: PatchMetadataRequest): Promise<unknown>;
1058
+ }
1059
+ //#endregion
1060
+ //#region src/provisioning/TypeScriptInterfaces.d.ts
1061
+ declare class TypeScriptInterfaces {
1062
+ private readonly client;
1063
+ constructor(client: CentiaHttpClient);
1064
+ getTypeScript(): Promise<string>;
1065
+ }
1066
+ //#endregion
1067
+ //#region src/provisioning/FileImport.d.ts
1068
+ declare class FileImport {
1069
+ private readonly client;
1070
+ constructor(client: CentiaHttpClient);
1071
+ /**
1072
+ * Upload a file via multipart/form-data.
1073
+ * In Node.js, pass a FormData instance. In browsers, pass a native FormData.
1074
+ */
1075
+ postFileUpload(formData: FormData): Promise<{
1076
+ filename: string;
1077
+ }>;
1078
+ postFileProcess(body: FileProcessRequest): Promise<FileProcessResult>;
1079
+ }
1080
+ //#endregion
1081
+ //#region src/provisioning/GitCommit.d.ts
1082
+ declare class GitCommit {
1083
+ private readonly client;
1084
+ constructor(client: CentiaHttpClient);
1085
+ postCommit(body: CommitRequest): Promise<CommitResult>;
1086
+ }
1087
+ //#endregion
1088
+ //#region src/provisioning/SqlNoToken.d.ts
1089
+ interface SqlNoTokenRequest {
1090
+ q: string;
1091
+ output_format?: string;
1092
+ srs?: number;
1093
+ params?: Record<string, unknown>[];
1094
+ type_formats?: Record<string, unknown>;
1095
+ type_hints?: Record<string, unknown>;
1096
+ }
1097
+ declare class SqlNoToken {
1098
+ private readonly client;
1099
+ constructor(client: CentiaHttpClient);
1100
+ postSqlNoToken(database: string, body: SqlNoTokenRequest): Promise<unknown>;
1101
+ }
1102
+ //#endregion
1103
+ //#region src/admin.d.ts
1104
+ /** Admin client providing access to all provisioning operations. */
1105
+ interface CentiaAdminClient {
1106
+ /** The underlying HTTP client. */
1107
+ readonly http: CentiaHttpClient;
1108
+ /** Schema, table, column, constraint, index, sequence, user, client, rule, privilege, RPC, metadata, file import, git, and SQL management. */
1109
+ readonly provisioning: {
1110
+ readonly schemas: Schemas;
1111
+ readonly tables: ProvisioningTables;
1112
+ readonly columns: Columns;
1113
+ readonly constraints: Constraints;
1114
+ readonly indices: Indices;
1115
+ readonly sequences: Sequences;
1116
+ readonly users: ProvisioningUsers;
1117
+ readonly clients: ProvisioningClients;
1118
+ readonly rules: Rules;
1119
+ readonly privileges: Privileges;
1120
+ readonly rpcMethods: RpcMethods;
1121
+ readonly metadata: MetadataWrite;
1122
+ readonly typeScript: TypeScriptInterfaces;
1123
+ readonly fileImport: FileImport;
1124
+ readonly gitCommit: GitCommit;
1125
+ readonly sqlNoToken: SqlNoToken;
1126
+ };
1127
+ }
1128
+ /**
1129
+ * Create a Centia admin client with access to provisioning operations.
1130
+ *
1131
+ * ```ts
1132
+ * const client = createCentiaAdminClient({
1133
+ * baseUrl: 'https://example.centia.io',
1134
+ * auth: { getAccessToken: async () => token },
1135
+ * });
1136
+ *
1137
+ * await client.provisioning.schemas.postSchema({ name: 'myschema' });
1138
+ * ```
1139
+ */
1140
+ declare function createCentiaAdminClient(config: CentiaClientConfig): CentiaAdminClient;
1141
+ //#endregion
447
1142
  //#region src/index.d.ts
448
1143
  /**
449
1144
  * @author Martin Høgh <mh@mapcentia.com>
@@ -453,5 +1148,5 @@ declare function createSqlBuilder<S extends DBSchema>(schema: S): SqlBuilder<S>;
453
1148
  */
454
1149
 
455
1150
  //#endregion
456
- export { Claims, CodeFlow, type CodeFlowOptions, type ColumnDef, type DBSchema, Gql, type GqlRequest, type GqlResponse, Meta, type Options, type ParamsOfApiMethod, PasswordFlow, type PasswordFlowOptions, type pgTypes_d_exports as PgTypes, type PickRow, type RowForTable, type RowOfApiCall, type RowOfApiMethod, type RowOfRequest, type RowOfSelect, type RowsOfApiCall, type RowsOfApiMethod, type RowsOfRequest, type RowsOfSelect, Rpc, type RpcRequest, type RpcResponse, SignUp, Sql, type SqlRequest, type SqlResponse, Stats, Status, type TableDef, Tables, Users, Ws, createApi, createSqlBuilder };
1151
+ export { type CentiaAdminClient, CentiaApiError, type CentiaApiErrorOptions, type CentiaAuth, type CentiaClientConfig, type CentiaHttpClient, Claims, type ClientInfo, CodeFlow, type CodeFlowOptions, type ColumnDef, type ColumnInfo, type CommitRequest, type CommitResult, type ConstraintInfo, type CreateClientRequest, type CreateClientResponse, type CreateColumnRequest, type CreateConstraintRequest, type CreateIndexRequest, type CreateRpcMethodRequest, type CreateRuleRequest, type CreateSchemaRequest, type CreateSequenceRequest, type CreateUserRequest, type DBSchema, type FileProcessRequest, type FileProcessResult, type FullResponse, type GetSchemaOptions, Gql, type GqlRequest, type GqlResponse, type IndexInfo, type LocationResponse, Meta, type MetadataFieldInfo, type MetadataRelationInfo, type Options, type ParamsOfApiMethod, PasswordFlow, type PasswordFlowOptions, type PatchClientRequest, type PatchColumnRequest, type PatchMetadataRequest, type PatchPrivilegeRequest, type PatchRpcMethodRequest, type PatchRuleRequest, type PatchSequenceRequest, type PatchUserRequest, type pgTypes_d_exports as PgTypes, type PickRow, type PrivilegeInfo, type PrivilegeLevel, type RenameSchemaRequest, type RequestOptions, type RowForTable, type RowOfApiCall, type RowOfApiMethod, type RowOfRequest, type RowOfSelect, type RowsOfApiCall, type RowsOfApiMethod, type RowsOfRequest, type RowsOfSelect, Rpc, type RpcMethodInfo, type RpcRequest, type RpcResponse, type RuleAccess, type RuleInfo, type RuleRequest, type RuleService, type SchemaInfo, type SequenceInfo, SignUp, Sql, type SqlNoTokenRequest, type SqlRequest, type SqlResponse, Stats, Status, type TableDef, type TableInfo, Tables, type UserInfo, Users, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, isCentiaApiError };
457
1152
  //# sourceMappingURL=centia-io-sdk.d.ts.map