prostgles-types 3.0.24 → 3.0.26

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/dist/files.d.ts CHANGED
@@ -68,9 +68,9 @@ export declare const CONTENT_TYPE_TO_EXT: {
68
68
  readonly "video/mp4": readonly ["m4v", "mp4"];
69
69
  readonly "video/webm": readonly ["webm"];
70
70
  };
71
- export declare type ALLOWED_CONTENT_TYPE = keyof typeof CONTENT_TYPE_TO_EXT;
72
- export declare type ALLOWED_EXTENSION = (typeof CONTENT_TYPE_TO_EXT)[ALLOWED_CONTENT_TYPE][number];
73
- export declare type FileType = {
71
+ export type ALLOWED_CONTENT_TYPE = keyof typeof CONTENT_TYPE_TO_EXT;
72
+ export type ALLOWED_EXTENSION = (typeof CONTENT_TYPE_TO_EXT)[ALLOWED_CONTENT_TYPE][number];
73
+ export type FileType = {
74
74
  acceptedContent: FieldFilter<{
75
75
  "image": 1;
76
76
  "audio": 1;
@@ -83,7 +83,7 @@ export declare type FileType = {
83
83
  } | {
84
84
  acceptedFileTypes: FieldFilter<Record<ALLOWED_EXTENSION, 1>>;
85
85
  } | never;
86
- export declare type FileColumnConfig = FileType & {
86
+ export type FileColumnConfig = FileType & {
87
87
  maxFileSizeMB?: number;
88
88
  };
89
89
  //# sourceMappingURL=files.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../lib/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAEhC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoEtB,CAAC;AAEX,oBAAY,oBAAoB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AACpE,oBAAY,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CA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AAiB,EAAE,WAAW,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,GACjE,KAAK,CAAC;AAER,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
package/dist/filters.d.ts CHANGED
@@ -65,72 +65,72 @@ export declare const JsonbOperands: {
65
65
  };
66
66
  };
67
67
  export declare const JsonbFilterKeys: ("@>" | "<@" | "?" | "?|" | "?&" | "||" | "-" | "#-" | "@?" | "@@")[];
68
- export declare type CompareFilter<T = Date | number | string | boolean> = T | ExactlyOne<Record<typeof CompareFilterKeys[number], T>> | ExactlyOne<Record<typeof CompareInFilterKeys[number], T[]>> | {
68
+ export type CompareFilter<T = Date | number | string | boolean> = T | ExactlyOne<Record<typeof CompareFilterKeys[number], T>> | ExactlyOne<Record<typeof CompareInFilterKeys[number], T[]>> | {
69
69
  "$between": [T, T];
70
70
  };
71
71
  export declare const TextFilterKeys: readonly ["$ilike", "$like", "$nilike", "$nlike"];
72
72
  export declare const TextFilterFTSKeys: readonly ["@@", "@>", "<@", "$contains", "$containedBy"];
73
73
  export declare const TextFilter_FullTextSearchFilterKeys: readonly ["to_tsquery", "plainto_tsquery", "phraseto_tsquery", "websearch_to_tsquery"];
74
- export declare type FullTextSearchFilter = ExactlyOne<Record<typeof TextFilter_FullTextSearchFilterKeys[number], string[]>>;
75
- export declare type TextFilter = CompareFilter<string> | ExactlyOne<Record<typeof TextFilterKeys[number], string>> | ExactlyOne<Record<typeof TextFilterFTSKeys[number], FullTextSearchFilter>>;
74
+ export type FullTextSearchFilter = ExactlyOne<Record<typeof TextFilter_FullTextSearchFilterKeys[number], string[]>>;
75
+ export type TextFilter = CompareFilter<string> | ExactlyOne<Record<typeof TextFilterKeys[number], string>> | ExactlyOne<Record<typeof TextFilterFTSKeys[number], FullTextSearchFilter>>;
76
76
  export declare const ArrayFilterOperands: readonly ["@@", "@>", "<@", "$contains", "$containedBy", "&&", "$overlaps"];
77
- export declare type ArrayFilter<T = (number | boolean | string)[]> = CompareFilter<T> | ExactlyOne<Record<typeof ArrayFilterOperands[number], T>>;
78
- export declare type GeoBBox = {
77
+ export type ArrayFilter<T = (number | boolean | string)[]> = CompareFilter<T> | ExactlyOne<Record<typeof ArrayFilterOperands[number], T>>;
78
+ export type GeoBBox = {
79
79
  ST_MakeEnvelope: number[];
80
80
  };
81
- export declare type GeomFilter = {
81
+ export type GeomFilter = {
82
82
  "&&": GeoBBox;
83
83
  } | {
84
84
  "@": GeoBBox;
85
85
  };
86
86
  export declare const GeomFilterKeys: readonly ["~", "~=", "@", "|&>", "|>>", ">>", "=", "<<|", "<<", "&>", "&<|", "&<", "&&&", "&&"];
87
87
  export declare const GeomFilter_Funcs: readonly ["ST_MakeEnvelope", "st_makeenvelope", "ST_MakePolygon", "st_makepolygon"];
88
- export declare type AllowedTSTypes = string | number | boolean | Date | any[];
89
- export declare type AnyObject = {
88
+ export type AllowedTSTypes = string | number | boolean | Date | any[];
89
+ export type AnyObject = {
90
90
  [key: string]: any;
91
91
  };
92
- export declare type FilterDataType<T = any> = T extends string ? TextFilter : T extends number ? CompareFilter<T> : T extends boolean ? CompareFilter<T> : T extends Date ? CompareFilter<T> : T extends any[] ? ArrayFilter<T> : (CompareFilter<T> | ArrayFilter<T> | TextFilter | GeomFilter);
92
+ export type FilterDataType<T = any> = T extends string ? TextFilter : T extends number ? CompareFilter<T> : T extends boolean ? CompareFilter<T> : T extends Date ? CompareFilter<T> : T extends any[] ? ArrayFilter<T> : (CompareFilter<T> | ArrayFilter<T> | TextFilter | GeomFilter);
93
93
  export declare const EXISTS_KEYS: readonly ["$exists", "$notExists", "$existsJoined", "$notExistsJoined"];
94
- export declare type EXISTS_KEY = typeof EXISTS_KEYS[number];
94
+ export type EXISTS_KEY = typeof EXISTS_KEYS[number];
95
95
  export declare const COMPLEX_FILTER_KEY: "$filter";
96
- export declare type ComplexFilter = Record<typeof COMPLEX_FILTER_KEY, [
96
+ export type ComplexFilter = Record<typeof COMPLEX_FILTER_KEY, [
97
97
  {
98
98
  [funcName: string]: any[];
99
99
  },
100
100
  string?,
101
101
  any?
102
102
  ]>;
103
- declare type BasicFilter<Field extends string, DataType extends any> = Partial<{
103
+ type BasicFilter<Field extends string, DataType extends any> = Partial<{
104
104
  [K in Extract<typeof CompareFilterKeys[number], string> as `${Field}.${K}`]: DataType;
105
105
  }> | Partial<{
106
106
  [K in Extract<typeof CompareInFilterKeys[number], string> as `${Field}.${K}`]: DataType[];
107
107
  }>;
108
- declare type StringFilter<Field extends string, DataType extends any> = BasicFilter<Field, DataType> & (Partial<{
108
+ type StringFilter<Field extends string, DataType extends any> = BasicFilter<Field, DataType> & (Partial<{
109
109
  [K in Extract<typeof TextFilterKeys[number], string> as `${Field}.${K}`]: DataType;
110
110
  }> | Partial<{
111
111
  [K in Extract<typeof TextFilterFTSKeys[number], string> as `${Field}.${K}`]: any;
112
112
  }>);
113
- export declare type ValueOf<T> = T[keyof T];
114
- declare type ShorthandFilter<Obj extends Record<string, any>> = ValueOf<{
113
+ export type ValueOf<T> = T[keyof T];
114
+ type ShorthandFilter<Obj extends Record<string, any>> = ValueOf<{
115
115
  [K in keyof Obj]: Obj[K] extends string ? StringFilter<K, Required<Obj>[K]> : BasicFilter<K, Required<Obj>[K]>;
116
116
  }>;
117
- export declare type FilterForObject<T extends AnyObject = AnyObject> = {
117
+ export type FilterForObject<T extends AnyObject = AnyObject> = {
118
118
  [K in keyof Partial<T>]: FilterDataType<T[K]>;
119
119
  } | ShorthandFilter<T>;
120
- export declare type ExistsFilter<S = void> = Partial<{
120
+ export type ExistsFilter<S = void> = Partial<{
121
121
  [key in EXISTS_KEY]: S extends DBSchema ? ExactlyOne<{
122
122
  [tname in keyof S]: FullFilter<S[tname]["columns"], S>;
123
123
  }> : {
124
124
  [key: string]: FullFilter;
125
125
  };
126
126
  }>;
127
- export declare type FilterItem<T extends AnyObject = AnyObject> = FilterForObject<T>;
128
- export declare type FullFilter<T extends AnyObject = AnyObject, S = void> = {
127
+ export type FilterItem<T extends AnyObject = AnyObject> = FilterForObject<T>;
128
+ export type FullFilter<T extends AnyObject = AnyObject, S = void> = {
129
129
  $and: FullFilter<T>[];
130
130
  } | {
131
131
  $or: FullFilter<T>[];
132
132
  } | FilterItem<T> | ExistsFilter<S>;
133
- export declare type FullFilterBasic<T = {
133
+ export type FullFilterBasic<T = {
134
134
  [key: string]: any;
135
135
  }> = {
136
136
  [key in keyof Partial<T & {
@@ -1 +1 @@
1
- {"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../lib/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAW,MAAM,QAAQ,CAAC;AAG7C,eAAO,MAAM,iBAAiB,wFAA+E,CAAC;AAC9G,eAAO,MAAM,mBAAmB,0BAA2B,CAAC;AAE5D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DhB,CAAC;AAEX,eAAO,MAAM,eAAe,uEAAyB,CAAC;AAKrD,oBAAY,aAAa,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,IAI5D,CAAC,GACD,UAAU,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAEvD,UAAU,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC3D;IAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;CAAE,CACxB;AACD,eAAO,MAAM,cAAc,mDAAoD,CAAC;AAEhF,eAAO,MAAM,iBAAiB,0DAA2D,CAAC;AAE1F,eAAO,MAAM,mCAAmC,wFAAsF,CAAC;AACvI,oBAAY,oBAAoB,GAC7B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A;AAMF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAClD,eAAe,CAAC,CAAC,CAAC,CAAA;AAOtB,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,CAAC,GAAG,IAAI,IAC7D;IAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,GACzB;IAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,GACxB,UAAU,CAAC,CAAC,CAAC,GACb,YAAY,CAAC,CAAC,CAAC,CAIjB;AAsBD,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,IAAI;KACvD,GAAG,IAAI,MAAM,OAAO,CAAC,CAAC,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,GAAG,GAAG;CACxD,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { FullFilter, AnyObject, FullFilterBasic, ValueOf, ComplexFilter } from "./filters";
2
2
  import { FileColumnConfig } from "./files";
3
+ import { JSONB } from "./jsonb";
3
4
  export declare const _PG_strings: readonly ["bpchar", "char", "varchar", "text", "citext", "uuid", "bytea", "time", "timetz", "interval", "name", "cidr", "inet", "macaddr", "macaddr8", "int4range", "int8range", "numrange", "tsvector"];
4
5
  export declare const _PG_numbers: readonly ["int2", "int4", "int8", "float4", "float8", "numeric", "money", "oid"];
5
6
  export declare const _PG_json: readonly ["json", "jsonb"];
@@ -7,7 +8,7 @@ export declare const _PG_bool: readonly ["bool"];
7
8
  export declare const _PG_date: readonly ["date", "timestamp", "timestamptz"];
8
9
  export declare const _PG_postgis: readonly ["geometry", "geography"];
9
10
  export declare const _PG_geometric: readonly ["point", "line", "lseg", "box", "path", "polygon", "circle"];
10
- export declare type PG_COLUMN_UDT_DATA_TYPE = typeof _PG_strings[number] | typeof _PG_numbers[number] | typeof _PG_geometric[number] | typeof _PG_json[number] | typeof _PG_bool[number] | typeof _PG_date[number] | typeof _PG_postgis[number];
11
+ export type PG_COLUMN_UDT_DATA_TYPE = typeof _PG_strings[number] | typeof _PG_numbers[number] | typeof _PG_geometric[number] | typeof _PG_json[number] | typeof _PG_bool[number] | typeof _PG_date[number] | typeof _PG_postgis[number];
11
12
  export declare const TS_PG_Types: {
12
13
  readonly string: readonly ["bpchar", "char", "varchar", "text", "citext", "uuid", "bytea", "time", "timetz", "interval", "name", "cidr", "inet", "macaddr", "macaddr8", "int4range", "int8range", "numrange", "tsvector", "lseg"];
13
14
  readonly number: readonly ["int2", "int4", "int8", "float4", "float8", "numeric", "money", "oid"];
@@ -20,8 +21,8 @@ export declare const TS_PG_Types: {
20
21
  readonly "Array<Date>": string[];
21
22
  readonly any: readonly [];
22
23
  };
23
- export declare type TS_COLUMN_DATA_TYPES = keyof typeof TS_PG_Types;
24
- export declare type DBTableSchema = {
24
+ export type TS_COLUMN_DATA_TYPES = keyof typeof TS_PG_Types;
25
+ export type DBTableSchema = {
25
26
  is_view?: boolean;
26
27
  select?: boolean;
27
28
  insert?: boolean;
@@ -29,10 +30,10 @@ export declare type DBTableSchema = {
29
30
  delete?: boolean;
30
31
  columns: AnyObject;
31
32
  };
32
- export declare type DBSchema = {
33
+ export type DBSchema = {
33
34
  [tov_name: string]: DBTableSchema;
34
35
  };
35
- export declare type ColumnInfo = {
36
+ export type ColumnInfo = {
36
37
  name: string;
37
38
  label: string;
38
39
  comment: string;
@@ -53,10 +54,10 @@ export declare type ColumnInfo = {
53
54
  min?: string | number;
54
55
  max?: string | number;
55
56
  hint?: string;
56
- jsonSchema?: AnyObject;
57
+ jsonbSchema?: JSONB.JSONBSchema;
57
58
  file?: FileColumnConfig;
58
59
  };
59
- export declare type ValidatedColumnInfo = ColumnInfo & {
60
+ export type ValidatedColumnInfo = ColumnInfo & {
60
61
  tsDataType: TS_COLUMN_DATA_TYPES;
61
62
  select: boolean;
62
63
  orderBy: boolean;
@@ -65,14 +66,14 @@ export declare type ValidatedColumnInfo = ColumnInfo & {
65
66
  update: boolean;
66
67
  delete: boolean;
67
68
  };
68
- export declare type DBSchemaTable = {
69
+ export type DBSchemaTable = {
69
70
  name: string;
70
71
  info: TableInfo;
71
72
  columns: ValidatedColumnInfo[];
72
73
  };
73
- export declare type FieldFilter<T extends AnyObject = AnyObject> = SelectTyped<T>;
74
- export declare type AscOrDesc = 1 | -1 | boolean;
75
- export declare type _OrderBy<T = AnyObject> = {
74
+ export type FieldFilter<T extends AnyObject = AnyObject> = SelectTyped<T>;
75
+ export type AscOrDesc = 1 | -1 | boolean;
76
+ export type _OrderBy<T = AnyObject> = {
76
77
  [K in keyof Partial<T>]: AscOrDesc;
77
78
  } | {
78
79
  [K in keyof Partial<T>]: AscOrDesc;
@@ -82,22 +83,22 @@ export declare type _OrderBy<T = AnyObject> = {
82
83
  nulls?: "last" | "first";
83
84
  nullEmpty?: boolean;
84
85
  }[] | Array<keyof T> | keyof T;
85
- export declare type OrderBy<T = AnyObject> = _OrderBy<T> | _OrderBy<AnyObject>;
86
- declare type CommonSelect = "*" | "" | {
86
+ export type OrderBy<T = AnyObject> = _OrderBy<T> | _OrderBy<AnyObject>;
87
+ type CommonSelect = "*" | "" | {
87
88
  "*": 1;
88
89
  };
89
- export declare type SelectTyped<T extends AnyObject> = {
90
+ export type SelectTyped<T extends AnyObject> = {
90
91
  [K in keyof Partial<T>]: 1 | true;
91
92
  } | {
92
93
  [K in keyof Partial<T>]: 0 | false;
93
94
  } | (keyof T)[] | CommonSelect;
94
95
  export declare const JOIN_KEYS: readonly ["$innerJoin", "$leftJoin"];
95
96
  export declare const JOIN_PARAMS: readonly ["select", "filter", "$path", "$condition", "offset", "limit", "orderBy"];
96
- export declare type JoinCondition = {
97
+ export type JoinCondition = {
97
98
  column: string;
98
99
  rootColumn: string;
99
100
  } | ComplexFilter;
100
- export declare type DetailedJoinSelect = Record<typeof JOIN_KEYS[number], {
101
+ export type DetailedJoinSelect = Record<typeof JOIN_KEYS[number], {
101
102
  select: Select;
102
103
  filter?: FullFilter;
103
104
  offset?: number;
@@ -110,9 +111,9 @@ export declare type DetailedJoinSelect = Record<typeof JOIN_KEYS[number], {
110
111
  $path?: undefined;
111
112
  $condition: JoinCondition[];
112
113
  })>;
113
- export declare type JoinSelect = "*" | Record<string, Record<string, any>> | DetailedJoinSelect;
114
- declare type FunctionSelect = Record<string, Record<string, any[]>>;
115
- declare type SelectFuncs<T extends AnyObject = any> = T extends AnyObject ? (({
114
+ export type JoinSelect = "*" | Record<string, Record<string, any>> | DetailedJoinSelect;
115
+ type FunctionSelect = Record<string, Record<string, any[]>>;
116
+ type SelectFuncs<T extends AnyObject = any> = T extends AnyObject ? (({
116
117
  [K in keyof Partial<T>]: true | 1 | string;
117
118
  } & FunctionSelect) | JoinSelect | FunctionSelect | {
118
119
  [K in keyof Partial<T>]: true | 1 | string;
@@ -123,58 +124,58 @@ declare type SelectFuncs<T extends AnyObject = any> = T extends AnyObject ? (({
123
124
  } | {
124
125
  [K in keyof Partial<T>]: 0 | false;
125
126
  } | CommonSelect);
126
- export declare type Select<T extends AnyObject = any> = T extends AnyObject ? (SelectFuncs<T & {
127
+ export type Select<T extends AnyObject = any> = T extends AnyObject ? (SelectFuncs<T & {
127
128
  $rowhash: string;
128
129
  }>) : (AnyObject | CommonSelect | SelectFuncs);
129
- export declare type SelectBasic = {
130
+ export type SelectBasic = {
130
131
  [key: string]: any;
131
132
  } | {} | undefined | "" | "*";
132
- declare type CommonSelectParams = {
133
+ type CommonSelectParams = {
133
134
  limit?: number;
134
135
  offset?: number;
135
136
  groupBy?: boolean;
136
137
  returnType?: "row" | "value" | "values" | "statement";
137
138
  };
138
- export declare type SelectParams<T extends AnyObject = any> = CommonSelectParams & {
139
+ export type SelectParams<T extends AnyObject = any> = CommonSelectParams & {
139
140
  select?: Select<T>;
140
141
  orderBy?: OrderBy<T>;
141
142
  };
142
- export declare type SubscribeParams<T extends AnyObject = any> = SelectParams<T> & {
143
+ export type SubscribeParams<T extends AnyObject = any> = SelectParams<T> & {
143
144
  throttle?: number;
144
145
  };
145
- export declare type UpdateParams<T extends AnyObject = any> = {
146
+ export type UpdateParams<T extends AnyObject = any> = {
146
147
  returning?: Select<T>;
147
148
  onConflictDoNothing?: boolean;
148
149
  fixIssues?: boolean;
149
150
  multi?: boolean;
150
151
  };
151
- export declare type InsertParams<T extends AnyObject = any> = {
152
+ export type InsertParams<T extends AnyObject = any> = {
152
153
  returning?: Select<T>;
153
154
  onConflictDoNothing?: boolean;
154
155
  fixIssues?: boolean;
155
156
  };
156
- export declare type DeleteParams<T extends AnyObject = any> = {
157
+ export type DeleteParams<T extends AnyObject = any> = {
157
158
  returning?: Select<T>;
158
159
  };
159
- export declare type SubscribeParamsBasic = CommonSelectParams & {
160
+ export type SubscribeParamsBasic = CommonSelectParams & {
160
161
  throttle?: number;
161
162
  };
162
- export declare type UpdateParamsBasic = {
163
+ export type UpdateParamsBasic = {
163
164
  returning?: SelectBasic;
164
165
  onConflictDoNothing?: boolean;
165
166
  fixIssues?: boolean;
166
167
  multi?: boolean;
167
168
  };
168
- export declare type InsertParamsBasic = {
169
+ export type InsertParamsBasic = {
169
170
  returning?: SelectBasic;
170
171
  onConflictDoNothing?: boolean;
171
172
  fixIssues?: boolean;
172
173
  };
173
- export declare type DeleteParamsBasic = {
174
+ export type DeleteParamsBasic = {
174
175
  returning?: SelectBasic;
175
176
  };
176
- export declare type PartialLax<T = AnyObject> = Partial<T> & AnyObject;
177
- export declare type TableInfo = {
177
+ export type PartialLax<T = AnyObject> = Partial<T> & AnyObject;
178
+ export type TableInfo = {
178
179
  oid: number;
179
180
  comment?: string;
180
181
  is_media?: boolean;
@@ -189,14 +190,14 @@ export declare type TableInfo = {
189
190
  label?: string;
190
191
  };
191
192
  };
192
- export declare type OnError = (err: any) => void;
193
- declare type JoinedSelect = Record<string, Select>;
194
- declare type ParseSelect<Select extends SelectParams<TD>["select"], TD extends AnyObject> = (Select extends {
193
+ export type OnError = (err: any) => void;
194
+ type JoinedSelect = Record<string, Select>;
195
+ type ParseSelect<Select extends SelectParams<TD>["select"], TD extends AnyObject> = (Select extends {
195
196
  "*": 1;
196
197
  } ? Required<TD> : {}) & {
197
198
  [Key in keyof Omit<Select, "*">]: Select[Key] extends 1 ? Required<TD>[Key] : Select[Key] extends Record<string, any[]> ? any : Select[Key] extends JoinedSelect ? any[] : any;
198
199
  };
199
- declare type GetSelectDataType<O extends SelectParams<TD>, TD extends AnyObject> = O extends {
200
+ type GetSelectDataType<O extends SelectParams<TD>, TD extends AnyObject> = O extends {
200
201
  returnType: "value";
201
202
  } ? any : O extends {
202
203
  returnType: "values";
@@ -212,10 +213,10 @@ declare type GetSelectDataType<O extends SelectParams<TD>, TD extends AnyObject>
212
213
  } ? Omit<Required<TD>, keyof O["select"]> : O extends {
213
214
  select: Record<string, any>;
214
215
  } ? ParseSelect<O["select"], Required<TD>> : Required<TD>;
215
- declare type GetSelectReturnType<O extends SelectParams<TD>, TD extends AnyObject, isMulti extends boolean> = O extends {
216
+ type GetSelectReturnType<O extends SelectParams<TD>, TD extends AnyObject, isMulti extends boolean> = O extends {
216
217
  returnType: "statement";
217
218
  } ? string : isMulti extends true ? GetSelectDataType<O, TD>[] : GetSelectDataType<O, TD>;
218
- declare type GetUpdateReturnType<O extends UpdateParams, TD extends AnyObject> = O extends {
219
+ type GetUpdateReturnType<O extends UpdateParams, TD extends AnyObject> = O extends {
219
220
  returning: "*";
220
221
  } ? Required<TD> : O extends {
221
222
  returning: "";
@@ -224,18 +225,18 @@ declare type GetUpdateReturnType<O extends UpdateParams, TD extends AnyObject> =
224
225
  } ? Pick<Required<TD>, keyof O["returning"]> : O extends {
225
226
  returning: Record<string, 0>;
226
227
  } ? Omit<Required<TD>, keyof O["returning"]> : void;
227
- export declare type SubscriptionHandler<T extends AnyObject = AnyObject> = {
228
+ export type SubscriptionHandler<T extends AnyObject = AnyObject> = {
228
229
  unsubscribe: () => Promise<any>;
229
230
  update?: (newData: T, updateParams: UpdateParams<T>) => Promise<any>;
230
231
  delete?: (deleteParams: DeleteParams<T>) => Promise<any>;
231
232
  filter: FullFilter<T> | {};
232
233
  };
233
- declare type GetColumns = (lang?: string, params?: {
234
+ type GetColumns = (lang?: string, params?: {
234
235
  rule: "update";
235
236
  data: AnyObject;
236
237
  filter: AnyObject;
237
238
  }) => Promise<ValidatedColumnInfo[]>;
238
- export declare type ViewHandler<TD extends AnyObject = AnyObject, S = void> = {
239
+ export type ViewHandler<TD extends AnyObject = AnyObject, S = void> = {
239
240
  getInfo?: (lang?: string) => Promise<TableInfo>;
240
241
  getColumns?: GetColumns;
241
242
  find: <P extends SelectParams<TD>>(filter?: FullFilter<TD, S>, selectParams?: P) => Promise<GetSelectReturnType<P, TD, true>>;
@@ -245,14 +246,14 @@ export declare type ViewHandler<TD extends AnyObject = AnyObject, S = void> = {
245
246
  count: (filter?: FullFilter<TD, S>) => Promise<number>;
246
247
  size: (filter?: FullFilter<TD>, selectParams?: SelectParams<TD>) => Promise<string>;
247
248
  };
248
- export declare type TableHandler<TD extends AnyObject = AnyObject, S = void> = ViewHandler<TD, S> & {
249
+ export type TableHandler<TD extends AnyObject = AnyObject, S = void> = ViewHandler<TD, S> & {
249
250
  update: <P extends UpdateParams<TD>>(filter: FullFilter<TD, S>, newData: PartialLax<TD>, params?: P) => Promise<GetUpdateReturnType<P, TD> | undefined>;
250
251
  updateBatch: (data: [FullFilter<TD, S>, PartialLax<TD>][], params?: UpdateParams<TD>) => Promise<PartialLax<TD> | void>;
251
252
  upsert: <P extends UpdateParams<TD>>(filter: FullFilter<TD, S>, newData: PartialLax<TD>, params?: P) => Promise<GetUpdateReturnType<P, TD>>;
252
253
  insert: <P extends UpdateParams<TD>>(data: (TD | TD[]), params?: P) => Promise<GetUpdateReturnType<P, TD>>;
253
254
  delete: <P extends DeleteParams<TD>>(filter?: FullFilter<TD, S>, params?: P) => Promise<GetUpdateReturnType<P, TD> | undefined>;
254
255
  };
255
- export declare type ViewHandlerBasic = {
256
+ export type ViewHandlerBasic = {
256
257
  getInfo?: (lang?: string) => Promise<TableInfo>;
257
258
  getColumns?: GetColumns;
258
259
  find: <TD = AnyObject>(filter?: FullFilterBasic, selectParams?: SelectParams) => Promise<PartialLax<TD>[]>;
@@ -266,28 +267,28 @@ export declare type ViewHandlerBasic = {
266
267
  count: (filter?: FullFilterBasic) => Promise<number>;
267
268
  size: (filter?: FullFilterBasic, selectParams?: SelectParams) => Promise<string>;
268
269
  };
269
- export declare type TableHandlerBasic = ViewHandlerBasic & {
270
+ export type TableHandlerBasic = ViewHandlerBasic & {
270
271
  update: <TD = AnyObject>(filter: FullFilterBasic, newData: PartialLax<TD>, params?: UpdateParamsBasic) => Promise<PartialLax<TD> | void>;
271
272
  updateBatch: <TD = AnyObject>(data: [FullFilterBasic, PartialLax<TD>][], params?: UpdateParamsBasic) => Promise<PartialLax<TD> | void>;
272
273
  upsert: <TD = AnyObject>(filter: FullFilterBasic, newData: PartialLax<TD>, params?: UpdateParamsBasic) => Promise<PartialLax<TD> | void>;
273
274
  insert: <TD = AnyObject>(data: (PartialLax<TD> | PartialLax<TD>[]), params?: InsertParamsBasic) => Promise<PartialLax<TD> | void>;
274
275
  delete: <TD = AnyObject>(filter?: FullFilterBasic, params?: DeleteParamsBasic) => Promise<PartialLax<TD> | void>;
275
276
  };
276
- export declare type JoinMaker<TT extends AnyObject = AnyObject> = (filter?: FullFilter<TT>, select?: Select<TT>, options?: SelectParams<TT>) => any;
277
- export declare type JoinMakerBasic = (filter?: FullFilterBasic, select?: SelectBasic, options?: SelectParams) => any;
278
- export declare type TableJoin = {
277
+ export type JoinMaker<TT extends AnyObject = AnyObject> = (filter?: FullFilter<TT>, select?: Select<TT>, options?: SelectParams<TT>) => any;
278
+ export type JoinMakerBasic = (filter?: FullFilterBasic, select?: SelectBasic, options?: SelectParams) => any;
279
+ export type TableJoin = {
279
280
  [key: string]: JoinMaker;
280
281
  };
281
- export declare type TableJoinBasic = {
282
+ export type TableJoinBasic = {
282
283
  [key: string]: JoinMakerBasic;
283
284
  };
284
- export declare type DbJoinMaker = {
285
+ export type DbJoinMaker = {
285
286
  innerJoin: TableJoin;
286
287
  leftJoin: TableJoin;
287
288
  innerJoinOne: TableJoin;
288
289
  leftJoinOne: TableJoin;
289
290
  };
290
- export declare type SQLResult<T extends SQLOptions["returnType"]> = {
291
+ export type SQLResult<T extends SQLOptions["returnType"]> = {
291
292
  command: "SELECT" | "UPDATE" | "DELETE" | "CREATE" | "ALTER" | "LISTEN" | "UNLISTEN" | "INSERT" | string;
292
293
  rowCount: number;
293
294
  rows: (T extends "arrayMode" ? any : AnyObject)[];
@@ -304,32 +305,32 @@ export declare type SQLResult<T extends SQLOptions["returnType"]> = {
304
305
  }[];
305
306
  duration: number;
306
307
  };
307
- export declare type DBEventHandles = {
308
+ export type DBEventHandles = {
308
309
  socketChannel: string;
309
310
  socketUnsubChannel: string;
310
311
  addListener: (listener: (event: any) => void) => {
311
312
  removeListener: () => void;
312
313
  };
313
314
  };
314
- export declare type CheckForListen<T, O extends SQLOptions> = O["allowListen"] extends true ? (DBEventHandles | T) : T;
315
- export declare type GetSQLReturnType<O extends SQLOptions> = CheckForListen<(O["returnType"] extends "row" ? AnyObject | null : O["returnType"] extends "rows" ? AnyObject[] : O["returnType"] extends "value" ? any | null : O["returnType"] extends "values" ? any[] : O["returnType"] extends "statement" ? string : O["returnType"] extends "noticeSubscription" ? DBEventHandles : SQLResult<O["returnType"]>), O>;
316
- export declare type SQLHandler = <Opts extends SQLOptions>(query: string, args?: AnyObject | any[], options?: Opts, serverSideOptions?: {
315
+ export type CheckForListen<T, O extends SQLOptions> = O["allowListen"] extends true ? (DBEventHandles | T) : T;
316
+ export type GetSQLReturnType<O extends SQLOptions> = CheckForListen<(O["returnType"] extends "row" ? AnyObject | null : O["returnType"] extends "rows" ? AnyObject[] : O["returnType"] extends "value" ? any | null : O["returnType"] extends "values" ? any[] : O["returnType"] extends "statement" ? string : O["returnType"] extends "noticeSubscription" ? DBEventHandles : SQLResult<O["returnType"]>), O>;
317
+ export type SQLHandler = <Opts extends SQLOptions>(query: string, args?: AnyObject | any[], options?: Opts, serverSideOptions?: {
317
318
  socket: any;
318
319
  }) => Promise<GetSQLReturnType<Opts>>;
319
- declare type SelectMethods<T extends DBTableSchema> = T["select"] extends true ? keyof Pick<TableHandler, "count" | "find" | "findOne" | "getColumns" | "getInfo" | "size" | "subscribe" | "subscribeOne"> : never;
320
- declare type UpdateMethods<T extends DBTableSchema> = T["update"] extends true ? keyof Pick<TableHandler, "update" | "updateBatch"> : never;
321
- declare type InsertMethods<T extends DBTableSchema> = T["insert"] extends true ? keyof Pick<TableHandler, "insert"> : never;
322
- declare type UpsertMethods<T extends DBTableSchema> = T["insert"] extends true ? T["update"] extends true ? keyof Pick<TableHandler, "upsert"> : never : never;
323
- declare type DeleteMethods<T extends DBTableSchema> = T["delete"] extends true ? keyof Pick<TableHandler, "delete"> : never;
324
- export declare type ValidatedMethods<T extends DBTableSchema> = SelectMethods<T> | UpdateMethods<T> | InsertMethods<T> | UpsertMethods<T> | DeleteMethods<T>;
325
- export declare type DBHandler<S = void> = (S extends DBSchema ? {
320
+ type SelectMethods<T extends DBTableSchema> = T["select"] extends true ? keyof Pick<TableHandler, "count" | "find" | "findOne" | "getColumns" | "getInfo" | "size" | "subscribe" | "subscribeOne"> : never;
321
+ type UpdateMethods<T extends DBTableSchema> = T["update"] extends true ? keyof Pick<TableHandler, "update" | "updateBatch"> : never;
322
+ type InsertMethods<T extends DBTableSchema> = T["insert"] extends true ? keyof Pick<TableHandler, "insert"> : never;
323
+ type UpsertMethods<T extends DBTableSchema> = T["insert"] extends true ? T["update"] extends true ? keyof Pick<TableHandler, "upsert"> : never : never;
324
+ type DeleteMethods<T extends DBTableSchema> = T["delete"] extends true ? keyof Pick<TableHandler, "delete"> : never;
325
+ export type ValidatedMethods<T extends DBTableSchema> = SelectMethods<T> | UpdateMethods<T> | InsertMethods<T> | UpsertMethods<T> | DeleteMethods<T>;
326
+ export type DBHandler<S = void> = (S extends DBSchema ? {
326
327
  [k in keyof S]: S[k]["is_view"] extends true ? ViewHandler<S[k]["columns"], S> : Pick<TableHandler<S[k]["columns"], S>, ValidatedMethods<S[k]>>;
327
328
  } : {
328
329
  [key: string]: Partial<TableHandler>;
329
330
  }) & DbJoinMaker & {
330
331
  sql?: SQLHandler;
331
332
  };
332
- export declare type DBHandlerBasic = {
333
+ export type DBHandlerBasic = {
333
334
  [key: string]: Partial<TableHandlerBasic>;
334
335
  } & {
335
336
  innerJoin: TableJoinBasic;
@@ -339,29 +340,29 @@ export declare type DBHandlerBasic = {
339
340
  } & {
340
341
  sql?: SQLHandler;
341
342
  };
342
- export declare type DBNoticeConfig = {
343
+ export type DBNoticeConfig = {
343
344
  socketChannel: string;
344
345
  socketUnsubChannel: string;
345
346
  };
346
- export declare type DBNotifConfig = DBNoticeConfig & {
347
+ export type DBNotifConfig = DBNoticeConfig & {
347
348
  notifChannel: string;
348
349
  };
349
- export declare type SQLOptions = {
350
+ export type SQLOptions = {
350
351
  returnType?: Required<SelectParams>["returnType"] | "statement" | "rows" | "noticeSubscription" | "arrayMode";
351
352
  allowListen?: boolean;
352
353
  hasParams?: boolean;
353
354
  };
354
- export declare type SQLRequest = {
355
+ export type SQLRequest = {
355
356
  query: string;
356
357
  params?: any | any[];
357
358
  options?: SQLOptions;
358
359
  };
359
- export declare type NotifSubscription = {
360
+ export type NotifSubscription = {
360
361
  socketChannel: string;
361
362
  socketUnsubChannel: string;
362
363
  notifChannel: string;
363
364
  };
364
- export declare type NoticeSubscription = {
365
+ export type NoticeSubscription = {
365
366
  socketChannel: string;
366
367
  socketUnsubChannel: string;
367
368
  };
@@ -380,7 +381,7 @@ export declare const CHANNELS: {
380
381
  CONNECTION: string;
381
382
  _preffix: string;
382
383
  };
383
- export declare type AuthGuardLocation = {
384
+ export type AuthGuardLocation = {
384
385
  href: string;
385
386
  origin: string;
386
387
  protocol: string;
@@ -391,7 +392,7 @@ export declare type AuthGuardLocation = {
391
392
  search: string;
392
393
  hash: string;
393
394
  };
394
- export declare type AuthGuardLocationResponse = {
395
+ export type AuthGuardLocationResponse = {
395
396
  shouldReload: boolean;
396
397
  };
397
398
  export declare const RULE_METHODS: {
@@ -404,11 +405,11 @@ export declare const RULE_METHODS: {
404
405
  readonly sync: readonly ["sync", "unsync"];
405
406
  readonly subscribe: readonly ["unsubscribe", "subscribe", "subscribeOne"];
406
407
  };
407
- export declare type MethodKey = typeof RULE_METHODS[keyof typeof RULE_METHODS][number];
408
- export declare type TableSchemaForClient = Record<string, Partial<Record<MethodKey, {} | {
408
+ export type MethodKey = typeof RULE_METHODS[keyof typeof RULE_METHODS][number];
409
+ export type TableSchemaForClient = Record<string, Partial<Record<MethodKey, {} | {
409
410
  err: any;
410
411
  }>>>;
411
- export declare type TableSchema = {
412
+ export type TableSchema = {
412
413
  schema: string;
413
414
  name: string;
414
415
  oid: number;
@@ -428,7 +429,7 @@ export declare type TableSchema = {
428
429
  delete: boolean;
429
430
  };
430
431
  };
431
- export declare type ObjDef = {
432
+ export type ObjDef = {
432
433
  type: "string" | "number" | "Date";
433
434
  label?: string;
434
435
  defaultValue?: string;
@@ -452,8 +453,8 @@ export declare type ObjDef = {
452
453
  };
453
454
  });
454
455
  };
455
- export declare type MethodFunction = (...args: any) => (any | Promise<any>);
456
- export declare type MethodFullDef = {
456
+ export type MethodFunction = (...args: any) => (any | Promise<any>);
457
+ export type MethodFullDef = {
457
458
  input: Record<string, ObjDef>;
458
459
  run: MethodFunction;
459
460
  output?: Record<string, Omit<ObjDef, "references">>;
@@ -464,11 +465,11 @@ export declare type MethodFullDef = {
464
465
  output?: Record<string, Omit<ObjDef, "references">>;
465
466
  outputTable?: undefined;
466
467
  });
467
- export declare type Method = MethodFunction | MethodFullDef;
468
- export declare type MethodHandler = {
468
+ export type Method = MethodFunction | MethodFullDef;
469
+ export type MethodHandler = {
469
470
  [method_name: string]: Method;
470
471
  };
471
- export declare type ClientSchema = {
472
+ export type ClientSchema = {
472
473
  rawSQL: boolean;
473
474
  joinTables: string[][];
474
475
  auth: AnyObject;
@@ -480,14 +481,14 @@ export declare type ClientSchema = {
480
481
  name: string;
481
482
  } & Pick<MethodFullDef, "input" | "output">)[];
482
483
  };
483
- export declare type AuthSocketSchema = {
484
+ export type AuthSocketSchema = {
484
485
  user?: AnyObject;
485
486
  register?: boolean;
486
487
  login?: boolean;
487
488
  logout?: boolean;
488
489
  pathGuard?: boolean;
489
490
  };
490
- export declare type ProstglesError = {
491
+ export type ProstglesError = {
491
492
  stack: string[];
492
493
  message: string;
493
494
  column?: string;
@@ -504,4 +505,5 @@ export * from "./filters";
504
505
  export type { ClientExpressData, ClientSyncHandles, ClientSyncInfo, SyncConfig, ClientSyncPullResponse, SyncBatchParams, onUpdatesParams } from "./replication";
505
506
  export type { ALLOWED_CONTENT_TYPE, ALLOWED_EXTENSION, FileColumnConfig, FileType } from "./files";
506
507
  export { CONTENT_TYPE_TO_EXT } from "./files";
508
+ export * from "./jsonb";
507
509
  //# sourceMappingURL=index.d.ts.map