@blitznocode/blitz-orm 0.10.15 → 0.10.17
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/index.d.ts
DELETED
|
@@ -1,693 +0,0 @@
|
|
|
1
|
-
import { TypeDBDriver, TypeDBSession } from 'typedb-driver';
|
|
2
|
-
import { Surreal } from 'surrealdb.js';
|
|
3
|
-
|
|
4
|
-
interface TypeDBProvider extends CommonProvider {
|
|
5
|
-
provider: 'typeDB';
|
|
6
|
-
url: string;
|
|
7
|
-
}
|
|
8
|
-
interface TypeDBClusterProvider extends CommonProvider {
|
|
9
|
-
provider: 'typeDBCluster';
|
|
10
|
-
addresses: string[];
|
|
11
|
-
username: string;
|
|
12
|
-
password: string;
|
|
13
|
-
tlsRootCAPath?: string;
|
|
14
|
-
}
|
|
15
|
-
type TypeDBHandles = Map<string, {
|
|
16
|
-
client: TypeDBDriver;
|
|
17
|
-
session: TypeDBSession;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
interface SurrealDBProviderObject extends CommonProvider {
|
|
21
|
-
provider: 'surrealDB';
|
|
22
|
-
url: string;
|
|
23
|
-
namespace: string;
|
|
24
|
-
username: string;
|
|
25
|
-
password: string;
|
|
26
|
-
}
|
|
27
|
-
type SurrealDBHandles = Map<string, {
|
|
28
|
-
client: Surreal;
|
|
29
|
-
}>;
|
|
30
|
-
|
|
31
|
-
type QueryConfig = {
|
|
32
|
-
noMetadata?: boolean;
|
|
33
|
-
returnNulls?: boolean;
|
|
34
|
-
simplifiedLinks?: boolean;
|
|
35
|
-
debugger?: boolean;
|
|
36
|
-
};
|
|
37
|
-
type MutationConfig = {
|
|
38
|
-
noMetadata?: boolean;
|
|
39
|
-
preQuery?: boolean;
|
|
40
|
-
ignoreNonexistingThings?: boolean;
|
|
41
|
-
context?: Record<string, any>;
|
|
42
|
-
};
|
|
43
|
-
type BormConfig = {
|
|
44
|
-
server: {
|
|
45
|
-
provider: 'blitz-orm-js';
|
|
46
|
-
};
|
|
47
|
-
query?: QueryConfig;
|
|
48
|
-
mutation?: MutationConfig;
|
|
49
|
-
dbConnectors: [Provider, ...Provider[]];
|
|
50
|
-
};
|
|
51
|
-
type Provider = TypeDBProvider | TypeDBClusterProvider | SurrealDBProviderObject;
|
|
52
|
-
interface CommonProvider {
|
|
53
|
-
id: string;
|
|
54
|
-
dbName: string;
|
|
55
|
-
}
|
|
56
|
-
type DBConnector = {
|
|
57
|
-
id: string;
|
|
58
|
-
subs?: string;
|
|
59
|
-
path?: string;
|
|
60
|
-
as?: string;
|
|
61
|
-
};
|
|
62
|
-
type AllDbHandles = {
|
|
63
|
-
typeDB: TypeDBHandles;
|
|
64
|
-
surrealDB: SurrealDBHandles;
|
|
65
|
-
};
|
|
66
|
-
type AtLeastOne<T, U = {
|
|
67
|
-
[K in keyof T]: Pick<T, K>;
|
|
68
|
-
}> = Partial<T> & U[keyof U];
|
|
69
|
-
type DBHandles = AtLeastOne<AllDbHandles>;
|
|
70
|
-
type DBHandleKey = keyof DBHandles;
|
|
71
|
-
|
|
72
|
-
type ThingType = 'entity' | 'relation';
|
|
73
|
-
type BormMetadata = {
|
|
74
|
-
$id: string;
|
|
75
|
-
$op?: string;
|
|
76
|
-
$entity?: string;
|
|
77
|
-
$relation?: string;
|
|
78
|
-
$tempId?: string;
|
|
79
|
-
};
|
|
80
|
-
type WithBormMetadata<T> = T extends any[] ? T[number] extends object ? Array<WithBormMetadataObject<T[number]>> : T : T extends object ? WithBormMetadataObject<T> : T;
|
|
81
|
-
type WithBormMetadataObject<T> = {
|
|
82
|
-
[K in keyof T]: WithBormMetadata<T[K]>;
|
|
83
|
-
} & BormMetadata;
|
|
84
|
-
type BQLResponseSingle = Record<string | symbol, any>;
|
|
85
|
-
type BQLResponseMulti = BQLResponseSingle[];
|
|
86
|
-
type BQLResponse = BQLResponseSingle | BQLResponseMulti;
|
|
87
|
-
|
|
88
|
-
type BormSchema = {
|
|
89
|
-
entities: {
|
|
90
|
-
[s: string]: BormEntity;
|
|
91
|
-
};
|
|
92
|
-
relations: {
|
|
93
|
-
[s: string]: BormRelation;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
type BormEntity = {
|
|
97
|
-
extends: string;
|
|
98
|
-
idFields?: readonly string[];
|
|
99
|
-
defaultDBConnector: DBConnector;
|
|
100
|
-
dataFields?: readonly DataField[];
|
|
101
|
-
linkFields?: readonly LinkField[];
|
|
102
|
-
hooks?: Hooks;
|
|
103
|
-
} | {
|
|
104
|
-
idFields: readonly string[];
|
|
105
|
-
defaultDBConnector: DBConnector;
|
|
106
|
-
dataFields?: readonly DataField[];
|
|
107
|
-
linkFields?: readonly LinkField[];
|
|
108
|
-
hooks?: Hooks;
|
|
109
|
-
};
|
|
110
|
-
type BormRelation = BormEntity & {
|
|
111
|
-
defaultDBConnector: DBConnector & {
|
|
112
|
-
path: string;
|
|
113
|
-
};
|
|
114
|
-
roles?: {
|
|
115
|
-
[key: string]: RoleField;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
type BormOperation = 'create' | 'update' | 'delete' | 'link' | 'unlink' | 'replace' | 'match';
|
|
119
|
-
type BormTrigger = 'onCreate' | 'onUpdate' | 'onDelete' | 'onLink' | 'onUnlink' | 'onReplace' | 'onMatch';
|
|
120
|
-
type Hooks = {
|
|
121
|
-
pre?: readonly PreHook[];
|
|
122
|
-
};
|
|
123
|
-
type PreHook = {
|
|
124
|
-
triggers?: {
|
|
125
|
-
[K in BormTrigger]?: () => boolean;
|
|
126
|
-
};
|
|
127
|
-
actions: readonly Action[];
|
|
128
|
-
};
|
|
129
|
-
type Action = {
|
|
130
|
-
name?: string;
|
|
131
|
-
description?: string;
|
|
132
|
-
} & (TransFormAction | ValidateAction);
|
|
133
|
-
type NodeFunctionParams = [
|
|
134
|
-
currentNode: EnrichedBQLMutationBlock,
|
|
135
|
-
parentNode: EnrichedBQLMutationBlock,
|
|
136
|
-
context: Record<string, any>,
|
|
137
|
-
dbNode: EnrichedBQLMutationBlock | Record<string, never>
|
|
138
|
-
];
|
|
139
|
-
type TransFormAction = {
|
|
140
|
-
type: 'transform';
|
|
141
|
-
fn: (...args: NodeFunctionParams) => Partial<EnrichedBQLMutationBlock>;
|
|
142
|
-
};
|
|
143
|
-
type ValidateAction = {
|
|
144
|
-
type: 'validate';
|
|
145
|
-
fn: (...args: NodeFunctionParams) => boolean;
|
|
146
|
-
severity: 'error' | 'warning' | 'info';
|
|
147
|
-
message: string;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
type AdapterContext = {
|
|
151
|
-
mutation: {
|
|
152
|
-
splitArray$Ids: boolean;
|
|
153
|
-
requiresParseBQL: boolean;
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
declare const Schema: unique symbol;
|
|
158
|
-
declare const QueryPath: unique symbol;
|
|
159
|
-
declare const EdgeType: unique symbol;
|
|
160
|
-
declare const EdgeSchema: unique symbol;
|
|
161
|
-
declare const DBNode: unique symbol;
|
|
162
|
-
declare const FieldSchema: unique symbol;
|
|
163
|
-
declare const SharedMetadata: unique symbol;
|
|
164
|
-
declare const SuqlMetadata: unique symbol;
|
|
165
|
-
|
|
166
|
-
type BormField = {
|
|
167
|
-
path: string;
|
|
168
|
-
cardinality?: DiscreteCardinality;
|
|
169
|
-
ordered?: boolean;
|
|
170
|
-
embedded?: boolean;
|
|
171
|
-
rights?: readonly RightType[];
|
|
172
|
-
};
|
|
173
|
-
type RoleField = {
|
|
174
|
-
cardinality: DiscreteCardinality;
|
|
175
|
-
dbConnector?: DBConnector;
|
|
176
|
-
};
|
|
177
|
-
type LinkField = BormField & {
|
|
178
|
-
relation: string;
|
|
179
|
-
cardinality: DiscreteCardinality;
|
|
180
|
-
plays: string;
|
|
181
|
-
isVirtual?: boolean;
|
|
182
|
-
} & ({
|
|
183
|
-
target: 'role';
|
|
184
|
-
filter?: Filter | Filter[];
|
|
185
|
-
} | {
|
|
186
|
-
target: 'relation';
|
|
187
|
-
});
|
|
188
|
-
type LinkedFieldWithThing = LinkField & {
|
|
189
|
-
thing: string;
|
|
190
|
-
thingType: ThingType;
|
|
191
|
-
};
|
|
192
|
-
type MultiField = BormField & {
|
|
193
|
-
contentType: 'FLEX';
|
|
194
|
-
default?: {
|
|
195
|
-
type: 'fn';
|
|
196
|
-
fn: (currentNode: BQLMutationBlock) => unknown;
|
|
197
|
-
} | {
|
|
198
|
-
type: 'value';
|
|
199
|
-
value: unknown;
|
|
200
|
-
};
|
|
201
|
-
validations?: {
|
|
202
|
-
enum?: unknown[];
|
|
203
|
-
unique?: boolean;
|
|
204
|
-
fn?: (value: unknown) => boolean;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
type StringField = BormField & {
|
|
208
|
-
contentType: 'ID' | 'COLOR' | 'DATE' | 'FILE' | 'EMAIL' | 'PHONE' | 'URL' | 'PASSWORD' | 'LANGUAGE_TEXT' | 'RICH_TEXT' | 'TEXT' | 'JSON';
|
|
209
|
-
default?: {
|
|
210
|
-
type: 'fn';
|
|
211
|
-
fn: (currentNode: BQLMutationBlock) => string;
|
|
212
|
-
} | {
|
|
213
|
-
type: 'value';
|
|
214
|
-
value: string;
|
|
215
|
-
};
|
|
216
|
-
validations?: {
|
|
217
|
-
enum?: string[];
|
|
218
|
-
unique?: boolean;
|
|
219
|
-
fn?: (value: string) => boolean;
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
type NumberField = BormField & {
|
|
223
|
-
contentType: 'DURATION' | 'HOUR' | 'RATING' | 'CURRENCY' | 'PERCENTAGE' | 'NUMBER_DECIMAL' | 'NUMBER';
|
|
224
|
-
default?: {
|
|
225
|
-
type: 'fn';
|
|
226
|
-
fn: (currentNode: BQLMutationBlock) => number;
|
|
227
|
-
} | {
|
|
228
|
-
type: 'value';
|
|
229
|
-
value: number;
|
|
230
|
-
};
|
|
231
|
-
validations?: {
|
|
232
|
-
enum?: number[];
|
|
233
|
-
unique?: boolean;
|
|
234
|
-
fn?: (value: number) => boolean;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
type DateField = BormField & {
|
|
238
|
-
contentType: 'TIME';
|
|
239
|
-
default?: {
|
|
240
|
-
type: 'fn';
|
|
241
|
-
fn: (currentNode: BQLMutationBlock) => Date;
|
|
242
|
-
} | {
|
|
243
|
-
type: 'value';
|
|
244
|
-
value: Date;
|
|
245
|
-
};
|
|
246
|
-
validations?: {
|
|
247
|
-
enum: Date[];
|
|
248
|
-
fn?: (value: Date) => boolean;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
type BooleanField = BormField & {
|
|
252
|
-
contentType: 'BOOLEAN';
|
|
253
|
-
default?: {
|
|
254
|
-
type: 'fn';
|
|
255
|
-
fn: (currentNode: BQLMutationBlock) => boolean;
|
|
256
|
-
} | {
|
|
257
|
-
type: 'value';
|
|
258
|
-
value: boolean;
|
|
259
|
-
};
|
|
260
|
-
validations?: {
|
|
261
|
-
enum?: boolean[];
|
|
262
|
-
fn?: (value: boolean) => boolean;
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
type AllDataField = StringField | NumberField | DateField | BooleanField | MultiField;
|
|
266
|
-
type DataField = BormField & {
|
|
267
|
-
cardinality?: Cardinality;
|
|
268
|
-
shared?: boolean;
|
|
269
|
-
validations?: {
|
|
270
|
-
required?: boolean;
|
|
271
|
-
unique?: boolean;
|
|
272
|
-
};
|
|
273
|
-
isVirtual?: boolean;
|
|
274
|
-
dbConnectors?: [DBConnector, ...DBConnector[]];
|
|
275
|
-
} & AllDataField;
|
|
276
|
-
type ContentType = keyof ContentTypeMapping;
|
|
277
|
-
type ContentTypeMapping = {
|
|
278
|
-
ID: string;
|
|
279
|
-
JSON: string;
|
|
280
|
-
COLOR: string;
|
|
281
|
-
BOOLEAN: boolean;
|
|
282
|
-
POINT: {
|
|
283
|
-
x: number;
|
|
284
|
-
y: number;
|
|
285
|
-
};
|
|
286
|
-
FILE: string;
|
|
287
|
-
EMAIL: string;
|
|
288
|
-
PHONE: string;
|
|
289
|
-
WEEK_DAY: 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday';
|
|
290
|
-
DURATION: number;
|
|
291
|
-
HOUR: number;
|
|
292
|
-
TIME: Date;
|
|
293
|
-
DATE: string;
|
|
294
|
-
RATING: number;
|
|
295
|
-
CURRENCY: number;
|
|
296
|
-
PERCENTAGE: number;
|
|
297
|
-
NUMBER_DECIMAL: number;
|
|
298
|
-
NUMBER: number;
|
|
299
|
-
URL: string;
|
|
300
|
-
PASSWORD: string;
|
|
301
|
-
LANGUAGE_TEXT: string;
|
|
302
|
-
RICH_TEXT: string;
|
|
303
|
-
TEXT: string;
|
|
304
|
-
};
|
|
305
|
-
type DiscreteCardinality = 'ONE' | 'MANY';
|
|
306
|
-
type Cardinality = DiscreteCardinality | 'INTERVAL';
|
|
307
|
-
type RightType = 'CREATE' | 'DELETE' | 'UPDATE' | 'LINK' | 'UNLINK';
|
|
308
|
-
type BQLFieldObj = {
|
|
309
|
-
$path: string;
|
|
310
|
-
$as?: string;
|
|
311
|
-
} & Omit<RawBQLQuery, '$entity' | '$relation' | '$thing' | '$thingType'>;
|
|
312
|
-
type BQLField = string | BQLFieldObj;
|
|
313
|
-
|
|
314
|
-
type EnrichedBormSchema = {
|
|
315
|
-
entities: {
|
|
316
|
-
[s: string]: EnrichedBormEntity;
|
|
317
|
-
};
|
|
318
|
-
relations: {
|
|
319
|
-
[s: string]: EnrichedBormRelation;
|
|
320
|
-
};
|
|
321
|
-
};
|
|
322
|
-
type SharedEnrichedProps = {
|
|
323
|
-
name: string;
|
|
324
|
-
computedFields: string[];
|
|
325
|
-
virtualFields: string[];
|
|
326
|
-
requiredFields: string[];
|
|
327
|
-
enumFields: string[];
|
|
328
|
-
fnValidatedFields: string[];
|
|
329
|
-
linkFields?: EnrichedLinkField[];
|
|
330
|
-
dataFields?: EnrichedDataField[];
|
|
331
|
-
db: DBHandleKey;
|
|
332
|
-
dbContext: AdapterContext;
|
|
333
|
-
allExtends?: string[];
|
|
334
|
-
subTypes?: string[];
|
|
335
|
-
};
|
|
336
|
-
type EnrichedBormEntity = Omit<BormEntity, 'linkFields' | 'idFields' | 'dataFields'> & {
|
|
337
|
-
extends?: string;
|
|
338
|
-
thingType: 'entity';
|
|
339
|
-
idFields: string[];
|
|
340
|
-
} & SharedEnrichedProps;
|
|
341
|
-
type EnrichedBormRelation = Omit<BormRelation, 'linkFields' | 'dataFields'> & {
|
|
342
|
-
thingType: 'relation';
|
|
343
|
-
roles: {
|
|
344
|
-
[key: string]: EnrichedRoleField;
|
|
345
|
-
};
|
|
346
|
-
idFields: string[];
|
|
347
|
-
} & SharedEnrichedProps;
|
|
348
|
-
type EnrichedRoleField = RoleField & {
|
|
349
|
-
name: string;
|
|
350
|
-
playedBy?: LinkedFieldWithThing[];
|
|
351
|
-
$things: string[];
|
|
352
|
-
fieldType: 'roleField';
|
|
353
|
-
[SharedMetadata]: {
|
|
354
|
-
inheritanceOrigin: string;
|
|
355
|
-
};
|
|
356
|
-
[SuqlMetadata]: {
|
|
357
|
-
queryPath: string;
|
|
358
|
-
};
|
|
359
|
-
};
|
|
360
|
-
type EnrichedDataField = DataField & {
|
|
361
|
-
dbPath: string;
|
|
362
|
-
[SharedMetadata]: {
|
|
363
|
-
inheritanceOrigin: string;
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
type EnrichedLinkField = LinkField & {
|
|
367
|
-
name: string;
|
|
368
|
-
relation: string;
|
|
369
|
-
plays: string;
|
|
370
|
-
$things: string[];
|
|
371
|
-
fieldType: 'linkField';
|
|
372
|
-
[SharedMetadata]: {
|
|
373
|
-
inheritanceOrigin: string;
|
|
374
|
-
};
|
|
375
|
-
[SuqlMetadata]: {
|
|
376
|
-
queryPath: string;
|
|
377
|
-
};
|
|
378
|
-
} & ({
|
|
379
|
-
target: 'role';
|
|
380
|
-
targetRoles?: string[];
|
|
381
|
-
oppositeLinkFieldsPlayedBy: LinkedFieldWithThing[];
|
|
382
|
-
} | {
|
|
383
|
-
target: 'relation';
|
|
384
|
-
oppositeLinkFieldsPlayedBy: Pick<LinkedFieldWithThing, 'thing' | 'thingType' | 'plays'>[];
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
type Sorter = {
|
|
388
|
-
field: string;
|
|
389
|
-
desc?: boolean;
|
|
390
|
-
} | string;
|
|
391
|
-
type FilterValue = string | number | boolean | string[] | number[] | boolean[] | null;
|
|
392
|
-
type PositiveFilter = {
|
|
393
|
-
[field: string]: FilterValue;
|
|
394
|
-
};
|
|
395
|
-
type NegativeFilter = {
|
|
396
|
-
$not?: PositiveFilter;
|
|
397
|
-
};
|
|
398
|
-
type Filter = PositiveFilter | NegativeFilter;
|
|
399
|
-
type RawBQLQuery = {
|
|
400
|
-
$id?: string | string[];
|
|
401
|
-
$filter?: Filter;
|
|
402
|
-
$fields?: BQLField[];
|
|
403
|
-
$excludedFields?: BQLField[];
|
|
404
|
-
$sort?: Sorter[];
|
|
405
|
-
$offset?: number;
|
|
406
|
-
$limit?: number;
|
|
407
|
-
} & ({
|
|
408
|
-
$entity: string;
|
|
409
|
-
} | {
|
|
410
|
-
$relation: string;
|
|
411
|
-
} | {
|
|
412
|
-
$thing: string;
|
|
413
|
-
$thingType: 'entity' | 'relation';
|
|
414
|
-
});
|
|
415
|
-
type EnrichedAttributeQuery = {
|
|
416
|
-
$fieldType: 'data';
|
|
417
|
-
$thingType: 'attribute';
|
|
418
|
-
$path: string;
|
|
419
|
-
$dbPath: string;
|
|
420
|
-
$as: string;
|
|
421
|
-
$var: string;
|
|
422
|
-
$justId: boolean;
|
|
423
|
-
$id: string;
|
|
424
|
-
$isVirtual?: boolean;
|
|
425
|
-
[FieldSchema]: EnrichedDataField;
|
|
426
|
-
};
|
|
427
|
-
type PlayedBy = {
|
|
428
|
-
path: string;
|
|
429
|
-
cardinality: 'ONE' | 'MANY';
|
|
430
|
-
relation: string;
|
|
431
|
-
plays: string;
|
|
432
|
-
target: 'role' | 'relation';
|
|
433
|
-
thing: string;
|
|
434
|
-
thingType: 'entity' | 'relation';
|
|
435
|
-
};
|
|
436
|
-
type EnrichedLinkQuery = {
|
|
437
|
-
$fieldType: 'link';
|
|
438
|
-
$thingType: 'entity' | 'relation';
|
|
439
|
-
$thing: string;
|
|
440
|
-
$plays: string;
|
|
441
|
-
$playedBy: PlayedBy;
|
|
442
|
-
$path: string;
|
|
443
|
-
$dbPath: string;
|
|
444
|
-
$as: string;
|
|
445
|
-
$var: string;
|
|
446
|
-
$fields: EnrichedFieldQuery[];
|
|
447
|
-
$target: 'relation' | 'role';
|
|
448
|
-
$intermediary?: string;
|
|
449
|
-
$justId: boolean;
|
|
450
|
-
$id: string;
|
|
451
|
-
$idNotIncluded?: boolean;
|
|
452
|
-
$filter?: Filter;
|
|
453
|
-
$filterByUnique: boolean;
|
|
454
|
-
$sort?: Sorter[];
|
|
455
|
-
$offset?: number;
|
|
456
|
-
$limit?: number;
|
|
457
|
-
[QueryPath]: string;
|
|
458
|
-
[FieldSchema]: EnrichedLinkField;
|
|
459
|
-
};
|
|
460
|
-
type EnrichedRoleQuery = {
|
|
461
|
-
$fieldType: 'role';
|
|
462
|
-
$thingType: 'relation';
|
|
463
|
-
$thing: string;
|
|
464
|
-
$path: string;
|
|
465
|
-
$dbPath: string;
|
|
466
|
-
$as: string;
|
|
467
|
-
$var: string;
|
|
468
|
-
$fields: EnrichedFieldQuery[];
|
|
469
|
-
$intermediary: string;
|
|
470
|
-
$justId: string;
|
|
471
|
-
$id: string;
|
|
472
|
-
$idNotIncluded?: boolean;
|
|
473
|
-
$filter?: Filter;
|
|
474
|
-
$filterByUnique: boolean;
|
|
475
|
-
$playedBy: PlayedBy;
|
|
476
|
-
$sort?: Sorter[];
|
|
477
|
-
$offset?: number;
|
|
478
|
-
$limit?: number;
|
|
479
|
-
[QueryPath]: string;
|
|
480
|
-
[FieldSchema]: EnrichedRoleField;
|
|
481
|
-
};
|
|
482
|
-
type EnrichedFieldQuery = EnrichedAttributeQuery | EnrichedLinkQuery | EnrichedRoleQuery;
|
|
483
|
-
type EnrichedEntityQuery = {
|
|
484
|
-
$id?: string | string[];
|
|
485
|
-
$thingType: 'entity';
|
|
486
|
-
$thing: string;
|
|
487
|
-
$path: string;
|
|
488
|
-
$fields: (EnrichedAttributeQuery | EnrichedLinkQuery)[];
|
|
489
|
-
$idNotIncluded?: boolean;
|
|
490
|
-
$filter?: Filter;
|
|
491
|
-
$filterByUnique: boolean;
|
|
492
|
-
$sort?: Sorter[];
|
|
493
|
-
$offset?: number;
|
|
494
|
-
$limit?: number;
|
|
495
|
-
[QueryPath]: string;
|
|
496
|
-
};
|
|
497
|
-
type EnrichedRelationQuery = {
|
|
498
|
-
$id?: string | string[];
|
|
499
|
-
$thingType: 'relation';
|
|
500
|
-
$thing: string;
|
|
501
|
-
$path: string;
|
|
502
|
-
$fields: EnrichedFieldQuery[];
|
|
503
|
-
$idNotIncluded?: boolean;
|
|
504
|
-
$filter?: Filter;
|
|
505
|
-
$filterByUnique: boolean;
|
|
506
|
-
$sort?: Sorter[];
|
|
507
|
-
$offset?: number;
|
|
508
|
-
$limit?: number;
|
|
509
|
-
[QueryPath]: string;
|
|
510
|
-
};
|
|
511
|
-
type EnrichedBQLQuery = EnrichedEntityQuery | EnrichedRelationQuery;
|
|
512
|
-
|
|
513
|
-
type RequiredKey<T, K extends keyof T> = T & {
|
|
514
|
-
[P in K]-?: T[P];
|
|
515
|
-
};
|
|
516
|
-
type WithRequired<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & RequiredKey<T, K>;
|
|
517
|
-
type BQLMutation = RootBQLMutationBlock | RootBQLMutationBlock[];
|
|
518
|
-
type RootBQLMutationBlock = {
|
|
519
|
-
[key: string]: any;
|
|
520
|
-
$id?: string | string[];
|
|
521
|
-
$filter?: Filter;
|
|
522
|
-
$tempId?: string;
|
|
523
|
-
$op?: string;
|
|
524
|
-
} & ({
|
|
525
|
-
$entity: string;
|
|
526
|
-
} | {
|
|
527
|
-
$relation: string;
|
|
528
|
-
} | {
|
|
529
|
-
$thing: string;
|
|
530
|
-
$thingType?: 'entity' | 'relation';
|
|
531
|
-
});
|
|
532
|
-
type BQLMutationBlock = {
|
|
533
|
-
[key: string]: any;
|
|
534
|
-
$id?: string | string[];
|
|
535
|
-
$filter?: Filter;
|
|
536
|
-
$tempId?: string;
|
|
537
|
-
$op?: string;
|
|
538
|
-
$entity?: string;
|
|
539
|
-
$relation?: string;
|
|
540
|
-
$thing?: string;
|
|
541
|
-
$thingType?: 'entity' | 'relation';
|
|
542
|
-
};
|
|
543
|
-
type FilledBQLMutationBlock = WithRequired<BQLMutationBlock, '$op'> & {
|
|
544
|
-
$entity?: string;
|
|
545
|
-
$relation?: string;
|
|
546
|
-
[Schema]?: EnrichedBormEntity | EnrichedBormRelation;
|
|
547
|
-
[EdgeType]?: 'linkField' | 'roleField';
|
|
548
|
-
};
|
|
549
|
-
type EnrichedBQLMutationBlock = {
|
|
550
|
-
[key: string]: any;
|
|
551
|
-
$id?: string | string[];
|
|
552
|
-
$filter?: Filter;
|
|
553
|
-
$fields?: any[];
|
|
554
|
-
$tempId?: string;
|
|
555
|
-
$op: BormOperation;
|
|
556
|
-
$thing: string;
|
|
557
|
-
$thingType: 'entity' | 'relation';
|
|
558
|
-
[EdgeSchema]?: EnrichedDataField | EnrichedLinkField | EnrichedRoleField;
|
|
559
|
-
[EdgeType]?: 'linkField' | 'roleField';
|
|
560
|
-
[DBNode]?: EnrichedBQLMutationBlock | Record<string, never>;
|
|
561
|
-
};
|
|
562
|
-
type RawBQLMutation<T extends Record<string, any> = Record<string, any>> = ({
|
|
563
|
-
$id?: string;
|
|
564
|
-
$op?: 'create' | 'delete' | 'update';
|
|
565
|
-
$tempId?: string;
|
|
566
|
-
} | {
|
|
567
|
-
$entity: string;
|
|
568
|
-
} | {
|
|
569
|
-
$relation: string;
|
|
570
|
-
}) & T;
|
|
571
|
-
type ParsedBQLMutation = {
|
|
572
|
-
things: BQLMutationBlock[];
|
|
573
|
-
edges: BQLMutationBlock[];
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
type TQLRequest = {
|
|
577
|
-
entity?: string;
|
|
578
|
-
roles?: {
|
|
579
|
-
path: string;
|
|
580
|
-
request: string;
|
|
581
|
-
owner: string;
|
|
582
|
-
}[];
|
|
583
|
-
relations?: {
|
|
584
|
-
relation: string;
|
|
585
|
-
entity: string;
|
|
586
|
-
request: string;
|
|
587
|
-
}[];
|
|
588
|
-
insertionMatches?: string;
|
|
589
|
-
deletionMatches?: string;
|
|
590
|
-
insertions?: string;
|
|
591
|
-
deletions?: string;
|
|
592
|
-
};
|
|
593
|
-
type TQLEntityMutation = {
|
|
594
|
-
entity: string;
|
|
595
|
-
relations?: {
|
|
596
|
-
relation: string;
|
|
597
|
-
entity: string;
|
|
598
|
-
request: string;
|
|
599
|
-
}[];
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
type ContentTypeToType<C extends keyof ContentTypeMapping> = ContentTypeMapping[C];
|
|
603
|
-
type HandleCardinality<T, C extends 'ONE' | 'MANY'> = C extends 'MANY' ? T[] : T;
|
|
604
|
-
type ContentTypeAndCardinality = {
|
|
605
|
-
contentType: keyof ContentTypeMapping;
|
|
606
|
-
cardinality: 'ONE' | 'MANY';
|
|
607
|
-
};
|
|
608
|
-
type ForDataField = {
|
|
609
|
-
path: string;
|
|
610
|
-
contentType: keyof ContentTypeMapping;
|
|
611
|
-
cardinality: 'ONE' | 'MANY';
|
|
612
|
-
};
|
|
613
|
-
type ForLinkField = {
|
|
614
|
-
path: string;
|
|
615
|
-
cardinality: 'ONE' | 'MANY';
|
|
616
|
-
};
|
|
617
|
-
type ForRoleFIeld = {
|
|
618
|
-
cardinality: 'ONE' | 'MANY';
|
|
619
|
-
};
|
|
620
|
-
type BaseSchemaEntity = {
|
|
621
|
-
dataFields: readonly ForDataField[];
|
|
622
|
-
linkFields?: readonly ForLinkField[];
|
|
623
|
-
};
|
|
624
|
-
type BaseSchemaRelation = BaseSchemaEntity & {
|
|
625
|
-
roles?: Record<string, ForRoleFIeld[]>;
|
|
626
|
-
};
|
|
627
|
-
type BaseSchema = BaseSchemaEntity | BaseSchemaRelation;
|
|
628
|
-
type FieldToType<F extends ContentTypeAndCardinality> = HandleCardinality<ContentTypeToType<F['contentType']>, F['cardinality']>;
|
|
629
|
-
type ExtractDataFields<S extends {
|
|
630
|
-
dataFields: readonly ForDataField[];
|
|
631
|
-
}> = {
|
|
632
|
-
[K in S['dataFields'][number]['path']]?: FieldToType<Extract<S['dataFields'][number], {
|
|
633
|
-
path: K;
|
|
634
|
-
}>>;
|
|
635
|
-
};
|
|
636
|
-
type ExtractLinkFields<S> = S extends {
|
|
637
|
-
linkFields?: readonly ForLinkField[];
|
|
638
|
-
} ? S['linkFields'] extends readonly ForLinkField[] ? {
|
|
639
|
-
[K in S['linkFields'][number]['path']]?: HandleCardinality<string, Extract<S['linkFields'][number], {
|
|
640
|
-
path: K;
|
|
641
|
-
}>['cardinality']>;
|
|
642
|
-
} : {} : {};
|
|
643
|
-
type ExtractRoles<S> = 'roles' extends keyof S ? {
|
|
644
|
-
[K in keyof S['roles']]?: S['roles'][K] extends {
|
|
645
|
-
cardinality: 'ONE' | 'MANY';
|
|
646
|
-
} ? HandleCardinality<string, S['roles'][K]['cardinality']> : never;
|
|
647
|
-
} : {};
|
|
648
|
-
type TypeGen<S extends BaseSchema> = ExtractDataFields<S> & ExtractLinkFields<S> & ExtractRoles<S>;
|
|
649
|
-
|
|
650
|
-
type Request = {
|
|
651
|
-
rawBqlRequest: RawBQLQuery;
|
|
652
|
-
filledBqlRequest?: FilledBQLMutationBlock[] | FilledBQLMutationBlock;
|
|
653
|
-
bqlRequest?: {
|
|
654
|
-
query?: EnrichedBQLQuery;
|
|
655
|
-
mutation?: ParsedBQLMutation;
|
|
656
|
-
};
|
|
657
|
-
schema: EnrichedBormSchema;
|
|
658
|
-
config: BormConfig;
|
|
659
|
-
tqlRequest?: TQLRequest;
|
|
660
|
-
dbHandles: DBHandles;
|
|
661
|
-
enrichedBqlQuery?: any;
|
|
662
|
-
};
|
|
663
|
-
type BaseResponse = {
|
|
664
|
-
bqlRes?: BQLResponse | null;
|
|
665
|
-
};
|
|
666
|
-
type NextPipeline<Res extends BaseResponse> = {
|
|
667
|
-
req: Request;
|
|
668
|
-
res: Res;
|
|
669
|
-
pipeline: Pipeline<Res>;
|
|
670
|
-
};
|
|
671
|
-
type PipelineOperation<Res extends BaseResponse> = (req: Request, res: Res) => Promise<void | NextPipeline<Res>[]>;
|
|
672
|
-
type Pipeline<Res extends BaseResponse> = PipelineOperation<Res>[];
|
|
673
|
-
|
|
674
|
-
type BormProps = {
|
|
675
|
-
schema: BormSchema;
|
|
676
|
-
config: BormConfig;
|
|
677
|
-
};
|
|
678
|
-
declare class BormClient {
|
|
679
|
-
#private;
|
|
680
|
-
private schema;
|
|
681
|
-
private config;
|
|
682
|
-
private dbHandles?;
|
|
683
|
-
constructor({ schema, config }: BormProps);
|
|
684
|
-
getDbHandles: () => DBHandles | undefined;
|
|
685
|
-
init: () => Promise<void>;
|
|
686
|
-
introspect: () => Promise<BormSchema>;
|
|
687
|
-
define: () => Promise<void>;
|
|
688
|
-
query: (query: RawBQLQuery | RawBQLQuery[], queryConfig?: QueryConfig) => Promise<BQLResponseSingle | BQLResponse[]>;
|
|
689
|
-
mutate: (mutation: BQLMutation, mutationConfig?: MutationConfig) => Promise<BQLResponseMulti>;
|
|
690
|
-
close: () => Promise<void>;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
export { type Action, type BQLField, type BQLFieldObj, type BQLMutation, type BQLMutationBlock, type BQLResponse, type BQLResponseMulti, type BQLResponseSingle, type BaseResponse, type BormConfig, type BormEntity, type BormField, type BormMetadata, type BormOperation, type BormRelation, type BormSchema, type BormTrigger, type Cardinality, type CommonProvider, type ContentType, type ContentTypeMapping, type DBConnector, type DBHandleKey, type DBHandles, type DataField, type DiscreteCardinality, type EnrichedAttributeQuery, type EnrichedBQLMutationBlock, type EnrichedBQLQuery, type EnrichedBormEntity, type EnrichedBormRelation, type EnrichedBormSchema, type EnrichedDataField, type EnrichedEntityQuery, type EnrichedFieldQuery, type EnrichedLinkField, type EnrichedLinkQuery, type EnrichedRelationQuery, type EnrichedRoleField, type EnrichedRoleQuery, type FilledBQLMutationBlock, type Filter, type FilterValue, type Hooks, type LinkField, type LinkedFieldWithThing, type MutationConfig, type NegativeFilter, type NodeFunctionParams, type ParsedBQLMutation, type Pipeline, type PipelineOperation, type PlayedBy, type PositiveFilter, type PreHook, type Provider, type QueryConfig, type RawBQLMutation, type RawBQLQuery, type Request, type RightType, type RoleField, type RootBQLMutationBlock, type Sorter, type TQLEntityMutation, type TQLRequest, type ThingType, type TransFormAction, type TypeDBClusterProvider, type TypeDBHandles, type TypeDBProvider, type TypeGen, type ValidateAction, type WithBormMetadata, BormClient as default };
|