@centia-io/sdk 0.0.43 → 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.
- package/LICENSE +21 -21
- package/README.md +570 -570
- package/dist/centia-io-sdk.cjs +859 -61
- package/dist/centia-io-sdk.d.cts +803 -58
- package/dist/centia-io-sdk.d.cts.map +1 -1
- package/dist/centia-io-sdk.d.ts +803 -58
- package/dist/centia-io-sdk.d.ts.map +1 -1
- package/dist/centia-io-sdk.js +854 -61
- package/dist/centia-io-sdk.js.map +1 -1
- package/dist/centia-io-sdk.umd.js +2037 -1239
- package/package.json +33 -36
package/dist/centia-io-sdk.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ type Options = {
|
|
|
14
14
|
deviceUri?: string;
|
|
15
15
|
scope?: string;
|
|
16
16
|
clientId: string;
|
|
17
|
+
clientSecret?: string;
|
|
17
18
|
};
|
|
18
19
|
type CodeFlowOptions = Options & {
|
|
19
20
|
redirectUri: string;
|
|
@@ -95,11 +96,115 @@ declare class PasswordFlow {
|
|
|
95
96
|
signOut(): void;
|
|
96
97
|
clear(): void;
|
|
97
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;
|
|
98
200
|
declare namespace pgTypes_d_exports {
|
|
99
|
-
export { BPChar, Box, Char, Circle, ColumnSchemaMeta, DataRow, DateRange, DateString, DecimalString, Int4Range, Int8Range, IntervalValue, JsonArray, JsonObject, JsonPrimitive, JsonValue, Line, Lseg, NumRange, NumericString, Path, PgArray, PgBoolean, Point, Polygon, Range, RowValue, RpcRequest, RpcResponse,
|
|
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 };
|
|
100
202
|
}
|
|
101
203
|
/**
|
|
102
|
-
*
|
|
204
|
+
* @author Martin Høgh <mh@mapcentia.com>
|
|
205
|
+
* @copyright 2013-2026 MapCentia ApS
|
|
206
|
+
* @license https://opensource.org/license/mit The MIT License
|
|
207
|
+
*
|
|
103
208
|
*/
|
|
104
209
|
type JsonPrimitive = string | number | boolean | null;
|
|
105
210
|
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
@@ -165,29 +270,41 @@ type DateRange = Range<DateString>;
|
|
|
165
270
|
type PgArray<T> = T[];
|
|
166
271
|
interface SqlRequest<Params extends Record<string, unknown> = Record<string, unknown>> {
|
|
167
272
|
q: string;
|
|
168
|
-
params?: Params;
|
|
273
|
+
params?: Params[];
|
|
169
274
|
type_hints?: Record<string, string>;
|
|
170
275
|
type_formats?: Record<string, string>;
|
|
171
276
|
}
|
|
277
|
+
interface SqlResponse<Row extends DataRow = DataRow> {
|
|
278
|
+
schema: Record<string, ColumnSchemaMeta>;
|
|
279
|
+
data: Row[];
|
|
280
|
+
}
|
|
172
281
|
interface TypedSqlRequest<Row extends DataRow, Params extends Record<string, unknown> = Record<string, unknown>> extends SqlRequest<Params> {
|
|
173
282
|
readonly __row?: Row;
|
|
174
283
|
}
|
|
175
284
|
interface RpcRequest<Params extends Record<string, unknown> = Record<string, unknown>> {
|
|
176
285
|
jsonrpc: "2.0";
|
|
177
286
|
method: string;
|
|
178
|
-
params?: Params;
|
|
287
|
+
params?: Params[];
|
|
179
288
|
id?: number | string;
|
|
180
289
|
}
|
|
290
|
+
interface GqlRequest {
|
|
291
|
+
query: string;
|
|
292
|
+
variables?: Record<string, unknown>;
|
|
293
|
+
operationName?: string;
|
|
294
|
+
extensions?: Record<string, unknown>;
|
|
295
|
+
}
|
|
296
|
+
interface GqlResponse {
|
|
297
|
+
data?: Record<string, unknown>;
|
|
298
|
+
errors?: Array<{
|
|
299
|
+
message: string;
|
|
300
|
+
}>;
|
|
301
|
+
}
|
|
181
302
|
interface ColumnSchemaMeta {
|
|
182
303
|
type: string;
|
|
183
304
|
array: boolean;
|
|
184
305
|
}
|
|
185
306
|
type RowValue = number | string | PgBoolean | JsonValue | DateString | TimeString | TimetzString | TimestampString | TimestamptzString | IntervalValue | Point | Line | Lseg | Box | Path | Polygon | Circle | Int4Range | Int8Range | NumRange | TsRange | TstzRange | DateRange | PgArray<any> | null;
|
|
186
307
|
type DataRow = Record<string, RowValue>;
|
|
187
|
-
interface SQLResponse<Row extends DataRow = DataRow> {
|
|
188
|
-
schema: Record<string, ColumnSchemaMeta>;
|
|
189
|
-
data: Row[];
|
|
190
|
-
}
|
|
191
308
|
interface RpcResponse<Row extends DataRow = DataRow> {
|
|
192
309
|
jsonrpc: "2.0";
|
|
193
310
|
result: {
|
|
@@ -199,33 +316,61 @@ interface RpcResponse<Row extends DataRow = DataRow> {
|
|
|
199
316
|
//#endregion
|
|
200
317
|
//#region src/Sql.d.ts
|
|
201
318
|
declare class Sql {
|
|
202
|
-
|
|
203
|
-
|
|
319
|
+
private client;
|
|
320
|
+
constructor(client?: CentiaHttpClient);
|
|
321
|
+
exec<R$1 extends DataRow>(request: TypedSqlRequest<R$1>): Promise<SqlResponse<R$1>>;
|
|
322
|
+
exec(request: SqlRequest): Promise<SqlResponse<DataRow>>;
|
|
204
323
|
}
|
|
205
324
|
//#endregion
|
|
206
325
|
//#region src/Rpc.d.ts
|
|
207
326
|
declare class Rpc {
|
|
327
|
+
private client;
|
|
328
|
+
constructor(client?: CentiaHttpClient);
|
|
208
329
|
call(request: RpcRequest): Promise<RpcResponse>;
|
|
209
330
|
}
|
|
210
331
|
//#endregion
|
|
332
|
+
//#region src/Gql.d.ts
|
|
333
|
+
declare class Gql {
|
|
334
|
+
private schema;
|
|
335
|
+
private client;
|
|
336
|
+
constructor(schema: string, client?: CentiaHttpClient);
|
|
337
|
+
request(request: GqlRequest): Promise<GqlResponse>;
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
211
340
|
//#region src/Meta.d.ts
|
|
212
341
|
declare class Meta {
|
|
342
|
+
private client;
|
|
343
|
+
constructor(client?: CentiaHttpClient);
|
|
213
344
|
query(rel: string): Promise<any>;
|
|
214
345
|
}
|
|
215
346
|
//#endregion
|
|
216
347
|
//#region src/Status.d.ts
|
|
348
|
+
/**
|
|
349
|
+
* @author Martin Høgh <mh@mapcentia.com>
|
|
350
|
+
* @copyright 2013-2026 MapCentia ApS
|
|
351
|
+
* @license https://opensource.org/license/mit The MIT License
|
|
352
|
+
*
|
|
353
|
+
*/
|
|
217
354
|
declare class Status {
|
|
218
355
|
isAuth(): boolean;
|
|
219
356
|
getTokens(): Tokens;
|
|
220
357
|
}
|
|
221
358
|
//#endregion
|
|
222
359
|
//#region src/Claims.d.ts
|
|
360
|
+
/**
|
|
361
|
+
* @author Martin Høgh <mh@mapcentia.com>
|
|
362
|
+
* @copyright 2013-2026 MapCentia ApS
|
|
363
|
+
* @license https://opensource.org/license/mit The MIT License
|
|
364
|
+
*
|
|
365
|
+
*/
|
|
223
366
|
declare class Claims {
|
|
224
367
|
get(): any;
|
|
225
368
|
}
|
|
226
369
|
//#endregion
|
|
227
370
|
//#region src/Users.d.ts
|
|
228
371
|
declare class Users {
|
|
372
|
+
private client;
|
|
373
|
+
constructor(client?: CentiaHttpClient);
|
|
229
374
|
get(user: string): Promise<any>;
|
|
230
375
|
}
|
|
231
376
|
//#endregion
|
|
@@ -238,11 +383,15 @@ declare class Ws {
|
|
|
238
383
|
//#endregion
|
|
239
384
|
//#region src/Stats.d.ts
|
|
240
385
|
declare class Stats {
|
|
386
|
+
private client;
|
|
387
|
+
constructor(client?: CentiaHttpClient);
|
|
241
388
|
get(): Promise<any>;
|
|
242
389
|
}
|
|
243
390
|
//#endregion
|
|
244
391
|
//#region src/Tables.d.ts
|
|
245
392
|
declare class Tables {
|
|
393
|
+
private client;
|
|
394
|
+
constructor(client?: CentiaHttpClient);
|
|
246
395
|
get(schema: string, table: string): Promise<any>;
|
|
247
396
|
create(schema: string, table: string, payload: any): Promise<any>;
|
|
248
397
|
patch(schema: string, table: string, payload: any): Promise<any>;
|
|
@@ -253,10 +402,10 @@ declare class Tables {
|
|
|
253
402
|
type MethodsOf<T> = { [K in keyof T]: T[K] extends ((...args: infer A) => infer R) ? (...args: A) => R : never };
|
|
254
403
|
type RowOfApiCall<F> = F extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E : R : never;
|
|
255
404
|
type RowsOfApiCall<F> = F extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E[] : R[] : never;
|
|
256
|
-
type RowOfApiMethod<A, K extends keyof A> = A[K] extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E : R : never;
|
|
257
|
-
type RowsOfApiMethod<A, K extends keyof A> = A[K] extends ((...args: any[]) => Promise<infer R>) ? R extends ReadonlyArray<infer E> ? E[] : R[] : never;
|
|
258
|
-
type ParamsOfApiMethod<A, K extends keyof A> = A[K] extends ((...args: infer P) => any) ? P[0] : never;
|
|
259
|
-
declare function createApi<T>(): MethodsOf<T>;
|
|
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;
|
|
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;
|
|
407
|
+
type ParamsOfApiMethod<A$1, K$1 extends keyof A$1> = A$1[K$1] extends ((...args: infer P) => any) ? P[0] : never;
|
|
408
|
+
declare function createApi<T>(client?: CentiaHttpClient): MethodsOf<T>;
|
|
260
409
|
//#endregion
|
|
261
410
|
//#region src/SignUp.d.ts
|
|
262
411
|
declare class SignUp {
|
|
@@ -275,7 +424,7 @@ interface ColumnDef {
|
|
|
275
424
|
type?: string;
|
|
276
425
|
[key: string]: any;
|
|
277
426
|
}
|
|
278
|
-
interface ConstraintDef {
|
|
427
|
+
interface ConstraintDef$1 {
|
|
279
428
|
name: string;
|
|
280
429
|
constraint: "primary" | "foreign" | string;
|
|
281
430
|
columns?: readonly string[];
|
|
@@ -286,7 +435,7 @@ interface ConstraintDef {
|
|
|
286
435
|
interface TableDef {
|
|
287
436
|
name: string;
|
|
288
437
|
columns: readonly ColumnDef[];
|
|
289
|
-
constraints?: readonly ConstraintDef[];
|
|
438
|
+
constraints?: readonly ConstraintDef$1[];
|
|
290
439
|
[key: string]: any;
|
|
291
440
|
}
|
|
292
441
|
interface DBSchema {
|
|
@@ -309,12 +458,12 @@ type PrimaryKeyColumns<S extends DBSchema, TN extends string> = PrimaryConstrain
|
|
|
309
458
|
} ? A : never;
|
|
310
459
|
type IsTupleOfLength1<T extends readonly any[]> = T extends readonly [any] ? true : false;
|
|
311
460
|
type PrimaryKeyValue<S extends DBSchema, TN extends string> = PrimaryKeyColumns<S, TN> extends infer PK extends readonly string[] ? PK extends never ? never : IsTupleOfLength1<PK> extends true ? ColumnValueFor<S, TN, PK[0]> : { [K in PK[number]]: ColumnValueFor<S, TN, K> } : never;
|
|
312
|
-
type ColumnValueFromDef<C extends ColumnDef> = C["_is_array"] extends true ? PgArray<ScalarFromTypename<C["_typname"]>> : ScalarFromTypename<C["_typname"]>;
|
|
313
|
-
type NullableColumnValueFromDef<C extends ColumnDef> = C["is_nullable"] extends true ? ColumnValueFromDef<C> | null : ColumnValueFromDef<C>;
|
|
314
|
-
type ColumnDefByName<S extends DBSchema, TN extends string, K extends string> = Extract<ColumnsOf<S, TN>[number], {
|
|
315
|
-
name: K;
|
|
461
|
+
type ColumnValueFromDef<C$1 extends ColumnDef> = C$1["_is_array"] extends true ? PgArray<ScalarFromTypename<C$1["_typname"]>> : ScalarFromTypename<C$1["_typname"]>;
|
|
462
|
+
type NullableColumnValueFromDef<C$1 extends ColumnDef> = C$1["is_nullable"] extends true ? ColumnValueFromDef<C$1> | null : ColumnValueFromDef<C$1>;
|
|
463
|
+
type ColumnDefByName<S extends DBSchema, TN extends string, K$1 extends string> = Extract<ColumnsOf<S, TN>[number], {
|
|
464
|
+
name: K$1;
|
|
316
465
|
}>;
|
|
317
|
-
type ColumnValueFor<S extends DBSchema, TN extends string, K extends string> = NullableColumnValueFromDef<ColumnDefByName<S, TN, K>>;
|
|
466
|
+
type ColumnValueFor<S extends DBSchema, TN extends string, K$1 extends string> = NullableColumnValueFromDef<ColumnDefByName<S, TN, K$1>>;
|
|
318
467
|
type ValuesForTable<S extends DBSchema, TN extends string> = Partial<{ [K in ColumnNames<S, TN>]: NullableColumnValueFromDef<Extract<ColumnsOf<S, TN>[number], {
|
|
319
468
|
name: K;
|
|
320
469
|
}>> }>;
|
|
@@ -324,15 +473,15 @@ type WhereForTable<S extends DBSchema, TN extends string> = Partial<{ [K in Colu
|
|
|
324
473
|
name: K;
|
|
325
474
|
}>>[] }>;
|
|
326
475
|
type WhereOperator = "=" | "!=" | "<" | "<=" | ">" | ">=" | "like" | "ilike" | "notlike" | "notilike" | "in" | "notin" | "isnull" | "notnull";
|
|
327
|
-
type OpPredicateForCol<S extends DBSchema, TN extends string, K extends ColumnNames<S, TN>> = readonly [K, "isnull" | "notnull"] | readonly [K, "like" | "ilike" | "notlike" | "notilike", string] | readonly [K, "in" | "notin", ReadonlyArray<ColumnValueFor<S, TN, K>>] | readonly [K, "=" | "!=" | "<" | "<=" | ">" | ">=", ColumnValueFor<S, TN, K>];
|
|
476
|
+
type OpPredicateForCol<S extends DBSchema, TN extends string, K$1 extends ColumnNames<S, TN>> = readonly [K$1, "isnull" | "notnull"] | readonly [K$1, "like" | "ilike" | "notlike" | "notilike", string] | readonly [K$1, "in" | "notin", ReadonlyArray<ColumnValueFor<S, TN, K$1>>] | readonly [K$1, "=" | "!=" | "<" | "<=" | ">" | ">=", ColumnValueFor<S, TN, K$1>];
|
|
328
477
|
type OpPredicate<S extends DBSchema, TN extends string> = { [K in ColumnNames<S, TN>]: OpPredicateForCol<S, TN, K> }[ColumnNames<S, TN>];
|
|
329
478
|
type IsAny<T> = 0 extends (1 & T) ? true : false;
|
|
330
|
-
type OpArgsFor<S extends DBSchema, TN extends string, K extends ColumnNames<S, TN>, O extends WhereOperator> = IsAny<O> extends true ? never[] : O extends "isnull" | "notnull" ? [] : O extends "like" | "ilike" | "notlike" | "notilike" ? [value: string] : O extends "in" | "notin" ? [value: ReadonlyArray<ColumnValueFor<S, TN, K>>] : O extends "=" | "!=" | "<" | "<=" | ">" | ">=" ? [value: ColumnValueFor<S, TN, K>] : never[];
|
|
479
|
+
type OpArgsFor<S extends DBSchema, TN extends string, K$1 extends ColumnNames<S, TN>, O extends WhereOperator> = IsAny<O> extends true ? never[] : O extends "isnull" | "notnull" ? [] : O extends "like" | "ilike" | "notlike" | "notilike" ? [value: string] : O extends "in" | "notin" ? [value: ReadonlyArray<ColumnValueFor<S, TN, K$1>>] : O extends "=" | "!=" | "<" | "<=" | ">" | ">=" ? [value: ColumnValueFor<S, TN, K$1>] : never[];
|
|
331
480
|
interface SqlBuilder<S extends DBSchema> {
|
|
332
481
|
table: <TN extends TableNames<S>>(name: TN) => TableQuery<S, TN>;
|
|
333
482
|
}
|
|
334
483
|
type RowForTable<S extends DBSchema, TN extends string> = { [K in ColumnNames<S, TN>]: ColumnValueFor<S, TN, K> };
|
|
335
|
-
type PickRow<S extends DBSchema, TN extends string, C extends ReadonlyArray<ColumnNames<S, TN>>> = { [K in C[number]]: ColumnValueFor<S, TN, K> };
|
|
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> };
|
|
336
485
|
type RowOfSelect<Q> = Q extends {
|
|
337
486
|
toSql: () => TypedSqlRequest<infer R>;
|
|
338
487
|
} ? R : never;
|
|
@@ -341,67 +490,663 @@ type RowOfRequest<Rq> = Rq extends TypedSqlRequest<infer R> ? R : never;
|
|
|
341
490
|
type RowsOfRequest<Rq> = RowOfRequest<Rq>[];
|
|
342
491
|
interface TableQuery<S extends DBSchema, TN extends string> {
|
|
343
492
|
select(): SelectQuery<S, TN, RowForTable<S, TN>>;
|
|
344
|
-
select<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): SelectQuery<S, TN, PickRow<S, TN, C>>;
|
|
493
|
+
select<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): SelectQuery<S, TN, PickRow<S, TN, C$1>>;
|
|
345
494
|
insert: (values: ValuesForTable<S, TN>) => InsertQuery<S, TN>;
|
|
346
495
|
update: (values: Partial<ValuesForTable<S, TN>>) => UpdateQuery<S, TN>;
|
|
347
496
|
delete: () => DeleteQuery<S, TN>;
|
|
348
497
|
}
|
|
349
|
-
interface SelectQuery<S extends DBSchema, TN extends string, R extends DataRow> {
|
|
350
|
-
selectFrom: <JT extends TableNames<S>>(table: JT, cols?: ReadonlyArray<ColumnNames<S, JT>>) => SelectQuery<S, TN, R>;
|
|
351
|
-
andWhere: (where: WhereForTable<S, TN>) => SelectQuery<S, TN, R>;
|
|
498
|
+
interface SelectQuery<S extends DBSchema, TN extends string, R$1 extends DataRow> {
|
|
499
|
+
selectFrom: <JT extends TableNames<S>>(table: JT, cols?: ReadonlyArray<ColumnNames<S, JT>>) => SelectQuery<S, TN, R$1>;
|
|
500
|
+
andWhere: (where: WhereForTable<S, TN>) => SelectQuery<S, TN, R$1>;
|
|
352
501
|
/** @deprecated Use andWhere() instead */
|
|
353
|
-
where: (where: WhereForTable<S, TN>) => SelectQuery<S, TN, R>;
|
|
354
|
-
orWhere: (where: WhereForTable<S, TN>) => SelectQuery<S, TN, R>;
|
|
355
|
-
wherePk: (pk: PrimaryKeyValue<S, TN>) => SelectQuery<S, TN, R>;
|
|
356
|
-
andWhereOp<K extends ColumnNames<S, TN>, O extends WhereOperator>(col: K, op: O, ...args: OpArgsFor<S, TN, K, O>): SelectQuery<S, TN, R>;
|
|
357
|
-
orWhereOp<K extends ColumnNames<S, TN>, O extends WhereOperator>(col: K, op: O, ...args: OpArgsFor<S, TN, K, O>): SelectQuery<S, TN, R>;
|
|
358
|
-
andWhereOpGroup: (predicates: ReadonlyArray<OpPredicate<S, TN>>) => SelectQuery<S, TN, R>;
|
|
359
|
-
orWhereOpGroup: (predicates: ReadonlyArray<OpPredicate<S, TN>>) => SelectQuery<S, TN, R>;
|
|
360
|
-
orderBy: (order: ReadonlyArray<readonly [ColumnNames<S, TN>, "asc" | "desc"]> | ColumnNames<S, TN>) => SelectQuery<S, TN, R>;
|
|
361
|
-
limit: (n: number) => SelectQuery<S, TN, R>;
|
|
362
|
-
offset: (n: number) => SelectQuery<S, TN, R>;
|
|
363
|
-
join: <JT extends TableNames<S>>(table: JT, type?: "inner" | "left" | "right" | "full") => SelectQuery<S, TN, R>;
|
|
364
|
-
toSql: () => TypedSqlRequest<R>;
|
|
365
|
-
}
|
|
366
|
-
interface InsertReturningQuery<S extends DBSchema, TN extends string, R extends DataRow> {
|
|
502
|
+
where: (where: WhereForTable<S, TN>) => SelectQuery<S, TN, R$1>;
|
|
503
|
+
orWhere: (where: WhereForTable<S, TN>) => SelectQuery<S, TN, R$1>;
|
|
504
|
+
wherePk: (pk: PrimaryKeyValue<S, TN>) => SelectQuery<S, TN, R$1>;
|
|
505
|
+
andWhereOp<K$1 extends ColumnNames<S, TN>, O extends WhereOperator>(col: K$1, op: O, ...args: OpArgsFor<S, TN, K$1, O>): SelectQuery<S, TN, R$1>;
|
|
506
|
+
orWhereOp<K$1 extends ColumnNames<S, TN>, O extends WhereOperator>(col: K$1, op: O, ...args: OpArgsFor<S, TN, K$1, O>): SelectQuery<S, TN, R$1>;
|
|
507
|
+
andWhereOpGroup: (predicates: ReadonlyArray<OpPredicate<S, TN>>) => SelectQuery<S, TN, R$1>;
|
|
508
|
+
orWhereOpGroup: (predicates: ReadonlyArray<OpPredicate<S, TN>>) => SelectQuery<S, TN, R$1>;
|
|
509
|
+
orderBy: (order: ReadonlyArray<readonly [ColumnNames<S, TN>, "asc" | "desc"]> | ColumnNames<S, TN>) => SelectQuery<S, TN, R$1>;
|
|
510
|
+
limit: (n: number) => SelectQuery<S, TN, R$1>;
|
|
511
|
+
offset: (n: number) => SelectQuery<S, TN, R$1>;
|
|
512
|
+
join: <JT extends TableNames<S>>(table: JT, type?: "inner" | "left" | "right" | "full") => SelectQuery<S, TN, R$1>;
|
|
513
|
+
toSql: () => TypedSqlRequest<R$1>;
|
|
514
|
+
}
|
|
515
|
+
interface InsertReturningQuery<S extends DBSchema, TN extends string, R$1 extends DataRow> {
|
|
367
516
|
returning(): InsertReturningQuery<S, TN, RowForTable<S, TN>>;
|
|
368
|
-
returning<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): InsertReturningQuery<S, TN, PickRow<S, TN, C>>;
|
|
369
|
-
toSql(): TypedSqlRequest<R>;
|
|
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>;
|
|
370
519
|
}
|
|
371
|
-
interface UpdateReturningQuery<S extends DBSchema, TN extends string, R extends DataRow> {
|
|
372
|
-
where: (where: WhereForTable<S, TN>) => UpdateReturningQuery<S, TN, R>;
|
|
373
|
-
wherePk: (pk: PrimaryKeyValue<S, TN>) => UpdateReturningQuery<S, TN, R>;
|
|
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>;
|
|
374
523
|
returning(): UpdateReturningQuery<S, TN, RowForTable<S, TN>>;
|
|
375
|
-
returning<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): UpdateReturningQuery<S, TN, PickRow<S, TN, C>>;
|
|
376
|
-
toSql(): TypedSqlRequest<R>;
|
|
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>;
|
|
377
526
|
}
|
|
378
|
-
interface DeleteReturningQuery<S extends DBSchema, TN extends string, R extends DataRow> {
|
|
379
|
-
where: (where: WhereForTable<S, TN>) => DeleteReturningQuery<S, TN, R>;
|
|
380
|
-
wherePk: (pk: PrimaryKeyValue<S, TN>) => DeleteReturningQuery<S, TN, R>;
|
|
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>;
|
|
381
530
|
returning(): DeleteReturningQuery<S, TN, RowForTable<S, TN>>;
|
|
382
|
-
returning<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): DeleteReturningQuery<S, TN, PickRow<S, TN, C>>;
|
|
383
|
-
toSql(): TypedSqlRequest<R>;
|
|
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>;
|
|
384
533
|
}
|
|
385
534
|
interface InsertQuery<S extends DBSchema, TN extends string> {
|
|
386
535
|
returning(): InsertReturningQuery<S, TN, RowForTable<S, TN>>;
|
|
387
|
-
returning<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): InsertReturningQuery<S, TN, PickRow<S, TN, C>>;
|
|
536
|
+
returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): InsertReturningQuery<S, TN, PickRow<S, TN, C$1>>;
|
|
388
537
|
toSql(): SqlRequest<Record<string, unknown>>;
|
|
389
538
|
}
|
|
390
539
|
interface UpdateQuery<S extends DBSchema, TN extends string> {
|
|
391
540
|
where: (where: WhereForTable<S, TN>) => UpdateQuery<S, TN>;
|
|
392
541
|
wherePk: (pk: PrimaryKeyValue<S, TN>) => UpdateQuery<S, TN>;
|
|
393
542
|
returning(): UpdateReturningQuery<S, TN, RowForTable<S, TN>>;
|
|
394
|
-
returning<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): UpdateReturningQuery<S, TN, PickRow<S, TN, C>>;
|
|
543
|
+
returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): UpdateReturningQuery<S, TN, PickRow<S, TN, C$1>>;
|
|
395
544
|
toSql(): SqlRequest<Record<string, unknown>>;
|
|
396
545
|
}
|
|
397
546
|
interface DeleteQuery<S extends DBSchema, TN extends string> {
|
|
398
547
|
where: (where: WhereForTable<S, TN>) => DeleteQuery<S, TN>;
|
|
399
548
|
wherePk: (pk: PrimaryKeyValue<S, TN>) => DeleteQuery<S, TN>;
|
|
400
549
|
returning(): DeleteReturningQuery<S, TN, RowForTable<S, TN>>;
|
|
401
|
-
returning<C extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C): DeleteReturningQuery<S, TN, PickRow<S, TN, C>>;
|
|
550
|
+
returning<C$1 extends ReadonlyArray<ColumnNames<S, TN>>>(cols: C$1): DeleteReturningQuery<S, TN, PickRow<S, TN, C$1>>;
|
|
402
551
|
toSql(): SqlRequest<Record<string, unknown>>;
|
|
403
552
|
}
|
|
404
553
|
declare function createSqlBuilder<S extends DBSchema>(schema: S): SqlBuilder<S>;
|
|
405
554
|
//#endregion
|
|
406
|
-
|
|
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
|
|
1142
|
+
//#region src/index.d.ts
|
|
1143
|
+
/**
|
|
1144
|
+
* @author Martin Høgh <mh@mapcentia.com>
|
|
1145
|
+
* @copyright 2013-2026 MapCentia ApS
|
|
1146
|
+
* @license https://opensource.org/license/mit The MIT License
|
|
1147
|
+
*
|
|
1148
|
+
*/
|
|
1149
|
+
|
|
1150
|
+
//#endregion
|
|
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 };
|
|
407
1152
|
//# sourceMappingURL=centia-io-sdk.d.ts.map
|