wabe 0.6.4 → 0.6.5

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.
Files changed (90) hide show
  1. package/README.md +2 -1
  2. package/dist/ai/index.d.ts +1 -0
  3. package/dist/ai/interface.d.ts +9 -0
  4. package/dist/authentication/OTP.d.ts +8 -0
  5. package/dist/authentication/Session.d.ts +21 -0
  6. package/dist/authentication/defaultAuthentication.d.ts +3 -0
  7. package/dist/authentication/index.d.ts +2 -0
  8. package/dist/authentication/interface.d.ts +118 -0
  9. package/dist/authentication/oauth/GitHub.d.ts +13 -0
  10. package/dist/authentication/oauth/Google.d.ts +13 -0
  11. package/dist/authentication/oauth/Oauth2Client.d.ts +33 -0
  12. package/dist/authentication/oauth/index.d.ts +2 -0
  13. package/dist/authentication/oauth/utils.d.ts +14 -0
  14. package/dist/authentication/providers/EmailOTP.d.ts +11 -0
  15. package/dist/authentication/providers/EmailPassword.d.ts +13 -0
  16. package/dist/authentication/providers/GitHub.d.ts +12 -0
  17. package/dist/authentication/providers/Google.d.ts +12 -0
  18. package/dist/authentication/providers/OAuth.d.ts +6 -0
  19. package/dist/authentication/providers/PhonePassword.d.ts +13 -0
  20. package/dist/authentication/providers/index.d.ts +5 -0
  21. package/dist/authentication/resolvers/refreshResolver.d.ts +1 -0
  22. package/dist/authentication/resolvers/signInWithResolver.d.ts +1 -0
  23. package/dist/authentication/resolvers/signOutResolver.d.ts +1 -0
  24. package/dist/authentication/resolvers/signUpWithResolver.d.ts +1 -0
  25. package/dist/authentication/resolvers/verifyChallenge.d.ts +1 -0
  26. package/dist/authentication/roles.d.ts +1 -0
  27. package/dist/authentication/srp/processSRPChallenge.d.ts +1 -0
  28. package/dist/authentication/srp/signInWithSRP.d.ts +1 -0
  29. package/dist/authentication/srp/signUpWithSRP.d.ts +1 -0
  30. package/dist/authentication/utils.d.ts +8 -0
  31. package/dist/cron/index.d.ts +32 -0
  32. package/dist/database/adapters/MongoAdapter.d.ts +64 -0
  33. package/dist/database/adapters/adaptersInterface.d.ts +263 -0
  34. package/dist/database/adapters/index.d.ts +2 -0
  35. package/dist/database/controllers/DatabaseController.d.ts +90 -0
  36. package/dist/database/controllers/index.d.ts +1 -0
  37. package/dist/database/index.d.ts +10 -0
  38. package/dist/email/DevAdapter.d.ts +4 -0
  39. package/dist/email/EmailController.d.ts +6 -0
  40. package/dist/email/index.d.ts +2 -0
  41. package/dist/email/interface.d.ts +35 -0
  42. package/dist/email/templates/sendOtpCode.d.ts +1 -0
  43. package/dist/files/FileController.d.ts +10 -0
  44. package/dist/files/FileDevAdapter.d.ts +8 -0
  45. package/dist/files/hookDeleteFile.d.ts +1 -0
  46. package/dist/files/hookReadFile.d.ts +1 -0
  47. package/dist/files/hookUploadFile.d.ts +2 -0
  48. package/dist/files/index.d.ts +2 -0
  49. package/dist/files/interface.d.ts +30 -0
  50. package/dist/graphql/GraphQLSchema.d.ts +75 -0
  51. package/dist/graphql/index.d.ts +2 -0
  52. package/dist/graphql/parser.d.ts +38 -0
  53. package/dist/graphql/pointerAndRelationFunction.d.ts +20 -0
  54. package/dist/graphql/resolvers.d.ts +20 -0
  55. package/dist/graphql/types.d.ts +18 -0
  56. package/dist/hooks/HookObject.d.ts +39 -0
  57. package/dist/hooks/authentication.d.ts +2 -0
  58. package/dist/hooks/defaultFields.d.ts +3 -0
  59. package/dist/hooks/deleteSession.d.ts +1 -0
  60. package/dist/hooks/index.d.ts +41 -0
  61. package/dist/hooks/permissions.d.ts +6 -0
  62. package/dist/hooks/protected.d.ts +3 -0
  63. package/dist/hooks/searchableFields.d.ts +3 -0
  64. package/dist/hooks/session.d.ts +3 -0
  65. package/dist/hooks/setEmail.d.ts +2 -0
  66. package/dist/hooks/setupAcl.d.ts +2 -0
  67. package/dist/index.d.ts +11 -1469
  68. package/dist/index.js +486 -76827
  69. package/dist/payment/DevAdapter.d.ts +17 -0
  70. package/dist/payment/PaymentController.d.ts +19 -0
  71. package/dist/payment/index.d.ts +2 -0
  72. package/dist/payment/interface.d.ts +235 -0
  73. package/dist/schema/Schema.d.ts +164 -0
  74. package/dist/schema/defaultResolvers.d.ts +7 -0
  75. package/dist/schema/index.d.ts +1 -0
  76. package/dist/schema/resolvers/meResolver.d.ts +1 -0
  77. package/dist/schema/resolvers/resetPassword.d.ts +1 -0
  78. package/dist/schema/resolvers/sendEmail.d.ts +1 -0
  79. package/dist/schema/resolvers/sendOtpCode.d.ts +1 -0
  80. package/dist/server/defaultHandlers.d.ts +1 -0
  81. package/dist/server/generateCodegen.d.ts +1 -0
  82. package/dist/server/index.d.ts +77 -0
  83. package/dist/server/routes/authHandler.d.ts +2 -0
  84. package/dist/server/routes/index.d.ts +8 -0
  85. package/dist/utils/export.d.ts +2 -0
  86. package/dist/utils/helper.d.ts +21 -0
  87. package/dist/utils/index.d.ts +17 -0
  88. package/generated/schema.graphql +126 -21
  89. package/generated/wabe.ts +135 -25
  90. package/package.json +8 -7
package/dist/index.d.ts CHANGED
@@ -1,1469 +1,11 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- /// <reference types="react" />
4
-
5
- import { Context, CorsOptions, RateLimitOptions, Wobe, WobeHandler, WobeResponse } from 'wobe';
6
-
7
- declare enum RoleEnum {
8
- Admin = "Admin",
9
- Client = "Client"
10
- }
11
- declare enum AuthenticationProvider {
12
- github = "github",
13
- google = "google",
14
- emailPassword = "emailPassword",
15
- phonePassword = "phonePassword"
16
- }
17
- declare enum SecondaryFactor {
18
- EmailOTP = "emailOTP"
19
- }
20
- export type ACLObjectUsersACL = {
21
- userId: string;
22
- read: boolean;
23
- write: boolean;
24
- };
25
- export type ACLObject = {
26
- users?: Array<ACLObjectUsersACL>;
27
- roles?: Array<ACLObjectRolesACL>;
28
- };
29
- export type ACLObjectRolesACL = {
30
- roleId: string;
31
- read: boolean;
32
- write: boolean;
33
- };
34
- export type AuthenticationPhonePassword = {
35
- phone: string;
36
- password: string;
37
- };
38
- export type Authentication = {
39
- phonePassword?: AuthenticationPhonePassword;
40
- emailPassword?: AuthenticationEmailPassword;
41
- google?: AuthenticationGoogle;
42
- github?: AuthenticationGithub;
43
- };
44
- export type AuthenticationEmailPassword = {
45
- email: string;
46
- password: string;
47
- };
48
- export type AuthenticationGoogle = {
49
- email: string;
50
- verifiedEmail: boolean;
51
- };
52
- export type AuthenticationGithub = {
53
- email: string;
54
- avatarUrl: string;
55
- username: string;
56
- };
57
- export type User = {
58
- id: string;
59
- name?: string;
60
- age?: number;
61
- email?: string;
62
- acl?: ACLObject;
63
- createdAt?: string;
64
- updatedAt?: string;
65
- search?: Array<string>;
66
- authentication?: Authentication;
67
- provider?: AuthenticationProvider;
68
- isOauth?: boolean;
69
- verifiedEmail?: boolean;
70
- role?: Role;
71
- sessions?: Array<_Session>;
72
- };
73
- export type Experience = {
74
- jobTitle: string;
75
- companyName: string;
76
- startDate: string;
77
- endDate: string;
78
- achievements?: Array<string>;
79
- };
80
- export type Post = {
81
- id: string;
82
- name: string;
83
- test2?: RoleEnum;
84
- test3: Array<User>;
85
- test4: User;
86
- experiences?: Array<Experience>;
87
- acl?: ACLObject;
88
- createdAt?: string;
89
- updatedAt?: string;
90
- search?: Array<string>;
91
- };
92
- export type _Session = {
93
- id: string;
94
- user: User;
95
- accessToken: string;
96
- accessTokenExpiresAt: string;
97
- refreshToken?: string;
98
- refreshTokenExpiresAt: string;
99
- acl?: ACLObject;
100
- createdAt?: string;
101
- updatedAt?: string;
102
- search?: Array<string>;
103
- };
104
- export type Role = {
105
- id: string;
106
- name: string;
107
- users?: Array<User>;
108
- acl?: ACLObject;
109
- createdAt?: string;
110
- updatedAt?: string;
111
- search?: Array<string>;
112
- };
113
- export type _InternalConfig = {
114
- id: string;
115
- configKey: string;
116
- configValue: string;
117
- description?: string;
118
- acl?: ACLObject;
119
- createdAt?: string;
120
- updatedAt?: string;
121
- search?: Array<string>;
122
- };
123
- export type SignInWithInput = {
124
- authentication: SignInWithAuthentication;
125
- };
126
- export type SignInWithAuthenticationPhonePassword = {
127
- phone: string;
128
- password: string;
129
- };
130
- export type SignInWithAuthentication = {
131
- phonePassword?: SignInWithAuthenticationPhonePassword;
132
- emailPassword?: SignInWithAuthenticationEmailPassword;
133
- google?: SignInWithAuthenticationGoogle;
134
- github?: SignInWithAuthenticationGithub;
135
- otp?: SignInWithAuthenticationOtp;
136
- secondaryFactor?: SecondaryFactor;
137
- };
138
- export type SignInWithAuthenticationEmailPassword = {
139
- email: string;
140
- password: string;
141
- };
142
- export type SignInWithAuthenticationGoogle = {
143
- authorizationCode: string;
144
- codeVerifier: string;
145
- };
146
- export type SignInWithAuthenticationGithub = {
147
- authorizationCode: string;
148
- codeVerifier: string;
149
- };
150
- export type SignInWithAuthenticationOtp = {
151
- code?: string;
152
- };
153
- export type SignUpWithInput = {
154
- authentication: SignUpWithAuthentication;
155
- };
156
- export type SignUpWithAuthenticationPhonePassword = {
157
- phone: string;
158
- password: string;
159
- };
160
- export type SignUpWithAuthentication = {
161
- phonePassword?: SignUpWithAuthenticationPhonePassword;
162
- emailPassword?: SignUpWithAuthenticationEmailPassword;
163
- google?: SignUpWithAuthenticationGoogle;
164
- github?: SignUpWithAuthenticationGithub;
165
- otp?: SignUpWithAuthenticationOtp;
166
- secondaryFactor?: SecondaryFactor;
167
- };
168
- export type SignUpWithAuthenticationEmailPassword = {
169
- email: string;
170
- password: string;
171
- };
172
- export type SignUpWithAuthenticationGoogle = {
173
- authorizationCode: string;
174
- codeVerifier: string;
175
- };
176
- export type SignUpWithAuthenticationGithub = {
177
- authorizationCode: string;
178
- codeVerifier: string;
179
- };
180
- export type SignUpWithAuthenticationOtp = {
181
- code?: string;
182
- };
183
- export type WabeSchemaScalars = "";
184
- export type WabeSchemaEnums = {
185
- RoleEnum: RoleEnum;
186
- AuthenticationProvider: AuthenticationProvider;
187
- SecondaryFactor: SecondaryFactor;
188
- };
189
- export type WabeSchemaTypes = {
190
- User: User;
191
- Post: Post;
192
- _Session: _Session;
193
- Role: Role;
194
- _InternalConfig: _InternalConfig;
195
- };
196
- export interface WabeContext<T extends WabeTypes> {
197
- response?: WobeResponse;
198
- user?: User | null;
199
- sessionId?: string | null;
200
- isRoot: boolean;
201
- wabe: Wabe<T>;
202
- }
203
- export type IsScalar<T> = T extends string | number | boolean ? true : false;
204
- export type IsArray<T> = T extends Array<any> ? true : false;
205
- export type IsObject<T, K extends WabeTypes> = T extends object ? T extends K["types"][keyof K["types"]] ? false : true : false;
206
- export type ExtractType<T extends WabeTypes, ClassName extends keyof T["types"], FieldName extends keyof T["types"][ClassName]> = T["types"][ClassName][FieldName];
207
- export type WhereScalar<T> = {
208
- equalTo?: T;
209
- notEqualTo?: T;
210
- greaterThan?: T;
211
- lessThan?: T;
212
- greaterThanOrEqualTo?: T;
213
- lessThanOrEqualTo?: T;
214
- in?: T[];
215
- notIn?: T[];
216
- contains?: T;
217
- notContains?: T;
218
- };
219
- export type WhereObject<T> = {
220
- [P in keyof T]: IsScalar<T[P]> extends false ? WhereObject<Partial<T[P]>> : WhereScalar<T[P]>;
221
- };
222
- export type WhereAggregation<T extends WabeTypes, K extends keyof T["types"]> = {
223
- [P in keyof T["types"][K]]: IsScalar<ExtractType<T, K, P>> extends false ? WhereObject<Partial<ExtractType<T, K, P>>> : WhereScalar<ExtractType<T, K, P>>;
224
- };
225
- export type WhereConditional<T extends WabeTypes, K extends keyof T["types"]> = {
226
- OR?: Array<WhereType<T, K>>;
227
- AND?: Array<WhereType<T, K>>;
228
- };
229
- export type WhereType<T extends WabeTypes, K extends keyof T["types"]> = Partial<WhereAggregation<T, K>> & WhereConditional<T, K>;
230
- export type SelectObject<T, K extends WabeTypes, Depth extends number = 3> = {
231
- [P in keyof T]: IsScalar<T[P]> extends true ? boolean : IsArray<T[P]> extends true ? T[P] extends Array<infer Item> ? (Depth extends 0 ? boolean : SelectObject<Partial<Item>, K, Decrement<Depth>>) | boolean : boolean : IsObject<[
232
- P
233
- ], K> extends true ? (Depth extends 0 ? boolean : SelectObject<Partial<T[P]>, K, Decrement<Depth>>) | boolean : boolean;
234
- };
235
- export type Decrement<N extends number> = [
236
- -1,
237
- 0,
238
- 1,
239
- 2,
240
- 3,
241
- 4,
242
- 5,
243
- 6,
244
- 7,
245
- 8,
246
- 9,
247
- 10
248
- ][N];
249
- export type SelectType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], Depth extends number = 3> = Partial<{
250
- [P in U]: IsScalar<ExtractType<T, K, P>> extends true ? boolean : IsArray<ExtractType<T, K, P>> extends true ? ExtractType<T, K, P> extends Array<infer Item> ? (Depth extends 0 ? boolean : SelectObject<Partial<Item>, T, Decrement<Depth>>) | boolean : boolean : ExtractType<T, K, P> extends object ? (Depth extends 0 ? boolean : SelectObject<Partial<ExtractType<T, K, P>>, T, Decrement<Depth>>) | boolean : boolean;
251
- }>;
252
- export type OrderType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = Record<U, "ASC" | "DESC">;
253
- export type OutputType<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = (Pick<T["types"][K], U> & {
254
- id: string;
255
- }) | null;
256
- export interface AdapterOptions {
257
- databaseUrl: string;
258
- databaseName: string;
259
- }
260
- export type MutationData<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> = Record<U, any>;
261
- export interface CountOptions<T extends WabeTypes, K extends keyof T["types"]> {
262
- className: K;
263
- where?: WhereType<T, K>;
264
- context: WabeContext<any>;
265
- }
266
- export interface GetObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> {
267
- className: K;
268
- id: string;
269
- where?: WhereType<T, K>;
270
- context: WabeContext<any>;
271
- skipHooks?: boolean;
272
- select?: SelectType<T, K, U>;
273
- isGraphQLCall?: boolean;
274
- }
275
- export interface GetObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
276
- className: K;
277
- where?: WhereType<T, K>;
278
- order?: OrderType<T, K, U>;
279
- offset?: number;
280
- first?: number;
281
- context: WabeContext<any>;
282
- skipHooks?: boolean;
283
- select?: SelectType<T, K, W>;
284
- isGraphQLCall?: boolean;
285
- }
286
- export interface CreateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
287
- className: K;
288
- data: MutationData<T, K, U>;
289
- context: WabeContext<any>;
290
- select?: SelectType<T, K, W>;
291
- isGraphQLCall?: boolean;
292
- }
293
- export interface CreateObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]> {
294
- className: K;
295
- data: Array<MutationData<T, K, U>>;
296
- offset?: number;
297
- first?: number;
298
- order?: OrderType<T, U, X>;
299
- context: WabeContext<any>;
300
- select?: SelectType<T, K, W>;
301
- isGraphQLCall?: boolean;
302
- }
303
- export interface UpdateObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
304
- className: K;
305
- id: string;
306
- where?: WhereType<T, K>;
307
- data: MutationData<T, K, U>;
308
- context: WabeContext<any>;
309
- skipHooks?: boolean;
310
- select?: SelectType<T, K, W>;
311
- isGraphQLCall?: boolean;
312
- }
313
- export interface UpdateObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]> {
314
- className: K;
315
- where: WhereType<T, K>;
316
- order?: OrderType<T, K, X>;
317
- data: MutationData<T, K, U>;
318
- offset?: number;
319
- first?: number;
320
- context: WabeContext<any>;
321
- skipHooks?: boolean;
322
- select?: SelectType<T, K, W>;
323
- isGraphQLCall?: boolean;
324
- }
325
- export interface DeleteObjectOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]> {
326
- className: K;
327
- id: string;
328
- where?: WhereType<T, K>;
329
- context: WabeContext<any>;
330
- select?: SelectType<T, K, U>;
331
- isGraphQLCall?: boolean;
332
- }
333
- export interface DeleteObjectsOptions<T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]> {
334
- className: K;
335
- where: WhereType<T, K>;
336
- order?: OrderType<T, K, U>;
337
- offset?: number;
338
- first?: number;
339
- context: WabeContext<any>;
340
- select?: SelectType<T, K, W>;
341
- isGraphQLCall?: boolean;
342
- }
343
- export interface DatabaseAdapter<T extends WabeTypes> {
344
- connect(): Promise<any>;
345
- close(): Promise<any>;
346
- createClassIfNotExist(className: string, context: WabeContext<any>): Promise<any>;
347
- clearDatabase(): Promise<void>;
348
- count<T extends WabeTypes, K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
349
- getObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
350
- getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
351
- createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: CreateObjectOptions<T, K, U, W>): Promise<{
352
- id: string;
353
- }>;
354
- createObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>(params: CreateObjectsOptions<T, K, U, W, X>): Promise<Array<{
355
- id: string;
356
- }>>;
357
- updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: UpdateObjectOptions<T, K, U, W>): Promise<{
358
- id: string;
359
- }>;
360
- updateObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>(params: UpdateObjectsOptions<T, K, U, W, X>): Promise<Array<{
361
- id: string;
362
- }>>;
363
- deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: DeleteObjectOptions<T, K, U>): Promise<void>;
364
- deleteObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: DeleteObjectsOptions<T, K, U, W>): Promise<void>;
365
- }
366
- export declare const buildMongoOrderQuery: <T extends WabeTypes, K extends keyof T["types"], U extends keyof T["types"][K]>(order?: OrderType<T, K, U>) => Record<string, any>;
367
- export declare const buildMongoWhereQuery: <T extends WabeTypes, K extends keyof T["types"]>(where?: WhereType<T, K>) => Record<string, any>;
368
- export declare class MongoAdapter<T extends WabeTypes> implements DatabaseAdapter<T> {
369
- options: AdapterOptions;
370
- database?: Db;
371
- client: MongoClient;
372
- constructor(options: AdapterOptions);
373
- connect(): Promise<MongoClient>;
374
- close(): Promise<void>;
375
- createClassIfNotExist(className: keyof T["types"], context: WabeContext<T>): Promise<import("mongodb").Collection<import("bson").Document>>;
376
- count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
377
- clearDatabase(): Promise<void>;
378
- getObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
379
- getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
380
- createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: CreateObjectOptions<T, K, U, W>): Promise<{
381
- id: string;
382
- }>;
383
- createObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>(params: CreateObjectsOptions<T, K, U, W, X>): Promise<{
384
- id: string;
385
- }[]>;
386
- updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>(params: UpdateObjectOptions<T, K, U, W>): Promise<{
387
- id: string;
388
- }>;
389
- updateObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>(params: UpdateObjectsOptions<T, K, U, W, X>): Promise<{
390
- id: any;
391
- }[]>;
392
- deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>(params: DeleteObjectOptions<T, K, U>): Promise<void>;
393
- deleteObjects<K extends keyof T["types"], U extends keyof T["types"][U], W extends keyof T["types"][U]>(params: DeleteObjectsOptions<T, K, U, W>): Promise<void>;
394
- }
395
- export type Select = Record<string, boolean>;
396
- export type SelectWithObject = Record<string, object | boolean>;
397
- export declare class DatabaseController<T extends WabeTypes> {
398
- adapter: DatabaseAdapter<T>;
399
- constructor(adapter: DatabaseAdapter<T>);
400
- _getSelectMinusPointersAndRelations({ className, context, select, }: {
401
- className: keyof T["types"];
402
- context: WabeContext<T>;
403
- select?: SelectWithObject;
404
- }): {
405
- pointers: Record<string, {
406
- className: string;
407
- select: Select;
408
- }>;
409
- selectWithoutPointers: Select;
410
- };
411
- _isRelationField({ pointerField, currentClassName, context, originClassName, }: {
412
- pointerField: string;
413
- originClassName: string;
414
- context: WabeContext<T>;
415
- currentClassName?: string;
416
- }): boolean | undefined;
417
- _isPointerField({ pointerField, currentClassName, context, originClassName, }: {
418
- originClassName: string;
419
- context: WabeContext<T>;
420
- pointerField: string;
421
- currentClassName?: string;
422
- }): boolean | undefined;
423
- _getWhereObjectWithPointerOrRelation<U extends keyof T["types"]>(className: U, where: WhereType<T, U>, context: WabeContext<T>): Promise<Partial<{
424
- [P in keyof T["types"][U]]: (T["types"][U][P] extends infer T_1 ? T_1 extends T["types"][U][P] ? T_1 extends string | number | boolean ? true : false : never : never) extends false ? Partial<T["types"][U][P]> extends infer T_2 ? {
425
- [P_1 in keyof T_2]: (Partial<T["types"][U][P]>[P_1] extends infer T_3 ? T_3 extends Partial<T["types"][U][P]>[P_1] ? T_3 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<T["types"][U][P]>[P_1]> extends infer T_4 ? {
426
- [P_2 in keyof T_4]: (Partial<Partial<T["types"][U][P]>[P_1]>[P_2] extends infer T_5 ? T_5 extends Partial<Partial<T["types"][U][P]>[P_1]>[P_2] ? T_5 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]> extends infer T_6 ? {
427
- [P_3 in keyof T_6]: (Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] extends infer T_7 ? T_7 extends Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] ? T_7 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]> extends infer T_8 ? {
428
- [P_4 in keyof T_8]: (Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] extends infer T_9 ? T_9 extends Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] ? T_9 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]> extends infer T_10 ? {
429
- [P_5 in keyof T_10]: (Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] extends infer T_11 ? T_11 extends Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] ? T_11 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]> extends infer T_12 ? {
430
- [P_6 in keyof T_12]: (Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] extends infer T_13 ? T_13 extends Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] ? T_13 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]> extends infer T_14 ? {
431
- [P_7 in keyof T_14]: (Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] extends infer T_15 ? T_15 extends Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] ? T_15 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]> extends infer T_16 ? {
432
- [P_8 in keyof T_16]: (Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] extends infer T_17 ? T_17 extends Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] ? T_17 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]> extends infer T_18 ? {
433
- [P_9 in keyof T_18]: (Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] extends infer T_19 ? T_19 extends Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] ? T_19 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]> extends infer T_20 ? {
434
- [P_10 in keyof T_20]: (Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] extends infer T_21 ? T_21 extends Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] ? T_21 extends string | number | boolean ? true : false : never : never) extends false ? Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]> extends infer T_22 ? {
435
- [P_11 in keyof T_22]: (Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] extends infer T_23 ? T_23 extends Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] ? T_23 extends string | number | boolean ? true : false : never : never) extends false ? any : {
436
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
437
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
438
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
439
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
440
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
441
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
442
- in?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11][] | undefined;
443
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11][] | undefined;
444
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
445
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10]>[P_11] | undefined;
446
- };
447
- } : never : {
448
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
449
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
450
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
451
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
452
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
453
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
454
- in?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10][] | undefined;
455
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10][] | undefined;
456
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
457
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9]>[P_10] | undefined;
458
- };
459
- } : never : {
460
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
461
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
462
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
463
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
464
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
465
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
466
- in?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9][] | undefined;
467
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9][] | undefined;
468
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
469
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8]>[P_9] | undefined;
470
- };
471
- } : never : {
472
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
473
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
474
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
475
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
476
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
477
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
478
- in?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8][] | undefined;
479
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8][] | undefined;
480
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
481
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7]>[P_8] | undefined;
482
- };
483
- } : never : {
484
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
485
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
486
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
487
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
488
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
489
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
490
- in?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7][] | undefined;
491
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7][] | undefined;
492
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
493
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6]>[P_7] | undefined;
494
- };
495
- } : never : {
496
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
497
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
498
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
499
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
500
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
501
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
502
- in?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6][] | undefined;
503
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6][] | undefined;
504
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
505
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
506
- };
507
- } : never : {
508
- equalTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
509
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
510
- greaterThan?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
511
- lessThan?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
512
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
513
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
514
- in?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5][] | undefined;
515
- notIn?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5][] | undefined;
516
- contains?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
517
- notContains?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
518
- };
519
- } : never : {
520
- equalTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
521
- notEqualTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
522
- greaterThan?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
523
- lessThan?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
524
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
525
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
526
- in?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4][] | undefined;
527
- notIn?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4][] | undefined;
528
- contains?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
529
- notContains?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
530
- };
531
- } : never : {
532
- equalTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
533
- notEqualTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
534
- greaterThan?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
535
- lessThan?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
536
- greaterThanOrEqualTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
537
- lessThanOrEqualTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
538
- in?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3][] | undefined;
539
- notIn?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3][] | undefined;
540
- contains?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
541
- notContains?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
542
- };
543
- } : never : {
544
- equalTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
545
- notEqualTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
546
- greaterThan?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
547
- lessThan?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
548
- greaterThanOrEqualTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
549
- lessThanOrEqualTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
550
- in?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2][] | undefined;
551
- notIn?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2][] | undefined;
552
- contains?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
553
- notContains?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
554
- };
555
- } : never : {
556
- equalTo?: Partial<T["types"][U][P]>[P_1] | undefined;
557
- notEqualTo?: Partial<T["types"][U][P]>[P_1] | undefined;
558
- greaterThan?: Partial<T["types"][U][P]>[P_1] | undefined;
559
- lessThan?: Partial<T["types"][U][P]>[P_1] | undefined;
560
- greaterThanOrEqualTo?: Partial<T["types"][U][P]>[P_1] | undefined;
561
- lessThanOrEqualTo?: Partial<T["types"][U][P]>[P_1] | undefined;
562
- in?: Partial<T["types"][U][P]>[P_1][] | undefined;
563
- notIn?: Partial<T["types"][U][P]>[P_1][] | undefined;
564
- contains?: Partial<T["types"][U][P]>[P_1] | undefined;
565
- notContains?: Partial<T["types"][U][P]>[P_1] | undefined;
566
- };
567
- } : never : {
568
- equalTo?: T["types"][U][P] | undefined;
569
- notEqualTo?: T["types"][U][P] | undefined;
570
- greaterThan?: T["types"][U][P] | undefined;
571
- lessThan?: T["types"][U][P] | undefined;
572
- greaterThanOrEqualTo?: T["types"][U][P] | undefined;
573
- lessThanOrEqualTo?: T["types"][U][P] | undefined;
574
- in?: T["types"][U][P][] | undefined;
575
- notIn?: T["types"][U][P][] | undefined;
576
- contains?: T["types"][U][P] | undefined;
577
- notContains?: T["types"][U][P] | undefined;
578
- };
579
- }> & {
580
- OR?: WhereType<T, U>[] | undefined;
581
- AND?: WhereType<T, U>[] | undefined;
582
- }>;
583
- _buildWhereWithACL<K extends keyof T["types"]>(where: WhereType<T, K>, context: WabeContext<T>, operation: "write" | "read"): WhereType<T, K>;
584
- _getFinalObjectWithPointerAndRelation({ pointers, context, originClassName, object, isGraphQLCall, }: {
585
- originClassName: string;
586
- pointers: Record<string, {
587
- className: string;
588
- select: Select;
589
- }>;
590
- context: WabeContext<any>;
591
- object: Record<string, any>;
592
- isGraphQLCall?: boolean;
593
- }): Promise<Record<string, any>>;
594
- connect(): Promise<any>;
595
- close(): Promise<any>;
596
- createClassIfNotExist(className: string, context: WabeContext<T>): Promise<any>;
597
- count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
598
- clearDatabase(): Promise<void>;
599
- getObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ select, className, context, skipHooks, id, where, isGraphQLCall, }: GetObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
600
- getObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, select, context, where, skipHooks, first, offset, order, isGraphQLCall, }: GetObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
601
- createObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, data, select, isGraphQLCall, }: CreateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
602
- createObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>({ data, select, className, context, first, offset, order, isGraphQLCall, }: CreateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
603
- updateObject<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ id, className, context, data, select, skipHooks, isGraphQLCall, }: UpdateObjectOptions<T, K, U, W>): Promise<OutputType<T, K, W>>;
604
- updateObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K], X extends keyof T["types"][K]>({ className, where, context, select, data, first, offset, order, skipHooks, isGraphQLCall, }: UpdateObjectsOptions<T, K, U, W, X>): Promise<OutputType<T, K, W>[]>;
605
- deleteObject<K extends keyof T["types"], U extends keyof T["types"][K]>({ context, className, id, select, isGraphQLCall, }: DeleteObjectOptions<T, K, U>): Promise<OutputType<T, K, U>>;
606
- deleteObjects<K extends keyof T["types"], U extends keyof T["types"][K], W extends keyof T["types"][K]>({ className, context, select, where, first, offset, order, isGraphQLCall, }: DeleteObjectsOptions<T, K, U, W>): Promise<OutputType<T, K, W>[]>;
607
- }
608
- export declare enum DatabaseEnum {
609
- Mongo = "mongo"
610
- }
611
- export interface DatabaseConfig {
612
- type: DatabaseEnum;
613
- url: string;
614
- name: string;
615
- }
616
- export interface DevWabeTypes extends WabeTypes {
617
- types: WabeSchemaTypes;
618
- scalars: WabeSchemaScalars;
619
- enums: WabeSchemaEnums;
620
- }
621
- export declare enum OperationType {
622
- AfterCreate = "afterCreate",
623
- AfterUpdate = "afterUpdate",
624
- AfterDelete = "afterDelete",
625
- AfterRead = "afterRead",
626
- BeforeCreate = "beforeCreate",
627
- BeforeUpdate = "beforeUpdate",
628
- BeforeDelete = "beforeDelete",
629
- BeforeRead = "beforeRead"
630
- }
631
- export type Hook<T extends WabeTypes, K extends keyof WabeTypes["types"]> = {
632
- operationType: OperationType;
633
- className?: K;
634
- priority: number;
635
- callback: (hookObject: HookObject<T, K>) => Promise<void> | void;
636
- };
637
- export declare const _findHooksByPriority: <T extends unknown>({ className, operationType, priority, config, }: {
638
- operationType: OperationType;
639
- className: T;
640
- priority: number;
641
- config: WabeConfig<any>;
642
- }) => Promise<Hook<any, any>[]>;
643
- export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context, select, }: {
644
- className: K;
645
- newData?: MutationData<DevWabeTypes, any, any>;
646
- select: Select;
647
- context: WabeContext<any>;
648
- }) => {
649
- runOnSingleObject: (options: {
650
- operationType: OperationType;
651
- id?: string;
652
- originalObject?: OutputType<DevWabeTypes, any, any>;
653
- }) => Promise<MutationData<T, K, any>>;
654
- runOnMultipleObjects: (options: {
655
- operationType: OperationType;
656
- where?: WhereType<any, any>;
657
- ids?: string[];
658
- originalObjects?: OutputType<DevWabeTypes, any, any>[];
659
- }) => Promise<{
660
- objects: never[];
661
- newData: MutationData<DevWabeTypes, any, any>[];
662
- } | {
663
- objects: OutputType<DevWabeTypes, any, any>[];
664
- newData: Awaited<MutationData<DevWabeTypes, K, keyof WabeSchemaTypes[K]>>[];
665
- }>;
666
- };
667
- export declare const getDefaultHooks: () => Hook<any, any>[];
668
- export type AddACLOpptions = {
669
- userId?: string;
670
- role?: RoleEnum;
671
- read: boolean;
672
- write: boolean;
673
- } | null;
674
- declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]> {
675
- className: K;
676
- private newData;
677
- private operationType;
678
- context: WabeContext<T>;
679
- object: OutputType<T, K, keyof T["types"][K]>;
680
- originalObject: OutputType<T, K, keyof T["types"][K]> | undefined;
681
- select: Array<keyof T["types"][K]>;
682
- constructor({ newData, className, operationType, context, object, originalObject, select, }: {
683
- className: K;
684
- newData?: MutationData<T, K, keyof T["types"][K]>;
685
- operationType: OperationType;
686
- context: WabeContext<T>;
687
- object: OutputType<T, K, keyof T["types"][K]>;
688
- originalObject?: OutputType<T, K, keyof T["types"][K]>;
689
- select: Select;
690
- });
691
- getUser(): User | null | undefined;
692
- isFieldUpdated(field: keyof T["types"][K]): boolean | undefined;
693
- upsertNewData(field: keyof T["types"][K], value: any): void;
694
- getNewData(): MutationData<T, K, keyof T["types"][K]>;
695
- fetch(): Promise<OutputType<T, K, keyof T["types"][K]>>;
696
- addACL(type: "users" | "roles", options: AddACLOpptions): Promise<void>;
697
- }
698
- export type WabePrimaryTypes = "String" | "Int" | "Float" | "Boolean" | "Email" | "Phone" | "Date" | "File";
699
- export type WabeCustomTypes = "Array" | "Object";
700
- export type WabeRelationTypes = "Pointer" | "Relation";
701
- export type WabeFieldTypes = WabeCustomTypes | WabePrimaryTypes | WabeRelationTypes;
702
- export type WabeObject<T extends WabeTypes> = {
703
- name: string;
704
- fields: SchemaFields<T>;
705
- description?: string;
706
- required?: boolean;
707
- };
708
- export type TypeFieldBase<U, K extends WabeFieldTypes> = {
709
- type: K;
710
- required?: boolean;
711
- description?: string;
712
- defaultValue?: U;
713
- };
714
- export type TypeFieldArray<T extends WabeTypes> = {
715
- type: "Array";
716
- required?: boolean;
717
- requiredValue?: boolean;
718
- description?: string;
719
- defaultValue?: any[];
720
- } & ({
721
- typeValue: WabePrimaryTypes;
722
- } | {
723
- typeValue: "Object";
724
- object: WabeObject<T>;
725
- });
726
- export type TypeFieldObject<T extends WabeTypes> = {
727
- type: "Object";
728
- required?: boolean;
729
- description?: string;
730
- object: WabeObject<T>;
731
- defaultValue?: any;
732
- };
733
- export type TypeFieldPointer<T extends WabeTypes> = {
734
- type: "Pointer";
735
- required?: boolean;
736
- description?: string;
737
- class: keyof T["types"];
738
- };
739
- export type TypeFieldRelation<T extends WabeTypes> = {
740
- type: "Relation";
741
- required?: boolean;
742
- description?: string;
743
- class: keyof T["types"];
744
- };
745
- export type TypeFieldFile = {
746
- type: "File";
747
- required?: boolean;
748
- description?: string;
749
- };
750
- export type TypeFieldCustomScalars<T extends WabeTypes> = {
751
- type: T["scalars"];
752
- required?: boolean;
753
- description?: string;
754
- defaultValue?: any;
755
- };
756
- export type TypeFieldCustomEnums<T extends WabeTypes> = {
757
- type: keyof T["enums"];
758
- required?: boolean;
759
- description?: string;
760
- defaultValue?: any;
761
- };
762
- export type TypeField<T extends WabeTypes> = TypeFieldBase<string, "String"> | TypeFieldBase<number, "Int"> | TypeFieldBase<number, "Float"> | TypeFieldBase<boolean, "Boolean"> | TypeFieldBase<Date, "Date"> | TypeFieldBase<string, "Email"> | TypeFieldBase<string, "Phone"> | TypeFieldArray<T> | TypeFieldObject<T> | TypeFieldPointer<T> | TypeFieldRelation<T> | TypeFieldFile | TypeFieldCustomScalars<T> | TypeFieldCustomEnums<T>;
763
- export type SchemaFields<T extends WabeTypes> = Record<string, TypeField<T>>;
764
- export type ResolverType<T extends WabeTypes> = {
765
- required?: boolean;
766
- description?: string;
767
- resolve: (...args: any) => any;
768
- } & ({
769
- type: WabePrimaryTypes | T["enums"] | T["scalars"];
770
- } | {
771
- type: "Object";
772
- outputObject: ClassInterface<T>;
773
- } | {
774
- type: "Array";
775
- typeValue: WabePrimaryTypes;
776
- typeValueRequired?: boolean;
777
- } | {
778
- type: "Array";
779
- typeValue: "Object";
780
- outputObject: ClassInterface<T>;
781
- typeValueRequired?: boolean;
782
- });
783
- export type QueryResolver<T extends WabeTypes> = {
784
- args?: SchemaFields<T>;
785
- } & ResolverType<T>;
786
- export type MutationResolver<T extends WabeTypes> = {
787
- args?: {
788
- input: SchemaFields<T>;
789
- };
790
- } & ResolverType<T>;
791
- export type TypeResolver<T extends WabeTypes> = {
792
- queries?: {
793
- [key: string]: QueryResolver<T>;
794
- };
795
- mutations?: {
796
- [key: string]: MutationResolver<T>;
797
- };
798
- };
799
- export type PermissionsOperations = "create" | "read" | "update" | "delete";
800
- export interface PermissionProperties<T extends WabeTypes> {
801
- requireAuthentication?: boolean;
802
- /**
803
- * An empty array means that none role is authorized (except root client)
804
- */
805
- authorizedRoles?: Array<T["enums"]["RoleEnum"] | "everyone">;
806
- }
807
- /**
808
- * ACL properties
809
- * Callback to define the ACL object before insert of the object in the database
810
- * Can be done with a beforeCreate hook but for simplicity we can define it here
811
- */
812
- export type ACLProperties = (hookObject: HookObject<any, any>) => void | Promise<void>;
813
- export type ClassPermissions<T extends WabeTypes> = Partial<Record<PermissionsOperations, PermissionProperties<T>> & {
814
- acl: ACLProperties;
815
- }>;
816
- export type SearchableFields = Array<string>;
817
- export type ClassIndexes = Array<{
818
- field: string;
819
- order: "ASC" | "DESC";
820
- unique?: boolean;
821
- }>;
822
- export interface ClassInterface<T extends WabeTypes> {
823
- name: string;
824
- fields: SchemaFields<T>;
825
- description?: string;
826
- permissions?: ClassPermissions<T>;
827
- searchableFields?: SearchableFields;
828
- indexes?: ClassIndexes;
829
- }
830
- export interface ScalarInterface {
831
- name: string;
832
- description?: string;
833
- parseValue?: (value: any) => any;
834
- serialize?: (value: any) => any;
835
- parseLiteral?: (ast: any) => any;
836
- }
837
- export interface EnumInterface {
838
- name: string;
839
- values: Record<string, string>;
840
- description?: string;
841
- }
842
- export interface SchemaInterface<T extends WabeTypes> {
843
- classes?: ClassInterface<T>[];
844
- scalars?: ScalarInterface[];
845
- enums?: EnumInterface[];
846
- resolvers?: TypeResolver<T>;
847
- }
848
- export declare class Schema<T extends WabeTypes> {
849
- schema: SchemaInterface<T>;
850
- private config;
851
- constructor(config: WabeConfig<T>);
852
- defaultEnum(): EnumInterface[];
853
- mergeResolvers(defaultResolvers: TypeResolver<T>): TypeResolver<T>;
854
- defaultResolvers(): TypeResolver<T>;
855
- sessionClass(): ClassInterface<T>;
856
- roleClass(): ClassInterface<T>;
857
- internalConfigClass(): ClassInterface<T>;
858
- userClass(): ClassInterface<T>;
859
- defaultFields(): SchemaFields<T>;
860
- mergeClass(newClass: ClassInterface<T>[]): ClassInterface<T>[];
861
- defaultClass(schema?: SchemaInterface<T>): ClassInterface<T>[];
862
- }
863
- export declare enum ProviderEnum {
864
- google = "google",
865
- github = "github"
866
- }
867
- export interface ProviderConfig {
868
- clientId: string;
869
- clientSecret: string;
870
- }
871
- export type AuthenticationEventsOptions<T> = {
872
- input: T;
873
- context: WabeContext<any>;
874
- };
875
- export type AuthenticationEventsOptionsWithUserId<T> = AuthenticationEventsOptions<T> & {
876
- userId: string;
877
- };
878
- export type ProviderInterface<T = any> = {
879
- onSignIn: (options: AuthenticationEventsOptions<T>) => Promise<{
880
- user: Partial<User>;
881
- }>;
882
- onSignUp: (options: AuthenticationEventsOptions<T>) => Promise<{
883
- authenticationDataToSave: any;
884
- }>;
885
- onUpdateAuthenticationData?: (options: AuthenticationEventsOptionsWithUserId<T>) => Promise<{
886
- authenticationDataToSave: any;
887
- }>;
888
- };
889
- export type SecondaryProviderInterface<T = any> = {
890
- onSendChallenge: () => Promise<void>;
891
- onVerifyChallenge: (options: T) => Promise<boolean>;
892
- };
893
- export type CustomAuthenticationMethods<T extends WabeTypes, U = ProviderInterface | SecondaryProviderInterface, K = SchemaFields<T>, W = SchemaFields<T>> = {
894
- name: string;
895
- input: K;
896
- dataToStore?: W;
897
- provider: U;
898
- isSecondaryFactor?: boolean;
899
- };
900
- export type RoleConfig = Array<string>;
901
- export interface SessionConfig {
902
- /**
903
- * The time in milliseconds that the access token will expire
904
- */
905
- accessTokenExpiresInMs?: number;
906
- /**
907
- * The time in milliseconds that the refresh token will expire
908
- */
909
- refreshTokenExpiresInMs?: number;
910
- /**
911
- * Set to true to automatically store the session tokens in cookies
912
- */
913
- cookieSession?: boolean;
914
- }
915
- export interface AuthenticationConfig<T extends WabeTypes> {
916
- session?: SessionConfig;
917
- roles?: RoleConfig;
918
- successRedirectPath?: string;
919
- failureRedirectPath?: string;
920
- frontDomain?: string;
921
- backDomain?: string;
922
- providers?: Partial<Record<ProviderEnum, ProviderConfig>>;
923
- customAuthenticationMethods?: CustomAuthenticationMethods<T>[];
924
- }
925
- export interface CreateTokenFromAuthorizationCodeOptions {
926
- code: string;
927
- }
928
- export interface refreshTokenOptions {
929
- refreshToken: string;
930
- }
931
- export interface Provider {
932
- createTokenFromAuthorizationCode(options: CreateTokenFromAuthorizationCodeOptions): Promise<void>;
933
- refreshToken(options: refreshTokenOptions): Promise<void>;
934
- }
935
- declare enum AuthenticationProvider$1 {
936
- GitHub = "github",
937
- Google = "google",
938
- EmailPassword = "emailPassword",
939
- PhonePassword = "phonePassword"
940
- }
941
- export interface WabeRoute {
942
- method: "GET" | "POST" | "PUT" | "DELETE";
943
- path: string;
944
- handler: WobeHandler<WobeCustomContext<any>>;
945
- }
946
- export declare const generateCodegen: ({ schema, path, graphqlSchema, }: {
947
- schema: SchemaInterface<any>;
948
- path: string;
949
- graphqlSchema: GraphQLSchema;
950
- }) => Promise<void>;
951
- export declare class FileDevAdapter implements FileAdapter {
952
- private basePath;
953
- private rootPath;
954
- uploadFile(file: File | Blob): Promise<void>;
955
- readFile(fileName: string, options?: ReadFileOptions): Promise<string | null>;
956
- deleteFile(fileName: string): Promise<void>;
957
- }
958
- /**
959
- * The file config contains the adapter to use to upload file
960
- * @param adapter: FileAdapter
961
- * @param urlCacheInSeconds: number Number of seconds to cache the url, equal to the number of seconds the url will be valid
962
- * @param devDirectory: string The directory where the files will be uploaded
963
- */
964
- export interface FileConfig {
965
- adapter: FileAdapter;
966
- urlCacheInSeconds?: number;
967
- devDirectory?: string;
968
- }
969
- export interface ReadFileOptions {
970
- urlExpiresIn?: number;
971
- port?: number;
972
- }
973
- export interface FileAdapter {
974
- /**
975
- * Upload a file and returns the url of the file
976
- * @param file: File
977
- */
978
- uploadFile(file: File | Blob): Promise<void>;
979
- /**
980
- * Read a file and returns the url of the file
981
- * @param fileName: string
982
- * @param urlExpiresIn: number Number of seconds to expire the url
983
- * @returns The url of file or null if the file doesn't exist
984
- */
985
- readFile(fileName: string, options?: ReadFileOptions): Promise<string | null> | string | null;
986
- deleteFile(fileName: string): Promise<void>;
987
- }
988
- export type HtmlTemplates = {
989
- sendOTPCode: (options: {
990
- otp: string;
991
- }) => string | Promise<string>;
992
- };
993
- export interface EmailSendOptions {
994
- from: string;
995
- to: Array<string>;
996
- subject: string;
997
- node?: React.ReactNode;
998
- html?: string;
999
- text?: string;
1000
- }
1001
- export interface EmailAdapter {
1002
- /**
1003
- * Send an email using the provided adapter
1004
- * @param options Mail options (expeditor, recipient, subject ...)
1005
- * @return The id of the email sended, throw an error if something wrong
1006
- */
1007
- send(options: EmailSendOptions): Promise<string>;
1008
- }
1009
- /**
1010
- * Configuration for the email in Wabe
1011
- * @property adapter The adapter to use to send emails
1012
- * @property mainEmail The email to use as sender for emails sent by Wabe
1013
- * @property templates The html templates to use for a specific email. If not provided, Wabe will use the default templates
1014
- */
1015
- export interface EmailConfig {
1016
- adapter: EmailAdapter;
1017
- mainEmail?: string;
1018
- htmlTemplates?: HtmlTemplates;
1019
- }
1020
- export declare class EmailDevAdapter implements EmailAdapter {
1021
- send(): Promise<string>;
1022
- }
1023
- declare class EmailController implements EmailAdapter {
1024
- adapter: EmailAdapter;
1025
- constructor(adapter: EmailAdapter);
1026
- send(options: EmailSendOptions): Promise<string>;
1027
- }
1028
- export declare enum Currency {
1029
- EUR = "eur",
1030
- USD = "usd"
1031
- }
1032
- export type Address = {
1033
- city: string;
1034
- country: string;
1035
- line1: string;
1036
- line2: string;
1037
- postalCode: string;
1038
- state: string;
1039
- };
1040
- export declare enum PaymentMode {
1041
- payment = "payment",
1042
- subscription = "subscription"
1043
- }
1044
- export type PaymentMethod = "card" | "paypal" | "link" | "sepa_debit" | "revolut_pay" | "us_bank_account";
1045
- export declare enum PaymentReccuringInterval {
1046
- Month = "month",
1047
- Year = "year"
1048
- }
1049
- export type Product = {
1050
- name: string;
1051
- unitAmount: number;
1052
- quantity: number;
1053
- };
1054
- export interface OnPaymentSucceedOptions {
1055
- createdAt: number;
1056
- amount: number;
1057
- customerEmail: string | null;
1058
- currency: string;
1059
- paymentMethodTypes: Array<string>;
1060
- }
1061
- export interface OnPaymentFailedOptions {
1062
- createdAt: number;
1063
- amount: number;
1064
- paymentMethodTypes: Array<string>;
1065
- }
1066
- /**
1067
- * PaymentConfig
1068
- * @property adapter - The payment adapter
1069
- * @property supportedPaymentMethods - The supported payment methods
1070
- * @property currency - The currency
1071
- */
1072
- export interface PaymentConfig {
1073
- adapter: PaymentAdapter;
1074
- supportedPaymentMethods: Array<PaymentMethod>;
1075
- currency: Currency;
1076
- }
1077
- export type Invoice = {
1078
- amountDue: number;
1079
- amountPaid: number;
1080
- currency: Currency;
1081
- id: string;
1082
- created: number;
1083
- invoiceUrl: string;
1084
- isPaid: boolean;
1085
- };
1086
- export type Transaction = {
1087
- customerEmail: string;
1088
- amount: number;
1089
- currency: Currency;
1090
- created: number;
1091
- isSubscription: boolean;
1092
- reccuringInterval?: "month" | "year";
1093
- };
1094
- export type CreateCustomerOptions = {
1095
- customerName?: string;
1096
- customerEmail: string;
1097
- customerPhone?: string;
1098
- address: Address;
1099
- paymentMethod: PaymentMethod;
1100
- };
1101
- export type CreatePaymentOptions = {
1102
- currency: Currency;
1103
- customerEmail?: string;
1104
- products: Array<Product>;
1105
- paymentMethod: Array<PaymentMethod>;
1106
- paymentMode: PaymentMode;
1107
- successUrl: string;
1108
- cancelUrl: string;
1109
- automaticTax?: boolean;
1110
- recurringInterval?: "month" | "year";
1111
- createInvoice?: boolean;
1112
- allowPromotionCode?: boolean;
1113
- promotionCodeId?: string;
1114
- couponCodeId?: string;
1115
- };
1116
- export type InitWebhookOptions = {
1117
- webhookUrl: string;
1118
- };
1119
- export type CancelSubscriptionOptions = {
1120
- email: string;
1121
- };
1122
- export type GetInvoicesOptions = {
1123
- email: string;
1124
- };
1125
- export type GetTotalRevenueOptions = {
1126
- startRangeTimestamp?: number;
1127
- endRangeTimestamp?: number;
1128
- charge: "net" | "gross";
1129
- };
1130
- export type GetAllTransactionsOptions = {
1131
- startRangeTimestamp?: number;
1132
- endRangeTimestamp?: number;
1133
- first?: number;
1134
- };
1135
- export type GetCustomerByIdOptions = {
1136
- id: string;
1137
- };
1138
- export type ValidateWebhookOptions = {
1139
- ctx: Context;
1140
- endpointSecret: string;
1141
- };
1142
- /**
1143
- * ValidateWebhookOutput
1144
- * @property valid - Whether the webhook is valid or not
1145
- * @property payload - The payload of the webhook
1146
- */
1147
- export type ValidateWebhookOutput = {
1148
- isValid: boolean;
1149
- type: string;
1150
- payload: any | null;
1151
- };
1152
- export type InitWebhookOutput = {
1153
- webhookId: string;
1154
- endpointSecret: string;
1155
- };
1156
- export type CreateCouponOptions = {
1157
- amountOff?: number;
1158
- currency?: Currency;
1159
- duration?: "forever" | "once" | "repeating";
1160
- durationInMonths?: number;
1161
- name?: string;
1162
- percentOff?: number;
1163
- maxRedemptions?: number;
1164
- };
1165
- export type CreatePromotionCodeOptions = {
1166
- couponId: string;
1167
- code?: string;
1168
- active?: boolean;
1169
- maxRedemptions?: number;
1170
- };
1171
- export type DeleteCouponOptions = {
1172
- id: string;
1173
- };
1174
- export type UpdatePromotionCodeOptions = {
1175
- id: string;
1176
- active: boolean;
1177
- };
1178
- export interface PaymentAdapter {
1179
- /**
1180
- * Delete a coupon
1181
- * @param options DeleteCouponOptions
1182
- */
1183
- deleteCoupon: (options: DeleteCouponOptions) => Promise<void>;
1184
- /**
1185
- * Create a coupon
1186
- * @param options CreateCouponOptions
1187
- * @returns id The coupon id
1188
- */
1189
- createCoupon: (options: CreateCouponOptions) => Promise<{
1190
- code: string;
1191
- id: string;
1192
- }>;
1193
- /**
1194
- * Disable a promotion code
1195
- * @param options DeletePromotionCodeOptions
1196
- */
1197
- updatePromotionCode: (options: UpdatePromotionCodeOptions) => Promise<void>;
1198
- /**
1199
- * Create a promotion code from a coupon
1200
- * @param options CreatePromotionCodeOptions
1201
- * @returns code, id The promotion code and the stripe id
1202
- */
1203
- createPromotionCode: (options: CreatePromotionCodeOptions) => Promise<{
1204
- id: string;
1205
- code: string;
1206
- }>;
1207
- /**
1208
- * Get a customer by id
1209
- * @param id The customer id
1210
- * @returns The customer
1211
- */
1212
- getCustomerById: (options: GetCustomerByIdOptions) => Promise<{
1213
- email: string | null;
1214
- }>;
1215
- /**
1216
- * Create a customer
1217
- * @param options CreateCustomerOptions
1218
- * @returns The customer email
1219
- */
1220
- createCustomer: (options: CreateCustomerOptions) => Promise<string>;
1221
- /**
1222
- * Create a payment
1223
- * @param options CreatePaymentOptions
1224
- * @returns The payment url
1225
- */
1226
- createPayment: (options: CreatePaymentOptions) => Promise<string>;
1227
- /**
1228
- * Cancel a subscription
1229
- * @param options The customer email to cancel the subscription
1230
- */
1231
- cancelSubscription: (options: CancelSubscriptionOptions) => Promise<void>;
1232
- /**
1233
- * Get invoices
1234
- * @param options The customer email to get the invoices
1235
- * @returns The invoices of a customer
1236
- */
1237
- getInvoices: (options: GetInvoicesOptions) => Promise<Invoice[]>;
1238
- /**
1239
- * Get total revenue
1240
- * @param options The type of charge (net or gross) and the start and end range timestamps to get the total revenue
1241
- * @returns The total amount
1242
- */
1243
- getTotalRevenue: (options: GetTotalRevenueOptions) => Promise<number>;
1244
- /**
1245
- * Get the list of all transactions
1246
- * @param options The start and end range timestamps to get the transactions
1247
- * @returns The list of transactions
1248
- */
1249
- getAllTransactions: (options: GetAllTransactionsOptions) => Promise<Transaction[]>;
1250
- /**
1251
- * Get the hypothetical revenue of subscriptions
1252
- * @returns The hypothetical revenue of subscriptions
1253
- */
1254
- getHypotheticalSubscriptionRevenue: () => Promise<number>;
1255
- /**
1256
- * Check if the request on webhook is from a valid provier
1257
- * @param ctx The Wobe context of the request
1258
- * @returns True if the request is from a valid provider, false otherwise
1259
- */
1260
- validateWebhook: (options: ValidateWebhookOptions) => Promise<ValidateWebhookOutput>;
1261
- }
1262
- declare class PaymentController implements PaymentAdapter {
1263
- adapter: PaymentAdapter;
1264
- private config;
1265
- constructor(paymentConfig: PaymentConfig);
1266
- deleteCoupon(options: DeleteCouponOptions): Promise<void>;
1267
- updatePromotionCode(options: UpdatePromotionCodeOptions): Promise<void>;
1268
- createCoupon(options: CreateCouponOptions): Promise<{
1269
- code: string;
1270
- id: string;
1271
- }>;
1272
- createPromotionCode(options: CreatePromotionCodeOptions): Promise<{
1273
- id: string;
1274
- code: string;
1275
- }>;
1276
- getCustomerById(options: GetCustomerByIdOptions): Promise<{
1277
- email: string | null;
1278
- }>;
1279
- validateWebhook(ctx: any): Promise<ValidateWebhookOutput>;
1280
- createCustomer(options: CreateCustomerOptions): Promise<string>;
1281
- createPayment(options: Omit<CreatePaymentOptions, "currency" | "paymentMethod">): Promise<string>;
1282
- cancelSubscription(options: CancelSubscriptionOptions): Promise<void>;
1283
- getInvoices(options: GetInvoicesOptions): Promise<Invoice[]>;
1284
- getTotalRevenue(options: GetTotalRevenueOptions): Promise<number>;
1285
- getAllTransactions(options: GetAllTransactionsOptions): Promise<Transaction[]>;
1286
- getHypotheticalSubscriptionRevenue(): Promise<number>;
1287
- }
1288
- export interface CreateCompletionOptions {
1289
- content: string;
1290
- }
1291
- export interface AIAdapter {
1292
- createCompletion(options: CreateCompletionOptions): Promise<string>;
1293
- }
1294
- export interface AIConfig {
1295
- adapter: AIAdapter;
1296
- }
1297
- declare class FileController implements FileAdapter {
1298
- adapter: FileAdapter;
1299
- private wabe;
1300
- constructor(adapter: FileAdapter, wabe: Wabe<any>);
1301
- uploadFile(file: File | Blob): Promise<void>;
1302
- readFile(fileName: string, options?: ReadFileOptions): string | Promise<string | null> | null;
1303
- deleteFile(fileName: string): Promise<void>;
1304
- }
1305
- export type SecurityConfig = {
1306
- corsOptions?: CorsOptions;
1307
- rateLimit?: RateLimitOptions;
1308
- };
1309
- export interface WabeConfig<T extends WabeTypes> {
1310
- port: number;
1311
- isProduction?: boolean;
1312
- hostname?: string;
1313
- security?: SecurityConfig;
1314
- schema?: SchemaInterface<T>;
1315
- graphqlSchema?: GraphQLSchema;
1316
- database: DatabaseConfig;
1317
- codegen?: {
1318
- enabled: true;
1319
- path: string;
1320
- } | {
1321
- enabled?: false;
1322
- };
1323
- authentication?: AuthenticationConfig<T>;
1324
- routes?: WabeRoute[];
1325
- rootKey: string;
1326
- hooks?: Hook<T, any>[];
1327
- email?: EmailConfig;
1328
- payment?: PaymentConfig;
1329
- ai?: AIConfig;
1330
- file?: FileConfig;
1331
- }
1332
- export type WabeTypes = {
1333
- types: Record<any, any>;
1334
- scalars: string;
1335
- enums: Record<any, any>;
1336
- };
1337
- export type WobeCustomContext<T extends WabeTypes> = {
1338
- wabe: WabeContext<T>;
1339
- };
1340
- export type WabeControllers<T extends WabeTypes> = {
1341
- database: DatabaseController<T>;
1342
- email?: EmailController;
1343
- payment?: PaymentController;
1344
- file?: FileController;
1345
- };
1346
- export declare class Wabe<T extends WabeTypes> {
1347
- server: Wobe<WobeCustomContext<T>>;
1348
- config: WabeConfig<T>;
1349
- controllers: WabeControllers<T>;
1350
- constructor({ isProduction, port, hostname, security, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
1351
- loadRoleEnum(): void;
1352
- loadAuthenticationMethods(): void;
1353
- loadHooks(): void;
1354
- loadRoutes(): void;
1355
- start(): Promise<void>;
1356
- close(): Promise<void>;
1357
- }
1358
- export declare const signInWithResolver: (_: any, { input, }: {
1359
- input: SignInWithInput;
1360
- }, context: WabeContext<DevWabeTypes>) => Promise<{
1361
- accessToken: null;
1362
- refreshToken: null;
1363
- id: string;
1364
- } | {
1365
- accessToken: string;
1366
- refreshToken: string;
1367
- id: string;
1368
- }>;
1369
- export declare const signUpWithResolver: (_: any, { input, }: {
1370
- input: SignUpWithInput;
1371
- }, context: WabeContext<any>) => Promise<{
1372
- accessToken: string;
1373
- refreshToken: string;
1374
- id: any;
1375
- }>;
1376
- export interface TokenResponseBody {
1377
- access_token: string;
1378
- token_type?: string;
1379
- expires_in?: number;
1380
- refresh_token?: string;
1381
- scope?: string;
1382
- }
1383
- export declare class OAuth2Client {
1384
- clientId: string;
1385
- private authorizeEndpoint;
1386
- private tokenEndpoint;
1387
- private redirectURI;
1388
- constructor(clientId: string, authorizeEndpoint: string, tokenEndpoint: string, redirectURI: string);
1389
- createAuthorizationURL(options?: {
1390
- state?: string;
1391
- codeVerifier?: string;
1392
- scopes?: string[];
1393
- }): URL;
1394
- validateAuthorizationCode<_TokenResponseBody extends TokenResponseBody>(authorizationCode: string, options?: {
1395
- codeVerifier?: string;
1396
- credentials?: string;
1397
- authenticateWith?: "http_basic_auth" | "request_body";
1398
- }): Promise<_TokenResponseBody>;
1399
- refreshAccessToken<_TokenResponseBody extends TokenResponseBody>(refreshToken: string, options?: {
1400
- credentials?: string;
1401
- authenticateWith?: "http_basic_auth" | "request_body";
1402
- scopes?: string[];
1403
- }): Promise<_TokenResponseBody>;
1404
- _sendTokenRequest<_TokenResponseBody extends TokenResponseBody>(body: URLSearchParams, options?: {
1405
- credentials?: string;
1406
- authenticateWith?: "http_basic_auth" | "request_body";
1407
- }): Promise<_TokenResponseBody>;
1408
- }
1409
- export interface Tokens {
1410
- accessToken: string;
1411
- refreshToken?: string | null;
1412
- accessTokenExpiresAt?: Date;
1413
- refreshTokenExpiresAt?: Date | null;
1414
- idToken?: string;
1415
- }
1416
- export interface OAuth2ProviderWithPKCE {
1417
- createAuthorizationURL(state: string, codeVerifier: string): URL;
1418
- validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
1419
- refreshAccessToken?(refreshToken: string): Promise<Tokens>;
1420
- }
1421
- export declare class Google implements OAuth2ProviderWithPKCE {
1422
- private client;
1423
- private clientSecret;
1424
- constructor(config: WabeConfig<any>);
1425
- createAuthorizationURL(state: string, codeVerifier: string, options?: {
1426
- scopes?: string[];
1427
- }): URL;
1428
- validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
1429
- refreshAccessToken(refreshToken: string): Promise<Tokens>;
1430
- getUserInfo(accessToken: string, idToken: string): Promise<{
1431
- email: any;
1432
- verifiedEmail: any;
1433
- }>;
1434
- }
1435
- export declare class PaymentDevAdapter implements PaymentAdapter {
1436
- adapter: {};
1437
- getCustomerById(): Promise<{
1438
- email: string;
1439
- }>;
1440
- deleteCoupon(): Promise<void>;
1441
- updatePromotionCode(): Promise<void>;
1442
- createCoupon(): Promise<{
1443
- code: string;
1444
- id: string;
1445
- }>;
1446
- createPromotionCode(): Promise<{
1447
- code: string;
1448
- id: string;
1449
- }>;
1450
- validateWebhook(): Promise<{
1451
- isValid: boolean;
1452
- payload: {};
1453
- type: string;
1454
- }>;
1455
- createCustomer(): Promise<string>;
1456
- createPayment(): Promise<string>;
1457
- cancelSubscription(): Promise<void>;
1458
- getInvoices(): Promise<never[]>;
1459
- getTotalRevenue(): Promise<number>;
1460
- getAllTransactions(): Promise<never[]>;
1461
- getHypotheticalSubscriptionRevenue(): Promise<number>;
1462
- }
1463
- export declare const contextWithRoot: (context: WabeContext<any>) => WabeContext<any>;
1464
-
1465
- export {
1466
- AuthenticationProvider$1 as AuthenticationProvider,
1467
- };
1468
-
1469
- export {};
1
+ export * from "./server";
2
+ export * from "./hooks";
3
+ export * from "./schema";
4
+ export * from "./database";
5
+ export * from "./authentication";
6
+ export * from "./files";
7
+ export * from "./email";
8
+ export * from "./payment";
9
+ export * from "./ai";
10
+ export * from "./utils/export";
11
+ export * from "./cron";