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 +4 -4
- package/dist/files.d.ts.map +1 -1
- package/dist/filters.d.ts +20 -20
- package/dist/filters.d.ts.map +1 -1
- package/dist/index.d.ts +84 -82
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index_umd.js +1 -1
- package/dist/jsonb.d.ts +136 -0
- package/dist/jsonb.d.ts.map +1 -0
- package/dist/jsonb.js +134 -0
- package/dist/jsonb.js.map +1 -0
- package/dist/replication.d.ts +7 -7
- package/dist/replication.d.ts.map +1 -1
- package/dist/util.d.ts +14 -10
- package/dist/util.d.ts.map +1 -1
- package/lib/index.ts +4 -1
- package/lib/jsonb.ts +286 -0
- package/lib/util.ts +6 -1
- package/package.json +8 -5
- package/tests/index.js +113 -11
- package/tests/index.js.map +1 -1
- package/tests/index.ts +125 -7
- package/tests/tsconfig.json +1 -1
- package/tests/typeTests.js +22 -32
- package/tests/typeTests.js.map +1 -1
package/dist/util.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function omitKeys<T extends AnyObject, Exclude extends keyof T>(o
|
|
|
6
6
|
export declare function filter<T extends AnyObject, ArrFilter extends Partial<T>>(array: T[], arrFilter: ArrFilter): T[];
|
|
7
7
|
export declare function find<T extends AnyObject, ArrFilter extends Partial<T>>(array: T[], arrFilter: ArrFilter): T | undefined;
|
|
8
8
|
export declare function stableStringify(data: AnyObject, opts: any): string | undefined;
|
|
9
|
-
export
|
|
9
|
+
export type TextPatch = {
|
|
10
10
|
from: number;
|
|
11
11
|
to: number;
|
|
12
12
|
text: string;
|
|
@@ -14,18 +14,18 @@ export declare type TextPatch = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare function getTextPatch(oldStr: string, newStr: string): TextPatch | string;
|
|
16
16
|
export declare function unpatchText(original: string, patch: TextPatch): string;
|
|
17
|
-
export
|
|
17
|
+
export type SyncTableInfo = {
|
|
18
18
|
id_fields: string[];
|
|
19
19
|
synced_field: string;
|
|
20
20
|
throttle: number;
|
|
21
21
|
batch_size: number;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type BasicOrderBy = {
|
|
24
24
|
fieldName: string;
|
|
25
25
|
tsDataType: TS_COLUMN_DATA_TYPES;
|
|
26
26
|
asc: boolean;
|
|
27
27
|
}[];
|
|
28
|
-
export
|
|
28
|
+
export type WALConfig = SyncTableInfo & {
|
|
29
29
|
onSendStart?: () => any;
|
|
30
30
|
onSend: (items: any[], fullItems: WALItem[]) => Promise<any>;
|
|
31
31
|
onSendEnd?: (batch: any[], fullItems: WALItem[], error?: any) => any;
|
|
@@ -34,12 +34,12 @@ export declare type WALConfig = SyncTableInfo & {
|
|
|
34
34
|
DEBUG_MODE?: boolean;
|
|
35
35
|
id?: string;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type WALItem = {
|
|
38
38
|
initial?: AnyObject;
|
|
39
39
|
delta?: AnyObject;
|
|
40
40
|
current: AnyObject;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type WALItemsObj = Record<string, WALItem>;
|
|
43
43
|
export declare class WAL {
|
|
44
44
|
private changed;
|
|
45
45
|
private sending;
|
|
@@ -64,12 +64,16 @@ export declare function get(obj: any, propertyPath: string | string[]): any;
|
|
|
64
64
|
export declare function isObject(obj: any): obj is Record<string, any>;
|
|
65
65
|
export declare function isDefined<T>(v: T | undefined | void): v is T;
|
|
66
66
|
export declare function getKeys<T extends AnyObject>(o: T): Array<keyof T>;
|
|
67
|
-
export
|
|
67
|
+
export type Explode<T> = keyof T extends infer K ? K extends unknown ? {
|
|
68
68
|
[I in keyof T]: I extends K ? T[I] : never;
|
|
69
69
|
} : never : never;
|
|
70
|
-
export
|
|
71
|
-
export
|
|
70
|
+
export type AtMostOne<T> = Explode<Partial<T>>;
|
|
71
|
+
export type AtLeastOne<T, U = {
|
|
72
72
|
[K in keyof T]: Pick<T, K>;
|
|
73
73
|
}> = Partial<T> & U[keyof U];
|
|
74
|
-
export
|
|
74
|
+
export type ExactlyOne<T> = AtMostOne<T> & AtLeastOne<T>;
|
|
75
|
+
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
76
|
+
type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
77
|
+
export type StrictUnion<T> = StrictUnionHelper<T, T>;
|
|
78
|
+
export {};
|
|
75
79
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../lib/util.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAC;AAGpD,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,UAIjC;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,GAAE,OAAO,EAAO,EAAE,aAAa,UAAQ,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAkB/I;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,OAAO,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAEnH;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,SAAS,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,GAAG,CAAC,EAAE,CAE/G;AACD,wBAAgB,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,SAAS,SAAS,OAAO,CAAC,CAA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AAC,MAAM,CAAC,CAAC,CAEjE;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,MAAM,CAAC,GAC5C,CAAC,SAAS,OAAO,GACjB;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;CAAE,GAC9C,KAAK,GACL,KAAK,CAAC;AACV,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG;KAAE,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;CAAE,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AACtF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAGzD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC;AAClD,KAAK,iBAAiB,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC;AACxH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA"}
|
package/lib/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { FullFilter, AnyObject, FullFilterBasic, ValueOf, ComplexFilter } from "./filters";
|
|
3
3
|
import { FileColumnConfig } from "./files";
|
|
4
|
+
import { JSONB } from "./jsonb";
|
|
4
5
|
|
|
5
6
|
export const _PG_strings = [
|
|
6
7
|
'bpchar','char','varchar','text','citext','uuid','bytea', 'time','timetz','interval','name',
|
|
@@ -157,7 +158,8 @@ export type ColumnInfo = {
|
|
|
157
158
|
min?: string | number;
|
|
158
159
|
max?: string | number;
|
|
159
160
|
hint?: string;
|
|
160
|
-
|
|
161
|
+
|
|
162
|
+
jsonbSchema?: JSONB.JSONBSchema;
|
|
161
163
|
|
|
162
164
|
/**
|
|
163
165
|
* If degined then this column is referencing the file table
|
|
@@ -889,3 +891,4 @@ export * from "./filters";
|
|
|
889
891
|
export type { ClientExpressData, ClientSyncHandles, ClientSyncInfo, SyncConfig, ClientSyncPullResponse, SyncBatchParams, onUpdatesParams } from "./replication";
|
|
890
892
|
export type { ALLOWED_CONTENT_TYPE, ALLOWED_EXTENSION, FileColumnConfig, FileType } from "./files";
|
|
891
893
|
export { CONTENT_TYPE_TO_EXT } from "./files";
|
|
894
|
+
export * from "./jsonb";
|
package/lib/jsonb.ts
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { getKeys, isObject, StrictUnion } from "./util";
|
|
2
|
+
import type { JSONSchema7, JSONSchema7TypeName } from "json-schema";
|
|
3
|
+
|
|
4
|
+
export const PrimitiveTypes = ["boolean" , "number", "integer", "string", "any"] as const;
|
|
5
|
+
export const PrimitiveArrayTypes = PrimitiveTypes.map(v => `${v}[]` as `${typeof v}[]`);
|
|
6
|
+
export const DATA_TYPES = [
|
|
7
|
+
...PrimitiveTypes,
|
|
8
|
+
...PrimitiveArrayTypes
|
|
9
|
+
] as const;
|
|
10
|
+
type DataType = typeof DATA_TYPES[number];
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export namespace JSONB {
|
|
14
|
+
|
|
15
|
+
export type BaseOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* False by default
|
|
18
|
+
*/
|
|
19
|
+
optional?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* False by default
|
|
22
|
+
*/
|
|
23
|
+
nullable?: boolean;
|
|
24
|
+
description?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type BasicType = BaseOptions & {
|
|
29
|
+
type: DataType;
|
|
30
|
+
allowedValues?: any[];
|
|
31
|
+
oneOf?: undefined;
|
|
32
|
+
oneOfType?: undefined;
|
|
33
|
+
arrayOf?: undefined;
|
|
34
|
+
arrayOfType?: undefined;
|
|
35
|
+
enum?: undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type ObjectType = BaseOptions & {
|
|
39
|
+
type: ObjectSchema;
|
|
40
|
+
allowedValues?: undefined;
|
|
41
|
+
oneOf?: undefined;
|
|
42
|
+
oneOfType?: undefined;
|
|
43
|
+
arrayOf?: undefined;
|
|
44
|
+
arrayOfType?: undefined;
|
|
45
|
+
enum?: undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type EnumType = BaseOptions & {
|
|
49
|
+
type?: undefined;
|
|
50
|
+
enum: readonly any[];
|
|
51
|
+
oneOf?: undefined;
|
|
52
|
+
oneOfType?: undefined;
|
|
53
|
+
arrayOf?: undefined;
|
|
54
|
+
arrayOfType?: undefined;
|
|
55
|
+
allowedValues?: undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type OneOf = BaseOptions & {
|
|
59
|
+
type?: undefined;
|
|
60
|
+
arrayOf?: undefined;
|
|
61
|
+
arrayOfType?: undefined;
|
|
62
|
+
allowedValues?: undefined;
|
|
63
|
+
enum?: undefined;
|
|
64
|
+
} & ({
|
|
65
|
+
oneOf?: undefined;
|
|
66
|
+
oneOfType: readonly ObjectSchema[];
|
|
67
|
+
} | {
|
|
68
|
+
oneOf: FieldType[];
|
|
69
|
+
oneOfType?: undefined;
|
|
70
|
+
})
|
|
71
|
+
export type ArrayOf = BaseOptions & {
|
|
72
|
+
type?: undefined;
|
|
73
|
+
allowedValues?: undefined;
|
|
74
|
+
oneOf?: undefined;
|
|
75
|
+
oneOfType?: undefined;
|
|
76
|
+
enum?: undefined;
|
|
77
|
+
} & ({
|
|
78
|
+
arrayOf?: undefined;
|
|
79
|
+
arrayOfType: ObjectSchema;
|
|
80
|
+
} | {
|
|
81
|
+
arrayOf: FieldType;
|
|
82
|
+
arrayOfType?: undefined;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export type RecordType = BaseOptions & {
|
|
86
|
+
type?: undefined;
|
|
87
|
+
allowedValues?: undefined;
|
|
88
|
+
oneOf?: undefined;
|
|
89
|
+
oneOfType?: undefined;
|
|
90
|
+
arrayOf?: undefined;
|
|
91
|
+
arrayOfType?: undefined;
|
|
92
|
+
enum?: undefined;
|
|
93
|
+
record: {
|
|
94
|
+
keysEnum?: readonly string[];
|
|
95
|
+
values?: FieldType;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type FieldTypeObj = StrictUnion<
|
|
100
|
+
| BasicType
|
|
101
|
+
| ObjectType
|
|
102
|
+
| EnumType
|
|
103
|
+
| OneOf
|
|
104
|
+
| ArrayOf
|
|
105
|
+
| RecordType
|
|
106
|
+
>;
|
|
107
|
+
|
|
108
|
+
export type FieldType =
|
|
109
|
+
| DataType
|
|
110
|
+
| FieldTypeObj;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
export type GetType<T extends FieldType | Omit<FieldTypeObj, "optional">> =
|
|
114
|
+
| T extends { type: ObjectSchema } ? GetObjectType<T["type"]> :
|
|
115
|
+
| T extends "number" | { type: "number" } ? number :
|
|
116
|
+
| T extends "boolean" | { type: "boolean" } ? boolean :
|
|
117
|
+
| T extends "integer" | { type: "integer" } ? number :
|
|
118
|
+
| T extends "string" | { type: "string" } ? string :
|
|
119
|
+
| T extends "any" | { type: "any" } ? any :
|
|
120
|
+
| T extends "number[]" | { type: "number[]" } ? number[] :
|
|
121
|
+
| T extends "boolean[]" | { type: "boolean[]" } ? boolean[] :
|
|
122
|
+
| T extends "integer[]" | { type: "integer[]" } ? number[] :
|
|
123
|
+
| T extends "string[]" | { type: "string[]" } ? string[] :
|
|
124
|
+
| T extends "any[]" | { type: "any[]" } ? any[] :
|
|
125
|
+
| T extends { "enum": readonly any[] } ? T["enum"][number] :
|
|
126
|
+
| T extends { "record": RecordType["record"] } ? Record<
|
|
127
|
+
T["record"] extends { keysEnum: readonly string[] }? T["record"]["keysEnum"][number] : string,
|
|
128
|
+
T["record"] extends { values: FieldType }? GetType<T["record"]["values"]> : any
|
|
129
|
+
> :
|
|
130
|
+
|
|
131
|
+
| T extends { oneOf: FieldType[] } ? StrictUnion<GetType<T["oneOf"][number]>> :
|
|
132
|
+
| T extends { oneOf: readonly ObjectSchema[] } ? StrictUnion<GetType<T["oneOf"][number]>> :
|
|
133
|
+
|
|
134
|
+
| T extends { arrayOf: ObjectSchema } ? GetType<T["arrayOf"]>[] :
|
|
135
|
+
| T extends { arrayOfType: ObjectSchema } ? GetType<T["arrayOfType"]>[] :
|
|
136
|
+
any;
|
|
137
|
+
|
|
138
|
+
type IsOptional<F extends FieldType> = F extends DataType? false : F extends { optional: true }? true : false;
|
|
139
|
+
|
|
140
|
+
const _r: GetType<{ record: { keysEnum: ["a", "b"], values: "integer[]" } }> = {
|
|
141
|
+
a: [2],
|
|
142
|
+
b: [221]
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type ObjectSchema = Record<string, FieldType>;
|
|
146
|
+
export type JSONBSchema = Omit<FieldTypeObj, "optional">;
|
|
147
|
+
|
|
148
|
+
const _dd: JSONBSchema = {
|
|
149
|
+
enum: [1],
|
|
150
|
+
type: "any"
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export type GetObjectType<S extends ObjectSchema> = (
|
|
154
|
+
{
|
|
155
|
+
[K in keyof S as IsOptional<S[K]> extends true ? K : never]?: GetType<S[K]>
|
|
156
|
+
} & {
|
|
157
|
+
[K in keyof S as IsOptional<S[K]> extends true ? never : K]: GetType<S[K]>
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
export type SchemaObject<S extends JSONBSchema> = S["nullable"] extends true? (null | GetType<S>) : GetType<S>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
/** tests */
|
|
165
|
+
const s: JSONB.JSONBSchema = {
|
|
166
|
+
type: {
|
|
167
|
+
a: { type: "boolean" },
|
|
168
|
+
c: { type: { c1: { type: "string" } } },
|
|
169
|
+
arr: { arrayOfType: { d: "string" } },
|
|
170
|
+
o: {
|
|
171
|
+
oneOfType: [
|
|
172
|
+
{ z: { type: "integer" } },
|
|
173
|
+
{ z1: { type: "integer" } }
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const _ss: JSONB.SchemaObject<typeof s> = {
|
|
180
|
+
a: true,
|
|
181
|
+
arr: [{ d: "" }],
|
|
182
|
+
c: {
|
|
183
|
+
c1: ""
|
|
184
|
+
},
|
|
185
|
+
o: { z1: 23 }
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const getJSONSchemaObject = (rawType: JSONB.FieldType | JSONB.JSONBSchema, rootInfo?: { id: string }): JSONSchema7 => {
|
|
189
|
+
const { type, arrayOf, arrayOfType, description, nullable, oneOf, oneOfType, title, record, ...t } = typeof rawType === "string"? ({ type: rawType } as JSONB.FieldTypeObj) : rawType;
|
|
190
|
+
|
|
191
|
+
let result: JSONSchema7 = {};
|
|
192
|
+
const partialProps: Partial<JSONSchema7> = {
|
|
193
|
+
...((t.enum || t.allowedValues?.length) && { enum: t.allowedValues ?? t.enum!.slice(0) }),
|
|
194
|
+
...(!!description && { description }),
|
|
195
|
+
...(!!title && { title }),
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
if(t.enum?.length){
|
|
199
|
+
partialProps.type = typeof t.enum[0]! as any;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if(typeof type === "string" || arrayOf || arrayOfType){
|
|
203
|
+
|
|
204
|
+
/** ARRAY */
|
|
205
|
+
if(type && typeof type !== "string") {
|
|
206
|
+
throw "Not expected";
|
|
207
|
+
}
|
|
208
|
+
if(arrayOf || arrayOfType || type?.endsWith("[]")){
|
|
209
|
+
const arrayItems =
|
|
210
|
+
(arrayOf || arrayOfType)? getJSONSchemaObject(arrayOf || { type: arrayOfType }) :
|
|
211
|
+
type?.startsWith("any")? { type: undefined } :
|
|
212
|
+
{
|
|
213
|
+
type: type?.slice(0, -2) as JSONSchema7TypeName,
|
|
214
|
+
...(t.allowedValues && { enum: t.allowedValues }),
|
|
215
|
+
};
|
|
216
|
+
result = {
|
|
217
|
+
type: "array",
|
|
218
|
+
items: arrayItems,
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** PRIMITIVES */
|
|
222
|
+
} else {
|
|
223
|
+
result = {
|
|
224
|
+
type: type as JSONSchema7TypeName,
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** OBJECT */
|
|
229
|
+
} else if(isObject(type)){
|
|
230
|
+
result = {
|
|
231
|
+
type: "object",
|
|
232
|
+
required: getKeys(type).filter(k => {
|
|
233
|
+
const t = type[k]!;
|
|
234
|
+
return typeof t === "string" || !t.optional;
|
|
235
|
+
}),
|
|
236
|
+
properties: getKeys(type).reduce((a, k) => {
|
|
237
|
+
return {
|
|
238
|
+
...a,
|
|
239
|
+
[k]: getJSONSchemaObject(type[k]!)
|
|
240
|
+
}
|
|
241
|
+
}, {}),
|
|
242
|
+
}
|
|
243
|
+
} else if(oneOf || oneOfType){
|
|
244
|
+
const _oneOf = oneOf || oneOfType!.map(type => ({ type }))
|
|
245
|
+
result = {
|
|
246
|
+
oneOf: _oneOf.map(t => getJSONSchemaObject(t))
|
|
247
|
+
}
|
|
248
|
+
} else if(record){
|
|
249
|
+
result = {
|
|
250
|
+
type: "object",
|
|
251
|
+
...(record.values && !record.keysEnum && { additionalProperties: getJSONSchemaObject(record.values) }),
|
|
252
|
+
...(record.keysEnum && { properties: record.keysEnum.reduce((a, v) => ({
|
|
253
|
+
...a,
|
|
254
|
+
[v]: !record.values? { type: {} } : getJSONSchemaObject(record.values)
|
|
255
|
+
}), {}) })
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (nullable) {
|
|
260
|
+
const nullDef = { type: "null" } as const;
|
|
261
|
+
if (result.oneOf) {
|
|
262
|
+
result.oneOf.push(nullDef)
|
|
263
|
+
} else if (result.enum && !result.enum.includes(null)) {
|
|
264
|
+
result.enum.push(null)
|
|
265
|
+
|
|
266
|
+
} else result = {
|
|
267
|
+
oneOf: [result, nullDef]
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const rootSchema: JSONSchema7 | undefined = !rootInfo? undefined : {
|
|
272
|
+
"$id": rootInfo?.id,
|
|
273
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
return {
|
|
277
|
+
...rootSchema,
|
|
278
|
+
...partialProps,
|
|
279
|
+
...result,
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export function getJSONBSchemaAsJSONSchema(tableName: string, colName: string, schema: JSONB.JSONBSchema): JSONSchema7 {
|
|
284
|
+
return getJSONSchemaObject(schema, { id: `${tableName}.${colName}` })
|
|
285
|
+
}
|
|
286
|
+
|
package/lib/util.ts
CHANGED
|
@@ -501,4 +501,9 @@ export type Explode<T> = keyof T extends infer K
|
|
|
501
501
|
: never;
|
|
502
502
|
export type AtMostOne<T> = Explode<Partial<T>>;
|
|
503
503
|
export type AtLeastOne<T, U = {[K in keyof T]: Pick<T, K> }> = Partial<T> & U[keyof U]
|
|
504
|
-
export type ExactlyOne<T> = AtMostOne<T> & AtLeastOne<T
|
|
504
|
+
export type ExactlyOne<T> = AtMostOne<T> & AtLeastOne<T>;
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
type UnionKeys<T> = T extends T ? keyof T : never;
|
|
508
|
+
type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
|
|
509
|
+
export type StrictUnion<T> = StrictUnionHelper<T, T>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prostgles-types",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.26",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index_umd.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,9 +28,12 @@
|
|
|
28
28
|
],
|
|
29
29
|
"homepage": "https://prostgles.com",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"tsconfig-paths-webpack-plugin": "^
|
|
32
|
-
"typescript": "^4.
|
|
33
|
-
"webpack": "^5.
|
|
34
|
-
"webpack-cli": "^
|
|
31
|
+
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
32
|
+
"typescript": "^4.9.5",
|
|
33
|
+
"webpack": "^5.75.0",
|
|
34
|
+
"webpack-cli": "^5.0.1"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"json-schema": "^0.4.0"
|
|
35
38
|
}
|
|
36
39
|
}
|
package/tests/index.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const assert_1 = require("assert");
|
|
12
4
|
const util_1 = require("../dist/util");
|
|
5
|
+
const jsonb_1 = require("../dist/jsonb");
|
|
13
6
|
const typeTests_1 = require("./typeTests");
|
|
14
7
|
(0, typeTests_1.typeTestsOK)();
|
|
15
8
|
let error;
|
|
@@ -35,10 +28,119 @@ vals.map(({ o, n }, i) => {
|
|
|
35
28
|
if (failed > -1) {
|
|
36
29
|
error = { msg: "unpatchText failed for:", data: vals[failed] };
|
|
37
30
|
}
|
|
31
|
+
const jsonS = (0, jsonb_1.getJSONBSchemaAsJSONSchema)("tjson", "json", { type: {
|
|
32
|
+
a: { type: "boolean" },
|
|
33
|
+
arr: { enum: ["1", "2", "3"] },
|
|
34
|
+
arr1: { enum: [1, 2, 3] },
|
|
35
|
+
arr2: { type: "integer[]" },
|
|
36
|
+
arrStr: { type: "string[]", optional: true, nullable: true },
|
|
37
|
+
o: { optional: true, nullable: true, oneOfType: [
|
|
38
|
+
{ o1: "integer" },
|
|
39
|
+
{ o2: "boolean" }
|
|
40
|
+
] },
|
|
41
|
+
customTables: { optional: true, arrayOfType: {
|
|
42
|
+
tableName: "string",
|
|
43
|
+
select: {
|
|
44
|
+
"optional": true,
|
|
45
|
+
"oneOf": [
|
|
46
|
+
"boolean",
|
|
47
|
+
{ "type": { fields: "string[]" } }
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} });
|
|
53
|
+
assert_1.strict.deepEqual(jsonS, {
|
|
54
|
+
$id: 'tjson.json',
|
|
55
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
56
|
+
type: 'object',
|
|
57
|
+
required: ['a', 'arr', 'arr1', 'arr2'],
|
|
58
|
+
properties: {
|
|
59
|
+
a: { type: 'boolean' },
|
|
60
|
+
arr: {
|
|
61
|
+
type: 'string', enum: ['1', '2', '3']
|
|
62
|
+
},
|
|
63
|
+
arr1: {
|
|
64
|
+
type: 'number', enum: [1, 2, 3]
|
|
65
|
+
},
|
|
66
|
+
arr2: { type: 'array', items: { type: 'integer' } },
|
|
67
|
+
arrStr: {
|
|
68
|
+
oneOf: [
|
|
69
|
+
{ type: 'array', items: { type: 'string' } },
|
|
70
|
+
{ type: 'null' }
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
o: {
|
|
74
|
+
oneOf: [
|
|
75
|
+
{ type: "object", required: ["o1"], properties: { o1: { type: 'integer' } } },
|
|
76
|
+
{ type: "object", required: ["o2"], properties: { o2: { type: 'boolean' } } },
|
|
77
|
+
{ type: 'null' }
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
customTables: {
|
|
81
|
+
type: "array",
|
|
82
|
+
items: {
|
|
83
|
+
type: "object",
|
|
84
|
+
required: ["tableName"],
|
|
85
|
+
properties: {
|
|
86
|
+
tableName: { type: "string" },
|
|
87
|
+
select: {
|
|
88
|
+
oneOf: [
|
|
89
|
+
{ type: "boolean" },
|
|
90
|
+
{
|
|
91
|
+
type: "object",
|
|
92
|
+
required: ["fields"],
|
|
93
|
+
properties: {
|
|
94
|
+
fields: { type: "array", items: { type: "string" } }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
assert_1.strict.deepEqual((0, jsonb_1.getJSONBSchemaAsJSONSchema)("tjson", "status", {
|
|
105
|
+
nullable: true,
|
|
106
|
+
oneOfType: [
|
|
107
|
+
{ ok: { type: "string" } },
|
|
108
|
+
{ err: { type: "string" } },
|
|
109
|
+
{
|
|
110
|
+
loading: { type: {
|
|
111
|
+
loaded: { type: "number" },
|
|
112
|
+
total: { type: "number" }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}), {
|
|
118
|
+
$id: 'tjson.status',
|
|
119
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
120
|
+
oneOf: [
|
|
121
|
+
{ type: "object", required: ["ok"], properties: { ok: { type: 'string' } } },
|
|
122
|
+
{ type: "object", required: ["err"], properties: { err: { type: 'string' } } },
|
|
123
|
+
{
|
|
124
|
+
type: "object",
|
|
125
|
+
required: ["loading"],
|
|
126
|
+
properties: {
|
|
127
|
+
loading: {
|
|
128
|
+
required: ["loaded", "total"],
|
|
129
|
+
properties: {
|
|
130
|
+
loaded: { type: 'number' },
|
|
131
|
+
total: { type: 'number' }
|
|
132
|
+
},
|
|
133
|
+
type: 'object'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{ type: "null" }
|
|
138
|
+
],
|
|
139
|
+
});
|
|
38
140
|
const w = new util_1.WAL({
|
|
39
141
|
id_fields: ["a", "b"],
|
|
40
142
|
synced_field: "c",
|
|
41
|
-
onSend: (d) =>
|
|
143
|
+
onSend: async (d) => {
|
|
42
144
|
if (d[0].a !== "a" || d[3].a !== "z" || d[2].b !== "zbb") {
|
|
43
145
|
error = error || { msg: "WAL sorting failed", data: d };
|
|
44
146
|
}
|
|
@@ -50,7 +152,7 @@ const w = new util_1.WAL({
|
|
|
50
152
|
console.log("Testing successful");
|
|
51
153
|
process.exit(0);
|
|
52
154
|
}
|
|
53
|
-
}
|
|
155
|
+
},
|
|
54
156
|
throttle: 100,
|
|
55
157
|
batch_size: 50
|
|
56
158
|
});
|
package/tests/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,mCAA0C;AAC1C,uCAAyE;AACzE,yCAA2D;AAC3D,2CAA0C;AAE1C,IAAA,uBAAW,GAAE,CAAC;AAEd,IAAI,KAAK,CAAC;AAEV,IAAI,MAAM,GAAG,CAAC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