@blitznocode/blitz-orm 0.15.6 → 0.17.0

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.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as surrealdb from 'surrealdb';
1
2
  import { BoundQuery } from 'surrealdb';
2
3
  import { TypeDBDriver, TypeDBSession } from 'typedb-driver';
3
4
 
@@ -25,17 +26,14 @@ declare class SurrealClient {
25
26
  connect(): Promise<void>;
26
27
  close(): Promise<void>;
27
28
  query<T>(query: string | BoundQuery, bindings?: Record<string, unknown>): Promise<T[]>;
29
+ beginTransaction(): Promise<surrealdb.SurrealTransaction>;
28
30
  get state(): ConnectionState;
29
31
  get version(): string | null;
30
32
  get latestError(): string;
31
33
  }
32
34
 
33
- type SurrealDBProviderConfig = {
34
- linkMode: 'edges' | 'refs';
35
- };
36
35
  interface SurrealDBProviderObject extends CommonProvider {
37
36
  provider: 'surrealDB';
38
- providerConfig: SurrealDBProviderConfig;
39
37
  url: string;
40
38
  namespace: string;
41
39
  username: string;
@@ -43,7 +41,6 @@ interface SurrealDBProviderObject extends CommonProvider {
43
41
  }
44
42
  type SurrealDBHandles = Map<string, {
45
43
  client: SurrealClient;
46
- providerConfig: SurrealDBProviderConfig;
47
44
  }>;
48
45
 
49
46
  interface TypeDBProvider extends CommonProvider {
@@ -67,7 +64,6 @@ type QueryConfig = {
67
64
  returnNulls?: boolean;
68
65
  simplifiedLinks?: boolean;
69
66
  debugger?: boolean;
70
- legacySurrealDBAdapter?: boolean;
71
67
  };
72
68
  type MutationConfig = {
73
69
  noMetadata?: boolean;
@@ -180,6 +176,7 @@ type BormField = {
180
176
  };
181
177
  type RoleField = {
182
178
  cardinality: DiscreteCardinality;
179
+ onDelete?: 'CASCADE' | 'UNSET' | 'IGNORE';
183
180
  dbConnector?: DBConnector;
184
181
  };
185
182
  type RefField = {
@@ -228,10 +225,10 @@ type StringField = BormField & {
228
225
  contentType: 'ID' | 'COLOR' | 'DATE' | 'FILE' | 'EMAIL' | 'PHONE' | 'URL' | 'PASSWORD' | 'LANGUAGE_TEXT' | 'RICH_TEXT' | 'TEXT' | 'JSON';
229
226
  default?: {
230
227
  type: 'fn';
231
- fn: (currentNode: BQLMutationBlock) => string;
228
+ fn: (currentNode: BQLMutationBlock) => string | null;
232
229
  } | {
233
230
  type: 'value';
234
- value: string;
231
+ value: string | null;
235
232
  };
236
233
  validations?: {
237
234
  enum?: string[];
@@ -243,10 +240,10 @@ type NumberField = BormField & {
243
240
  contentType: 'DURATION' | 'HOUR' | 'RATING' | 'CURRENCY' | 'PERCENTAGE' | 'NUMBER_DECIMAL' | 'NUMBER';
244
241
  default?: {
245
242
  type: 'fn';
246
- fn: (currentNode: BQLMutationBlock) => number;
243
+ fn: (currentNode: BQLMutationBlock) => number | null;
247
244
  } | {
248
245
  type: 'value';
249
- value: number;
246
+ value: number | null;
250
247
  };
251
248
  validations?: {
252
249
  enum?: number[];
@@ -258,10 +255,10 @@ type DateField = BormField & {
258
255
  contentType: 'TIME';
259
256
  default?: {
260
257
  type: 'fn';
261
- fn: (currentNode: BQLMutationBlock) => Date;
258
+ fn: (currentNode: BQLMutationBlock) => Date | null;
262
259
  } | {
263
260
  type: 'value';
264
- value: Date;
261
+ value: Date | null;
265
262
  };
266
263
  validations?: {
267
264
  enum: Date[];
@@ -272,10 +269,10 @@ type BooleanField = BormField & {
272
269
  contentType: 'BOOLEAN';
273
270
  default?: {
274
271
  type: 'fn';
275
- fn: (currentNode: BQLMutationBlock) => boolean;
272
+ fn: (currentNode: BQLMutationBlock) => boolean | null;
276
273
  } | {
277
274
  type: 'value';
278
- value: boolean;
275
+ value: boolean | null;
279
276
  };
280
277
  validations?: {
281
278
  enum?: boolean[];