wabe 0.6.3 → 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 -1459
  68. package/dist/index.js +486 -76812
  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,1459 +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(originClassName: string, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
412
- _isPointerField(originClassName: string, context: WabeContext<T>, pointerClassName?: string): boolean | undefined;
413
- _getWhereObjectWithPointerOrRelation<U extends keyof T["types"]>(className: U, where: WhereType<T, U>, context: WabeContext<T>): Promise<Partial<{
414
- [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 ? {
415
- [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 ? {
416
- [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 ? {
417
- [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 ? {
418
- [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 ? {
419
- [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 ? {
420
- [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 ? {
421
- [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 ? {
422
- [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 ? {
423
- [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 ? {
424
- [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 ? {
425
- [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 : {
426
- 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;
427
- 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;
428
- 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;
429
- 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;
430
- 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;
431
- 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;
432
- 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;
433
- 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;
434
- 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;
435
- 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;
436
- };
437
- } : never : {
438
- 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;
439
- 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;
440
- 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;
441
- 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;
442
- 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;
443
- 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;
444
- 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;
445
- 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;
446
- 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;
447
- 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;
448
- };
449
- } : never : {
450
- 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;
451
- 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;
452
- 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;
453
- 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;
454
- 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;
455
- 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;
456
- 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;
457
- 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;
458
- 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;
459
- 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;
460
- };
461
- } : never : {
462
- 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;
463
- 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;
464
- 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;
465
- 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;
466
- 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;
467
- 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;
468
- 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;
469
- 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;
470
- 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;
471
- 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;
472
- };
473
- } : never : {
474
- 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;
475
- 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;
476
- 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;
477
- 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;
478
- 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;
479
- 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;
480
- 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;
481
- 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;
482
- 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;
483
- 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;
484
- };
485
- } : never : {
486
- equalTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
487
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
488
- greaterThan?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
489
- lessThan?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
490
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
491
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
492
- in?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6][] | undefined;
493
- notIn?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6][] | undefined;
494
- contains?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
495
- notContains?: Partial<Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5]>[P_6] | undefined;
496
- };
497
- } : never : {
498
- equalTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
499
- notEqualTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
500
- greaterThan?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
501
- lessThan?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
502
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
503
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
504
- in?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5][] | undefined;
505
- notIn?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5][] | undefined;
506
- contains?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
507
- notContains?: Partial<Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4]>[P_5] | undefined;
508
- };
509
- } : never : {
510
- equalTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
511
- notEqualTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
512
- greaterThan?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
513
- lessThan?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
514
- greaterThanOrEqualTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
515
- lessThanOrEqualTo?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
516
- in?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4][] | undefined;
517
- notIn?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4][] | undefined;
518
- contains?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
519
- notContains?: Partial<Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3]>[P_4] | undefined;
520
- };
521
- } : never : {
522
- equalTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
523
- notEqualTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
524
- greaterThan?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
525
- lessThan?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
526
- greaterThanOrEqualTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
527
- lessThanOrEqualTo?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
528
- in?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3][] | undefined;
529
- notIn?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3][] | undefined;
530
- contains?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
531
- notContains?: Partial<Partial<Partial<T["types"][U][P]>[P_1]>[P_2]>[P_3] | undefined;
532
- };
533
- } : never : {
534
- equalTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
535
- notEqualTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
536
- greaterThan?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
537
- lessThan?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
538
- greaterThanOrEqualTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
539
- lessThanOrEqualTo?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
540
- in?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2][] | undefined;
541
- notIn?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2][] | undefined;
542
- contains?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
543
- notContains?: Partial<Partial<T["types"][U][P]>[P_1]>[P_2] | undefined;
544
- };
545
- } : never : {
546
- equalTo?: Partial<T["types"][U][P]>[P_1] | undefined;
547
- notEqualTo?: Partial<T["types"][U][P]>[P_1] | undefined;
548
- greaterThan?: Partial<T["types"][U][P]>[P_1] | undefined;
549
- lessThan?: Partial<T["types"][U][P]>[P_1] | undefined;
550
- greaterThanOrEqualTo?: Partial<T["types"][U][P]>[P_1] | undefined;
551
- lessThanOrEqualTo?: Partial<T["types"][U][P]>[P_1] | undefined;
552
- in?: Partial<T["types"][U][P]>[P_1][] | undefined;
553
- notIn?: Partial<T["types"][U][P]>[P_1][] | undefined;
554
- contains?: Partial<T["types"][U][P]>[P_1] | undefined;
555
- notContains?: Partial<T["types"][U][P]>[P_1] | undefined;
556
- };
557
- } : never : {
558
- equalTo?: T["types"][U][P] | undefined;
559
- notEqualTo?: T["types"][U][P] | undefined;
560
- greaterThan?: T["types"][U][P] | undefined;
561
- lessThan?: T["types"][U][P] | undefined;
562
- greaterThanOrEqualTo?: T["types"][U][P] | undefined;
563
- lessThanOrEqualTo?: T["types"][U][P] | undefined;
564
- in?: T["types"][U][P][] | undefined;
565
- notIn?: T["types"][U][P][] | undefined;
566
- contains?: T["types"][U][P] | undefined;
567
- notContains?: T["types"][U][P] | undefined;
568
- };
569
- }> & {
570
- OR?: WhereType<T, U>[] | undefined;
571
- AND?: WhereType<T, U>[] | undefined;
572
- }>;
573
- _buildWhereWithACL<K extends keyof T["types"]>(where: WhereType<T, K>, context: WabeContext<T>, operation: "write" | "read"): WhereType<T, K>;
574
- _getFinalObjectWithPointerAndRelation({ pointers, context, originClassName, object, isGraphQLCall, }: {
575
- originClassName: string;
576
- pointers: Record<string, {
577
- className: string;
578
- select: Select;
579
- }>;
580
- context: WabeContext<any>;
581
- object: Record<string, any>;
582
- isGraphQLCall?: boolean;
583
- }): Promise<Record<string, any>>;
584
- connect(): Promise<any>;
585
- close(): Promise<any>;
586
- createClassIfNotExist(className: string, context: WabeContext<T>): Promise<any>;
587
- count<K extends keyof T["types"]>(params: CountOptions<T, K>): Promise<number>;
588
- clearDatabase(): Promise<void>;
589
- 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>>;
590
- 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>[]>;
591
- 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>>;
592
- 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>[]>;
593
- 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>>;
594
- 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>[]>;
595
- 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>>;
596
- 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>[]>;
597
- }
598
- export declare enum DatabaseEnum {
599
- Mongo = "mongo"
600
- }
601
- export interface DatabaseConfig {
602
- type: DatabaseEnum;
603
- url: string;
604
- name: string;
605
- }
606
- export interface DevWabeTypes extends WabeTypes {
607
- types: WabeSchemaTypes;
608
- scalars: WabeSchemaScalars;
609
- enums: WabeSchemaEnums;
610
- }
611
- export declare enum OperationType {
612
- AfterCreate = "afterCreate",
613
- AfterUpdate = "afterUpdate",
614
- AfterDelete = "afterDelete",
615
- AfterRead = "afterRead",
616
- BeforeCreate = "beforeCreate",
617
- BeforeUpdate = "beforeUpdate",
618
- BeforeDelete = "beforeDelete",
619
- BeforeRead = "beforeRead"
620
- }
621
- export type Hook<T extends WabeTypes, K extends keyof WabeTypes["types"]> = {
622
- operationType: OperationType;
623
- className?: K;
624
- priority: number;
625
- callback: (hookObject: HookObject<T, K>) => Promise<void> | void;
626
- };
627
- export declare const _findHooksByPriority: <T extends unknown>({ className, operationType, priority, config, }: {
628
- operationType: OperationType;
629
- className: T;
630
- priority: number;
631
- config: WabeConfig<any>;
632
- }) => Promise<Hook<any, any>[]>;
633
- export declare const initializeHook: <T extends WabeTypes, K extends keyof T["types"]>({ className, newData, context, select, }: {
634
- className: K;
635
- newData?: MutationData<DevWabeTypes, any, any>;
636
- select: Select;
637
- context: WabeContext<any>;
638
- }) => {
639
- runOnSingleObject: (options: {
640
- operationType: OperationType;
641
- id?: string;
642
- originalObject?: OutputType<DevWabeTypes, any, any>;
643
- }) => Promise<MutationData<T, K, any>>;
644
- runOnMultipleObjects: (options: {
645
- operationType: OperationType;
646
- where?: WhereType<any, any>;
647
- ids?: string[];
648
- originalObjects?: OutputType<DevWabeTypes, any, any>[];
649
- }) => Promise<{
650
- objects: never[];
651
- newData: MutationData<DevWabeTypes, any, any>[];
652
- } | {
653
- objects: OutputType<DevWabeTypes, any, any>[];
654
- newData: Awaited<MutationData<DevWabeTypes, K, keyof WabeSchemaTypes[K]>>[];
655
- }>;
656
- };
657
- export declare const getDefaultHooks: () => Hook<any, any>[];
658
- export type AddACLOpptions = {
659
- userId?: string;
660
- role?: RoleEnum;
661
- read: boolean;
662
- write: boolean;
663
- } | null;
664
- declare class HookObject<T extends WabeTypes, K extends keyof WabeTypes["types"]> {
665
- className: K;
666
- private newData;
667
- private operationType;
668
- context: WabeContext<T>;
669
- object: OutputType<T, K, keyof T["types"][K]>;
670
- originalObject: OutputType<T, K, keyof T["types"][K]> | undefined;
671
- select: Array<keyof T["types"][K]>;
672
- constructor({ newData, className, operationType, context, object, originalObject, select, }: {
673
- className: K;
674
- newData?: MutationData<T, K, keyof T["types"][K]>;
675
- operationType: OperationType;
676
- context: WabeContext<T>;
677
- object: OutputType<T, K, keyof T["types"][K]>;
678
- originalObject?: OutputType<T, K, keyof T["types"][K]>;
679
- select: Select;
680
- });
681
- getUser(): User | null | undefined;
682
- isFieldUpdated(field: keyof T["types"][K]): boolean | undefined;
683
- upsertNewData(field: keyof T["types"][K], value: any): void;
684
- getNewData(): MutationData<T, K, keyof T["types"][K]>;
685
- fetch(): Promise<OutputType<T, K, keyof T["types"][K]>>;
686
- addACL(type: "users" | "roles", options: AddACLOpptions): Promise<void>;
687
- }
688
- export type WabePrimaryTypes = "String" | "Int" | "Float" | "Boolean" | "Email" | "Phone" | "Date" | "File";
689
- export type WabeCustomTypes = "Array" | "Object";
690
- export type WabeRelationTypes = "Pointer" | "Relation";
691
- export type WabeFieldTypes = WabeCustomTypes | WabePrimaryTypes | WabeRelationTypes;
692
- export type WabeObject<T extends WabeTypes> = {
693
- name: string;
694
- fields: SchemaFields<T>;
695
- description?: string;
696
- required?: boolean;
697
- };
698
- export type TypeFieldBase<U, K extends WabeFieldTypes> = {
699
- type: K;
700
- required?: boolean;
701
- description?: string;
702
- defaultValue?: U;
703
- };
704
- export type TypeFieldArray<T extends WabeTypes> = {
705
- type: "Array";
706
- required?: boolean;
707
- requiredValue?: boolean;
708
- description?: string;
709
- defaultValue?: any[];
710
- } & ({
711
- typeValue: WabePrimaryTypes;
712
- } | {
713
- typeValue: "Object";
714
- object: WabeObject<T>;
715
- });
716
- export type TypeFieldObject<T extends WabeTypes> = {
717
- type: "Object";
718
- required?: boolean;
719
- description?: string;
720
- object: WabeObject<T>;
721
- defaultValue?: any;
722
- };
723
- export type TypeFieldPointer<T extends WabeTypes> = {
724
- type: "Pointer";
725
- required?: boolean;
726
- description?: string;
727
- class: keyof T["types"];
728
- };
729
- export type TypeFieldRelation<T extends WabeTypes> = {
730
- type: "Relation";
731
- required?: boolean;
732
- description?: string;
733
- class: keyof T["types"];
734
- };
735
- export type TypeFieldFile = {
736
- type: "File";
737
- required?: boolean;
738
- description?: string;
739
- };
740
- export type TypeFieldCustomScalars<T extends WabeTypes> = {
741
- type: T["scalars"];
742
- required?: boolean;
743
- description?: string;
744
- defaultValue?: any;
745
- };
746
- export type TypeFieldCustomEnums<T extends WabeTypes> = {
747
- type: keyof T["enums"];
748
- required?: boolean;
749
- description?: string;
750
- defaultValue?: any;
751
- };
752
- 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>;
753
- export type SchemaFields<T extends WabeTypes> = Record<string, TypeField<T>>;
754
- export type ResolverType<T extends WabeTypes> = {
755
- required?: boolean;
756
- description?: string;
757
- resolve: (...args: any) => any;
758
- } & ({
759
- type: WabePrimaryTypes | T["enums"] | T["scalars"];
760
- } | {
761
- type: "Object";
762
- outputObject: ClassInterface<T>;
763
- } | {
764
- type: "Array";
765
- typeValue: WabePrimaryTypes;
766
- typeValueRequired?: boolean;
767
- } | {
768
- type: "Array";
769
- typeValue: "Object";
770
- outputObject: ClassInterface<T>;
771
- typeValueRequired?: boolean;
772
- });
773
- export type QueryResolver<T extends WabeTypes> = {
774
- args?: SchemaFields<T>;
775
- } & ResolverType<T>;
776
- export type MutationResolver<T extends WabeTypes> = {
777
- args?: {
778
- input: SchemaFields<T>;
779
- };
780
- } & ResolverType<T>;
781
- export type TypeResolver<T extends WabeTypes> = {
782
- queries?: {
783
- [key: string]: QueryResolver<T>;
784
- };
785
- mutations?: {
786
- [key: string]: MutationResolver<T>;
787
- };
788
- };
789
- export type PermissionsOperations = "create" | "read" | "update" | "delete";
790
- export interface PermissionProperties<T extends WabeTypes> {
791
- requireAuthentication?: boolean;
792
- /**
793
- * An empty array means that none role is authorized (except root client)
794
- */
795
- authorizedRoles?: Array<T["enums"]["RoleEnum"] | "everyone">;
796
- }
797
- /**
798
- * ACL properties
799
- * Callback to define the ACL object before insert of the object in the database
800
- * Can be done with a beforeCreate hook but for simplicity we can define it here
801
- */
802
- export type ACLProperties = (hookObject: HookObject<any, any>) => void | Promise<void>;
803
- export type ClassPermissions<T extends WabeTypes> = Partial<Record<PermissionsOperations, PermissionProperties<T>> & {
804
- acl: ACLProperties;
805
- }>;
806
- export type SearchableFields = Array<string>;
807
- export type ClassIndexes = Array<{
808
- field: string;
809
- order: "ASC" | "DESC";
810
- unique?: boolean;
811
- }>;
812
- export interface ClassInterface<T extends WabeTypes> {
813
- name: string;
814
- fields: SchemaFields<T>;
815
- description?: string;
816
- permissions?: ClassPermissions<T>;
817
- searchableFields?: SearchableFields;
818
- indexes?: ClassIndexes;
819
- }
820
- export interface ScalarInterface {
821
- name: string;
822
- description?: string;
823
- parseValue?: (value: any) => any;
824
- serialize?: (value: any) => any;
825
- parseLiteral?: (ast: any) => any;
826
- }
827
- export interface EnumInterface {
828
- name: string;
829
- values: Record<string, string>;
830
- description?: string;
831
- }
832
- export interface SchemaInterface<T extends WabeTypes> {
833
- classes?: ClassInterface<T>[];
834
- scalars?: ScalarInterface[];
835
- enums?: EnumInterface[];
836
- resolvers?: TypeResolver<T>;
837
- }
838
- export declare class Schema<T extends WabeTypes> {
839
- schema: SchemaInterface<T>;
840
- private config;
841
- constructor(config: WabeConfig<T>);
842
- defaultEnum(): EnumInterface[];
843
- mergeResolvers(defaultResolvers: TypeResolver<T>): TypeResolver<T>;
844
- defaultResolvers(): TypeResolver<T>;
845
- sessionClass(): ClassInterface<T>;
846
- roleClass(): ClassInterface<T>;
847
- internalConfigClass(): ClassInterface<T>;
848
- userClass(): ClassInterface<T>;
849
- defaultFields(): SchemaFields<T>;
850
- mergeClass(newClass: ClassInterface<T>[]): ClassInterface<T>[];
851
- defaultClass(schema?: SchemaInterface<T>): ClassInterface<T>[];
852
- }
853
- export declare enum ProviderEnum {
854
- google = "google",
855
- github = "github"
856
- }
857
- export interface ProviderConfig {
858
- clientId: string;
859
- clientSecret: string;
860
- }
861
- export type AuthenticationEventsOptions<T> = {
862
- input: T;
863
- context: WabeContext<any>;
864
- };
865
- export type AuthenticationEventsOptionsWithUserId<T> = AuthenticationEventsOptions<T> & {
866
- userId: string;
867
- };
868
- export type ProviderInterface<T = any> = {
869
- onSignIn: (options: AuthenticationEventsOptions<T>) => Promise<{
870
- user: Partial<User>;
871
- }>;
872
- onSignUp: (options: AuthenticationEventsOptions<T>) => Promise<{
873
- authenticationDataToSave: any;
874
- }>;
875
- onUpdateAuthenticationData?: (options: AuthenticationEventsOptionsWithUserId<T>) => Promise<{
876
- authenticationDataToSave: any;
877
- }>;
878
- };
879
- export type SecondaryProviderInterface<T = any> = {
880
- onSendChallenge: () => Promise<void>;
881
- onVerifyChallenge: (options: T) => Promise<boolean>;
882
- };
883
- export type CustomAuthenticationMethods<T extends WabeTypes, U = ProviderInterface | SecondaryProviderInterface, K = SchemaFields<T>, W = SchemaFields<T>> = {
884
- name: string;
885
- input: K;
886
- dataToStore?: W;
887
- provider: U;
888
- isSecondaryFactor?: boolean;
889
- };
890
- export type RoleConfig = Array<string>;
891
- export interface SessionConfig {
892
- /**
893
- * The time in milliseconds that the access token will expire
894
- */
895
- accessTokenExpiresInMs?: number;
896
- /**
897
- * The time in milliseconds that the refresh token will expire
898
- */
899
- refreshTokenExpiresInMs?: number;
900
- /**
901
- * Set to true to automatically store the session tokens in cookies
902
- */
903
- cookieSession?: boolean;
904
- }
905
- export interface AuthenticationConfig<T extends WabeTypes> {
906
- session?: SessionConfig;
907
- roles?: RoleConfig;
908
- successRedirectPath?: string;
909
- failureRedirectPath?: string;
910
- frontDomain?: string;
911
- backDomain?: string;
912
- providers?: Partial<Record<ProviderEnum, ProviderConfig>>;
913
- customAuthenticationMethods?: CustomAuthenticationMethods<T>[];
914
- }
915
- export interface CreateTokenFromAuthorizationCodeOptions {
916
- code: string;
917
- }
918
- export interface refreshTokenOptions {
919
- refreshToken: string;
920
- }
921
- export interface Provider {
922
- createTokenFromAuthorizationCode(options: CreateTokenFromAuthorizationCodeOptions): Promise<void>;
923
- refreshToken(options: refreshTokenOptions): Promise<void>;
924
- }
925
- declare enum AuthenticationProvider$1 {
926
- GitHub = "github",
927
- Google = "google",
928
- EmailPassword = "emailPassword",
929
- PhonePassword = "phonePassword"
930
- }
931
- export interface WabeRoute {
932
- method: "GET" | "POST" | "PUT" | "DELETE";
933
- path: string;
934
- handler: WobeHandler<WobeCustomContext<any>>;
935
- }
936
- export declare const generateCodegen: ({ schema, path, graphqlSchema, }: {
937
- schema: SchemaInterface<any>;
938
- path: string;
939
- graphqlSchema: GraphQLSchema;
940
- }) => Promise<void>;
941
- export declare class FileDevAdapter implements FileAdapter {
942
- private basePath;
943
- private rootPath;
944
- uploadFile(file: File | Blob): Promise<void>;
945
- readFile(fileName: string, options?: ReadFileOptions): Promise<string | null>;
946
- deleteFile(fileName: string): Promise<void>;
947
- }
948
- /**
949
- * The file config contains the adapter to use to upload file
950
- * @param adapter: FileAdapter
951
- * @param urlCacheInSeconds: number Number of seconds to cache the url, equal to the number of seconds the url will be valid
952
- * @param devDirectory: string The directory where the files will be uploaded
953
- */
954
- export interface FileConfig {
955
- adapter: FileAdapter;
956
- urlCacheInSeconds?: number;
957
- devDirectory?: string;
958
- }
959
- export interface ReadFileOptions {
960
- urlExpiresIn?: number;
961
- port?: number;
962
- }
963
- export interface FileAdapter {
964
- /**
965
- * Upload a file and returns the url of the file
966
- * @param file: File
967
- */
968
- uploadFile(file: File | Blob): Promise<void>;
969
- /**
970
- * Read a file and returns the url of the file
971
- * @param fileName: string
972
- * @param urlExpiresIn: number Number of seconds to expire the url
973
- * @returns The url of file or null if the file doesn't exist
974
- */
975
- readFile(fileName: string, options?: ReadFileOptions): Promise<string | null> | string | null;
976
- deleteFile(fileName: string): Promise<void>;
977
- }
978
- export type HtmlTemplates = {
979
- sendOTPCode: (options: {
980
- otp: string;
981
- }) => string | Promise<string>;
982
- };
983
- export interface EmailSendOptions {
984
- from: string;
985
- to: Array<string>;
986
- subject: string;
987
- node?: React.ReactNode;
988
- html?: string;
989
- text?: string;
990
- }
991
- export interface EmailAdapter {
992
- /**
993
- * Send an email using the provided adapter
994
- * @param options Mail options (expeditor, recipient, subject ...)
995
- * @return The id of the email sended, throw an error if something wrong
996
- */
997
- send(options: EmailSendOptions): Promise<string>;
998
- }
999
- /**
1000
- * Configuration for the email in Wabe
1001
- * @property adapter The adapter to use to send emails
1002
- * @property mainEmail The email to use as sender for emails sent by Wabe
1003
- * @property templates The html templates to use for a specific email. If not provided, Wabe will use the default templates
1004
- */
1005
- export interface EmailConfig {
1006
- adapter: EmailAdapter;
1007
- mainEmail?: string;
1008
- htmlTemplates?: HtmlTemplates;
1009
- }
1010
- export declare class EmailDevAdapter implements EmailAdapter {
1011
- send(): Promise<string>;
1012
- }
1013
- declare class EmailController implements EmailAdapter {
1014
- adapter: EmailAdapter;
1015
- constructor(adapter: EmailAdapter);
1016
- send(options: EmailSendOptions): Promise<string>;
1017
- }
1018
- export declare enum Currency {
1019
- EUR = "eur",
1020
- USD = "usd"
1021
- }
1022
- export type Address = {
1023
- city: string;
1024
- country: string;
1025
- line1: string;
1026
- line2: string;
1027
- postalCode: string;
1028
- state: string;
1029
- };
1030
- export declare enum PaymentMode {
1031
- payment = "payment",
1032
- subscription = "subscription"
1033
- }
1034
- export type PaymentMethod = "card" | "paypal" | "link" | "sepa_debit" | "revolut_pay" | "us_bank_account";
1035
- export declare enum PaymentReccuringInterval {
1036
- Month = "month",
1037
- Year = "year"
1038
- }
1039
- export type Product = {
1040
- name: string;
1041
- unitAmount: number;
1042
- quantity: number;
1043
- };
1044
- export interface OnPaymentSucceedOptions {
1045
- createdAt: number;
1046
- amount: number;
1047
- customerEmail: string | null;
1048
- currency: string;
1049
- paymentMethodTypes: Array<string>;
1050
- }
1051
- export interface OnPaymentFailedOptions {
1052
- createdAt: number;
1053
- amount: number;
1054
- paymentMethodTypes: Array<string>;
1055
- }
1056
- /**
1057
- * PaymentConfig
1058
- * @property adapter - The payment adapter
1059
- * @property supportedPaymentMethods - The supported payment methods
1060
- * @property currency - The currency
1061
- */
1062
- export interface PaymentConfig {
1063
- adapter: PaymentAdapter;
1064
- supportedPaymentMethods: Array<PaymentMethod>;
1065
- currency: Currency;
1066
- }
1067
- export type Invoice = {
1068
- amountDue: number;
1069
- amountPaid: number;
1070
- currency: Currency;
1071
- id: string;
1072
- created: number;
1073
- invoiceUrl: string;
1074
- isPaid: boolean;
1075
- };
1076
- export type Transaction = {
1077
- customerEmail: string;
1078
- amount: number;
1079
- currency: Currency;
1080
- created: number;
1081
- isSubscription: boolean;
1082
- reccuringInterval?: "month" | "year";
1083
- };
1084
- export type CreateCustomerOptions = {
1085
- customerName?: string;
1086
- customerEmail: string;
1087
- customerPhone?: string;
1088
- address: Address;
1089
- paymentMethod: PaymentMethod;
1090
- };
1091
- export type CreatePaymentOptions = {
1092
- currency: Currency;
1093
- customerEmail?: string;
1094
- products: Array<Product>;
1095
- paymentMethod: Array<PaymentMethod>;
1096
- paymentMode: PaymentMode;
1097
- successUrl: string;
1098
- cancelUrl: string;
1099
- automaticTax?: boolean;
1100
- recurringInterval?: "month" | "year";
1101
- createInvoice?: boolean;
1102
- allowPromotionCode?: boolean;
1103
- promotionCodeId?: string;
1104
- couponCodeId?: string;
1105
- };
1106
- export type InitWebhookOptions = {
1107
- webhookUrl: string;
1108
- };
1109
- export type CancelSubscriptionOptions = {
1110
- email: string;
1111
- };
1112
- export type GetInvoicesOptions = {
1113
- email: string;
1114
- };
1115
- export type GetTotalRevenueOptions = {
1116
- startRangeTimestamp?: number;
1117
- endRangeTimestamp?: number;
1118
- charge: "net" | "gross";
1119
- };
1120
- export type GetAllTransactionsOptions = {
1121
- startRangeTimestamp?: number;
1122
- endRangeTimestamp?: number;
1123
- first?: number;
1124
- };
1125
- export type GetCustomerByIdOptions = {
1126
- id: string;
1127
- };
1128
- export type ValidateWebhookOptions = {
1129
- ctx: Context;
1130
- endpointSecret: string;
1131
- };
1132
- /**
1133
- * ValidateWebhookOutput
1134
- * @property valid - Whether the webhook is valid or not
1135
- * @property payload - The payload of the webhook
1136
- */
1137
- export type ValidateWebhookOutput = {
1138
- isValid: boolean;
1139
- type: string;
1140
- payload: any | null;
1141
- };
1142
- export type InitWebhookOutput = {
1143
- webhookId: string;
1144
- endpointSecret: string;
1145
- };
1146
- export type CreateCouponOptions = {
1147
- amountOff?: number;
1148
- currency?: Currency;
1149
- duration?: "forever" | "once" | "repeating";
1150
- durationInMonths?: number;
1151
- name?: string;
1152
- percentOff?: number;
1153
- maxRedemptions?: number;
1154
- };
1155
- export type CreatePromotionCodeOptions = {
1156
- couponId: string;
1157
- code?: string;
1158
- active?: boolean;
1159
- maxRedemptions?: number;
1160
- };
1161
- export type DeleteCouponOptions = {
1162
- id: string;
1163
- };
1164
- export type UpdatePromotionCodeOptions = {
1165
- id: string;
1166
- active: boolean;
1167
- };
1168
- export interface PaymentAdapter {
1169
- /**
1170
- * Delete a coupon
1171
- * @param options DeleteCouponOptions
1172
- */
1173
- deleteCoupon: (options: DeleteCouponOptions) => Promise<void>;
1174
- /**
1175
- * Create a coupon
1176
- * @param options CreateCouponOptions
1177
- * @returns id The coupon id
1178
- */
1179
- createCoupon: (options: CreateCouponOptions) => Promise<{
1180
- code: string;
1181
- id: string;
1182
- }>;
1183
- /**
1184
- * Disable a promotion code
1185
- * @param options DeletePromotionCodeOptions
1186
- */
1187
- updatePromotionCode: (options: UpdatePromotionCodeOptions) => Promise<void>;
1188
- /**
1189
- * Create a promotion code from a coupon
1190
- * @param options CreatePromotionCodeOptions
1191
- * @returns code, id The promotion code and the stripe id
1192
- */
1193
- createPromotionCode: (options: CreatePromotionCodeOptions) => Promise<{
1194
- id: string;
1195
- code: string;
1196
- }>;
1197
- /**
1198
- * Get a customer by id
1199
- * @param id The customer id
1200
- * @returns The customer
1201
- */
1202
- getCustomerById: (options: GetCustomerByIdOptions) => Promise<{
1203
- email: string | null;
1204
- }>;
1205
- /**
1206
- * Create a customer
1207
- * @param options CreateCustomerOptions
1208
- * @returns The customer email
1209
- */
1210
- createCustomer: (options: CreateCustomerOptions) => Promise<string>;
1211
- /**
1212
- * Create a payment
1213
- * @param options CreatePaymentOptions
1214
- * @returns The payment url
1215
- */
1216
- createPayment: (options: CreatePaymentOptions) => Promise<string>;
1217
- /**
1218
- * Cancel a subscription
1219
- * @param options The customer email to cancel the subscription
1220
- */
1221
- cancelSubscription: (options: CancelSubscriptionOptions) => Promise<void>;
1222
- /**
1223
- * Get invoices
1224
- * @param options The customer email to get the invoices
1225
- * @returns The invoices of a customer
1226
- */
1227
- getInvoices: (options: GetInvoicesOptions) => Promise<Invoice[]>;
1228
- /**
1229
- * Get total revenue
1230
- * @param options The type of charge (net or gross) and the start and end range timestamps to get the total revenue
1231
- * @returns The total amount
1232
- */
1233
- getTotalRevenue: (options: GetTotalRevenueOptions) => Promise<number>;
1234
- /**
1235
- * Get the list of all transactions
1236
- * @param options The start and end range timestamps to get the transactions
1237
- * @returns The list of transactions
1238
- */
1239
- getAllTransactions: (options: GetAllTransactionsOptions) => Promise<Transaction[]>;
1240
- /**
1241
- * Get the hypothetical revenue of subscriptions
1242
- * @returns The hypothetical revenue of subscriptions
1243
- */
1244
- getHypotheticalSubscriptionRevenue: () => Promise<number>;
1245
- /**
1246
- * Check if the request on webhook is from a valid provier
1247
- * @param ctx The Wobe context of the request
1248
- * @returns True if the request is from a valid provider, false otherwise
1249
- */
1250
- validateWebhook: (options: ValidateWebhookOptions) => Promise<ValidateWebhookOutput>;
1251
- }
1252
- declare class PaymentController implements PaymentAdapter {
1253
- adapter: PaymentAdapter;
1254
- private config;
1255
- constructor(paymentConfig: PaymentConfig);
1256
- deleteCoupon(options: DeleteCouponOptions): Promise<void>;
1257
- updatePromotionCode(options: UpdatePromotionCodeOptions): Promise<void>;
1258
- createCoupon(options: CreateCouponOptions): Promise<{
1259
- code: string;
1260
- id: string;
1261
- }>;
1262
- createPromotionCode(options: CreatePromotionCodeOptions): Promise<{
1263
- id: string;
1264
- code: string;
1265
- }>;
1266
- getCustomerById(options: GetCustomerByIdOptions): Promise<{
1267
- email: string | null;
1268
- }>;
1269
- validateWebhook(ctx: any): Promise<ValidateWebhookOutput>;
1270
- createCustomer(options: CreateCustomerOptions): Promise<string>;
1271
- createPayment(options: Omit<CreatePaymentOptions, "currency" | "paymentMethod">): Promise<string>;
1272
- cancelSubscription(options: CancelSubscriptionOptions): Promise<void>;
1273
- getInvoices(options: GetInvoicesOptions): Promise<Invoice[]>;
1274
- getTotalRevenue(options: GetTotalRevenueOptions): Promise<number>;
1275
- getAllTransactions(options: GetAllTransactionsOptions): Promise<Transaction[]>;
1276
- getHypotheticalSubscriptionRevenue(): Promise<number>;
1277
- }
1278
- export interface CreateCompletionOptions {
1279
- content: string;
1280
- }
1281
- export interface AIAdapter {
1282
- createCompletion(options: CreateCompletionOptions): Promise<string>;
1283
- }
1284
- export interface AIConfig {
1285
- adapter: AIAdapter;
1286
- }
1287
- declare class FileController implements FileAdapter {
1288
- adapter: FileAdapter;
1289
- private wabe;
1290
- constructor(adapter: FileAdapter, wabe: Wabe<any>);
1291
- uploadFile(file: File | Blob): Promise<void>;
1292
- readFile(fileName: string, options?: ReadFileOptions): string | Promise<string | null> | null;
1293
- deleteFile(fileName: string): Promise<void>;
1294
- }
1295
- export type SecurityConfig = {
1296
- corsOptions?: CorsOptions;
1297
- rateLimit?: RateLimitOptions;
1298
- };
1299
- export interface WabeConfig<T extends WabeTypes> {
1300
- port: number;
1301
- isProduction?: boolean;
1302
- hostname?: string;
1303
- security?: SecurityConfig;
1304
- schema?: SchemaInterface<T>;
1305
- graphqlSchema?: GraphQLSchema;
1306
- database: DatabaseConfig;
1307
- codegen?: {
1308
- enabled: true;
1309
- path: string;
1310
- } | {
1311
- enabled?: false;
1312
- };
1313
- authentication?: AuthenticationConfig<T>;
1314
- routes?: WabeRoute[];
1315
- rootKey: string;
1316
- hooks?: Hook<T, any>[];
1317
- email?: EmailConfig;
1318
- payment?: PaymentConfig;
1319
- ai?: AIConfig;
1320
- file?: FileConfig;
1321
- }
1322
- export type WabeTypes = {
1323
- types: Record<any, any>;
1324
- scalars: string;
1325
- enums: Record<any, any>;
1326
- };
1327
- export type WobeCustomContext<T extends WabeTypes> = {
1328
- wabe: WabeContext<T>;
1329
- };
1330
- export type WabeControllers<T extends WabeTypes> = {
1331
- database: DatabaseController<T>;
1332
- email?: EmailController;
1333
- payment?: PaymentController;
1334
- file?: FileController;
1335
- };
1336
- export declare class Wabe<T extends WabeTypes> {
1337
- server: Wobe<WobeCustomContext<T>>;
1338
- config: WabeConfig<T>;
1339
- controllers: WabeControllers<T>;
1340
- constructor({ isProduction, port, hostname, security, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
1341
- loadRoleEnum(): void;
1342
- loadAuthenticationMethods(): void;
1343
- loadHooks(): void;
1344
- loadRoutes(): void;
1345
- start(): Promise<void>;
1346
- close(): Promise<void>;
1347
- }
1348
- export declare const signInWithResolver: (_: any, { input, }: {
1349
- input: SignInWithInput;
1350
- }, context: WabeContext<DevWabeTypes>) => Promise<{
1351
- accessToken: null;
1352
- refreshToken: null;
1353
- id: string;
1354
- } | {
1355
- accessToken: string;
1356
- refreshToken: string;
1357
- id: string;
1358
- }>;
1359
- export declare const signUpWithResolver: (_: any, { input, }: {
1360
- input: SignUpWithInput;
1361
- }, context: WabeContext<any>) => Promise<{
1362
- accessToken: string;
1363
- refreshToken: string;
1364
- id: any;
1365
- }>;
1366
- export interface TokenResponseBody {
1367
- access_token: string;
1368
- token_type?: string;
1369
- expires_in?: number;
1370
- refresh_token?: string;
1371
- scope?: string;
1372
- }
1373
- export declare class OAuth2Client {
1374
- clientId: string;
1375
- private authorizeEndpoint;
1376
- private tokenEndpoint;
1377
- private redirectURI;
1378
- constructor(clientId: string, authorizeEndpoint: string, tokenEndpoint: string, redirectURI: string);
1379
- createAuthorizationURL(options?: {
1380
- state?: string;
1381
- codeVerifier?: string;
1382
- scopes?: string[];
1383
- }): URL;
1384
- validateAuthorizationCode<_TokenResponseBody extends TokenResponseBody>(authorizationCode: string, options?: {
1385
- codeVerifier?: string;
1386
- credentials?: string;
1387
- authenticateWith?: "http_basic_auth" | "request_body";
1388
- }): Promise<_TokenResponseBody>;
1389
- refreshAccessToken<_TokenResponseBody extends TokenResponseBody>(refreshToken: string, options?: {
1390
- credentials?: string;
1391
- authenticateWith?: "http_basic_auth" | "request_body";
1392
- scopes?: string[];
1393
- }): Promise<_TokenResponseBody>;
1394
- _sendTokenRequest<_TokenResponseBody extends TokenResponseBody>(body: URLSearchParams, options?: {
1395
- credentials?: string;
1396
- authenticateWith?: "http_basic_auth" | "request_body";
1397
- }): Promise<_TokenResponseBody>;
1398
- }
1399
- export interface Tokens {
1400
- accessToken: string;
1401
- refreshToken?: string | null;
1402
- accessTokenExpiresAt?: Date;
1403
- refreshTokenExpiresAt?: Date | null;
1404
- idToken?: string;
1405
- }
1406
- export interface OAuth2ProviderWithPKCE {
1407
- createAuthorizationURL(state: string, codeVerifier: string): URL;
1408
- validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
1409
- refreshAccessToken?(refreshToken: string): Promise<Tokens>;
1410
- }
1411
- export declare class Google implements OAuth2ProviderWithPKCE {
1412
- private client;
1413
- private clientSecret;
1414
- constructor(config: WabeConfig<any>);
1415
- createAuthorizationURL(state: string, codeVerifier: string, options?: {
1416
- scopes?: string[];
1417
- }): URL;
1418
- validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
1419
- refreshAccessToken(refreshToken: string): Promise<Tokens>;
1420
- getUserInfo(accessToken: string, idToken: string): Promise<{
1421
- email: any;
1422
- verifiedEmail: any;
1423
- }>;
1424
- }
1425
- export declare class PaymentDevAdapter implements PaymentAdapter {
1426
- adapter: {};
1427
- getCustomerById(): Promise<{
1428
- email: string;
1429
- }>;
1430
- deleteCoupon(): Promise<void>;
1431
- updatePromotionCode(): Promise<void>;
1432
- createCoupon(): Promise<{
1433
- code: string;
1434
- id: string;
1435
- }>;
1436
- createPromotionCode(): Promise<{
1437
- code: string;
1438
- id: string;
1439
- }>;
1440
- validateWebhook(): Promise<{
1441
- isValid: boolean;
1442
- payload: {};
1443
- type: string;
1444
- }>;
1445
- createCustomer(): Promise<string>;
1446
- createPayment(): Promise<string>;
1447
- cancelSubscription(): Promise<void>;
1448
- getInvoices(): Promise<never[]>;
1449
- getTotalRevenue(): Promise<number>;
1450
- getAllTransactions(): Promise<never[]>;
1451
- getHypotheticalSubscriptionRevenue(): Promise<number>;
1452
- }
1453
- export declare const contextWithRoot: (context: WabeContext<any>) => WabeContext<any>;
1454
-
1455
- export {
1456
- AuthenticationProvider$1 as AuthenticationProvider,
1457
- };
1458
-
1459
- 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";