wabe 0.5.8 → 0.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -25
- package/dist/index.js +58 -191
- package/generated/schema.graphql +0 -39
- package/generated/wabe.ts +0 -45
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/// <reference types="react" />
|
|
4
4
|
|
|
5
|
-
import { Context, CorsOptions, Wobe, WobeHandler, WobeResponse } from 'wobe';
|
|
5
|
+
import { Context, CorsOptions, RateLimitOptions, Wobe, WobeHandler, WobeResponse } from 'wobe';
|
|
6
6
|
|
|
7
7
|
export type Scalars = {
|
|
8
8
|
ID: {
|
|
@@ -1009,7 +1009,11 @@ export type WabeFileAdapter = (file: File) => Promise<string>;
|
|
|
1009
1009
|
export interface FileConfig {
|
|
1010
1010
|
adapter: WabeFileAdapter;
|
|
1011
1011
|
}
|
|
1012
|
-
export type
|
|
1012
|
+
export type HtmlTemplates = {
|
|
1013
|
+
sendOTPCode: (options: {
|
|
1014
|
+
otp: string;
|
|
1015
|
+
}) => string | Promise<string>;
|
|
1016
|
+
};
|
|
1013
1017
|
export interface EmailSendOptions {
|
|
1014
1018
|
from: string;
|
|
1015
1019
|
to: Array<string>;
|
|
@@ -1035,7 +1039,7 @@ export interface EmailAdapter {
|
|
|
1035
1039
|
export interface EmailConfig {
|
|
1036
1040
|
adapter: EmailAdapter;
|
|
1037
1041
|
mainEmail?: string;
|
|
1038
|
-
htmlTemplates?:
|
|
1042
|
+
htmlTemplates?: HtmlTemplates;
|
|
1039
1043
|
}
|
|
1040
1044
|
export declare class EmailDevAdapter implements EmailAdapter {
|
|
1041
1045
|
send(): Promise<string>;
|
|
@@ -1120,7 +1124,7 @@ export type CreateCustomerOptions = {
|
|
|
1120
1124
|
};
|
|
1121
1125
|
export type CreatePaymentOptions = {
|
|
1122
1126
|
currency: Currency$1;
|
|
1123
|
-
customerEmail
|
|
1127
|
+
customerEmail?: string;
|
|
1124
1128
|
products: Array<Product>;
|
|
1125
1129
|
paymentMethod: Array<PaymentMethod>;
|
|
1126
1130
|
paymentMode: PaymentMode;
|
|
@@ -1159,23 +1163,11 @@ export type ValidateWebhookOptions = {
|
|
|
1159
1163
|
* ValidateWebhookOutput
|
|
1160
1164
|
* @property valid - Whether the webhook is valid or not
|
|
1161
1165
|
* @property payload - The payload of the webhook
|
|
1162
|
-
* @property type - The type of the webhook
|
|
1163
|
-
* @property customerId - The customer id
|
|
1164
|
-
* @property createdAt - The created at timestamp in seconds
|
|
1165
|
-
* @property currency - The currency
|
|
1166
|
-
* @property amount - The amount
|
|
1167
|
-
* @property paymentMethod - The payment method
|
|
1168
1166
|
*/
|
|
1169
1167
|
export type ValidateWebhookOutput = {
|
|
1170
1168
|
isValid: boolean;
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
customerId?: string;
|
|
1174
|
-
createdAt?: number;
|
|
1175
|
-
currency?: string;
|
|
1176
|
-
amount?: number;
|
|
1177
|
-
paymentMethod?: Array<string>;
|
|
1178
|
-
};
|
|
1169
|
+
type: string;
|
|
1170
|
+
payload: any | null;
|
|
1179
1171
|
};
|
|
1180
1172
|
export type InitWebhookOutput = {
|
|
1181
1173
|
webhookId: string;
|
|
@@ -1253,10 +1245,14 @@ declare class PaymentController implements PaymentAdapter {
|
|
|
1253
1245
|
getAllTransactions(options: GetAllTransactionsOptions): Promise<Transaction[]>;
|
|
1254
1246
|
getHypotheticalSubscriptionRevenue(): Promise<number>;
|
|
1255
1247
|
}
|
|
1248
|
+
export type SecurityConfig = {
|
|
1249
|
+
corsOptions?: CorsOptions;
|
|
1250
|
+
rateLimit?: RateLimitOptions;
|
|
1251
|
+
};
|
|
1256
1252
|
export interface WabeConfig<T extends WabeTypes> {
|
|
1257
1253
|
port: number;
|
|
1258
1254
|
hostname?: string;
|
|
1259
|
-
|
|
1255
|
+
security?: SecurityConfig;
|
|
1260
1256
|
schema?: SchemaInterface<T>;
|
|
1261
1257
|
database: DatabaseConfig;
|
|
1262
1258
|
codegen?: {
|
|
@@ -1290,7 +1286,7 @@ export declare class Wabe<T extends WabeTypes> {
|
|
|
1290
1286
|
server: Wobe<WobeCustomContext<T>>;
|
|
1291
1287
|
config: WabeConfig<T>;
|
|
1292
1288
|
controllers: WabeControllers<T>;
|
|
1293
|
-
constructor({ port, hostname,
|
|
1289
|
+
constructor({ port, hostname, security, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
|
|
1294
1290
|
loadRoleEnum(): void;
|
|
1295
1291
|
loadAuthenticationMethods(): void;
|
|
1296
1292
|
loadHooks(): void;
|
|
@@ -1357,7 +1353,7 @@ export interface Tokens {
|
|
|
1357
1353
|
idToken?: string;
|
|
1358
1354
|
}
|
|
1359
1355
|
export interface OAuth2ProviderWithPKCE {
|
|
1360
|
-
createAuthorizationURL(state: string, codeVerifier: string):
|
|
1356
|
+
createAuthorizationURL(state: string, codeVerifier: string): URL;
|
|
1361
1357
|
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
1362
1358
|
refreshAccessToken?(refreshToken: string): Promise<Tokens>;
|
|
1363
1359
|
}
|
|
@@ -1367,7 +1363,7 @@ export declare class Google implements OAuth2ProviderWithPKCE {
|
|
|
1367
1363
|
constructor(config: WabeConfig<any>);
|
|
1368
1364
|
createAuthorizationURL(state: string, codeVerifier: string, options?: {
|
|
1369
1365
|
scopes?: string[];
|
|
1370
|
-
}):
|
|
1366
|
+
}): URL;
|
|
1371
1367
|
validateAuthorizationCode(code: string, codeVerifier: string): Promise<Tokens>;
|
|
1372
1368
|
refreshAccessToken(refreshToken: string): Promise<Tokens>;
|
|
1373
1369
|
getUserInfo(accessToken: string, idToken: string): Promise<{
|
|
@@ -1381,9 +1377,8 @@ export declare class PaymentDevAdapter implements PaymentAdapter {
|
|
|
1381
1377
|
}>;
|
|
1382
1378
|
validateWebhook(): Promise<{
|
|
1383
1379
|
isValid: boolean;
|
|
1384
|
-
payload: {
|
|
1385
|
-
|
|
1386
|
-
};
|
|
1380
|
+
payload: {};
|
|
1381
|
+
type: string;
|
|
1387
1382
|
}>;
|
|
1388
1383
|
createCustomer(): Promise<string>;
|
|
1389
1384
|
createPayment(): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -61415,7 +61415,7 @@ class PaymentDevAdapter {
|
|
|
61415
61415
|
};
|
|
61416
61416
|
}
|
|
61417
61417
|
async validateWebhook() {
|
|
61418
|
-
return { isValid: true, payload: { type: "" }
|
|
61418
|
+
return { isValid: true, payload: {}, type: "" };
|
|
61419
61419
|
}
|
|
61420
61420
|
async createCustomer() {
|
|
61421
61421
|
return "";
|
|
@@ -61824,12 +61824,12 @@ var getDefaultHooks = () => [
|
|
|
61824
61824
|
},
|
|
61825
61825
|
{
|
|
61826
61826
|
operationType: "beforeCreate" /* BeforeCreate */,
|
|
61827
|
-
priority:
|
|
61827
|
+
priority: 3,
|
|
61828
61828
|
callback: defaultSearchableFieldsBeforeCreate
|
|
61829
61829
|
},
|
|
61830
61830
|
{
|
|
61831
61831
|
operationType: "beforeUpdate" /* BeforeUpdate */,
|
|
61832
|
-
priority:
|
|
61832
|
+
priority: 3,
|
|
61833
61833
|
callback: defaultSearchableFieldsBeforeUpdate
|
|
61834
61834
|
},
|
|
61835
61835
|
{
|
|
@@ -61846,13 +61846,13 @@ var getDefaultHooks = () => [
|
|
|
61846
61846
|
{
|
|
61847
61847
|
className: "User",
|
|
61848
61848
|
operationType: "beforeCreate" /* BeforeCreate */,
|
|
61849
|
-
priority:
|
|
61849
|
+
priority: 2,
|
|
61850
61850
|
callback: defaultSetEmail
|
|
61851
61851
|
},
|
|
61852
61852
|
{
|
|
61853
61853
|
className: "User",
|
|
61854
61854
|
operationType: "beforeUpdate" /* BeforeUpdate */,
|
|
61855
|
-
priority:
|
|
61855
|
+
priority: 2,
|
|
61856
61856
|
callback: defaultSetEmailOnUpdate
|
|
61857
61857
|
},
|
|
61858
61858
|
{
|
|
@@ -62784,9 +62784,9 @@ class Google {
|
|
|
62784
62784
|
this.client = new OAuth2Client(googleConfig.clientId, authorizeEndpoint, tokenEndpoint, redirectURI);
|
|
62785
62785
|
this.clientSecret = googleConfig.clientSecret;
|
|
62786
62786
|
}
|
|
62787
|
-
|
|
62787
|
+
createAuthorizationURL(state, codeVerifier, options) {
|
|
62788
62788
|
const scopes = options?.scopes ?? [];
|
|
62789
|
-
const url =
|
|
62789
|
+
const url = this.client.createAuthorizationURL({
|
|
62790
62790
|
state,
|
|
62791
62791
|
codeVerifier,
|
|
62792
62792
|
scopes: [...scopes, "openid"]
|
|
@@ -62870,73 +62870,6 @@ var verifyChallengeResolver = async (_, {
|
|
|
62870
62870
|
return true;
|
|
62871
62871
|
};
|
|
62872
62872
|
|
|
62873
|
-
// src/schema/resolvers/cancelSubscription.ts
|
|
62874
|
-
var cancelSubscriptionResolver = (_, { input }, context) => {
|
|
62875
|
-
if (!context.user && !context.isRoot)
|
|
62876
|
-
throw new Error("Permission denied");
|
|
62877
|
-
const paymentController = context.wabe.controllers.payment;
|
|
62878
|
-
if (!paymentController)
|
|
62879
|
-
throw new Error("Payment adapter not defined");
|
|
62880
|
-
return paymentController.cancelSubscription(input);
|
|
62881
|
-
};
|
|
62882
|
-
|
|
62883
|
-
// src/schema/resolvers/makePayment.ts
|
|
62884
|
-
var makePaymentResolver = async (_, { input }, context) => {
|
|
62885
|
-
if (!context.user && !context.isRoot)
|
|
62886
|
-
throw new Error("Permission denied");
|
|
62887
|
-
const paymentController = context.wabe.controllers.payment;
|
|
62888
|
-
if (!paymentController)
|
|
62889
|
-
throw new Error("Payment adapter not defined");
|
|
62890
|
-
const {
|
|
62891
|
-
cancelUrl,
|
|
62892
|
-
successUrl,
|
|
62893
|
-
customerEmail,
|
|
62894
|
-
paymentMode,
|
|
62895
|
-
automaticTax,
|
|
62896
|
-
recurringInterval,
|
|
62897
|
-
products
|
|
62898
|
-
} = input;
|
|
62899
|
-
const email = customerEmail || context.user?.email;
|
|
62900
|
-
if (!email)
|
|
62901
|
-
throw new Error("Customer email is required");
|
|
62902
|
-
const userWithEmail = await context.wabe.controllers.database.getObjects({
|
|
62903
|
-
className: "User",
|
|
62904
|
-
context: {
|
|
62905
|
-
...context,
|
|
62906
|
-
isRoot: true
|
|
62907
|
-
},
|
|
62908
|
-
fields: ["id"],
|
|
62909
|
-
where: {
|
|
62910
|
-
email: {
|
|
62911
|
-
equalTo: email
|
|
62912
|
-
}
|
|
62913
|
-
},
|
|
62914
|
-
first: 1
|
|
62915
|
-
});
|
|
62916
|
-
if (!userWithEmail.length)
|
|
62917
|
-
throw new Error("User not found");
|
|
62918
|
-
const url = await paymentController.createPayment({
|
|
62919
|
-
cancelUrl,
|
|
62920
|
-
successUrl,
|
|
62921
|
-
customerEmail: email,
|
|
62922
|
-
paymentMode,
|
|
62923
|
-
automaticTax: automaticTax ?? false,
|
|
62924
|
-
recurringInterval: recurringInterval ?? "month",
|
|
62925
|
-
products
|
|
62926
|
-
});
|
|
62927
|
-
return url;
|
|
62928
|
-
};
|
|
62929
|
-
|
|
62930
|
-
// src/schema/resolvers/getInvoices.ts
|
|
62931
|
-
var getInvoicesResolver = (_, { email }, context) => {
|
|
62932
|
-
if (!context.user && !context.isRoot)
|
|
62933
|
-
throw new Error("Permission denied");
|
|
62934
|
-
const paymentController = context.wabe.controllers.payment;
|
|
62935
|
-
if (!paymentController)
|
|
62936
|
-
throw new Error("Payment adapter not defined");
|
|
62937
|
-
return paymentController.getInvoices({ email });
|
|
62938
|
-
};
|
|
62939
|
-
|
|
62940
62873
|
// src/schema/resolvers/meResolver.ts
|
|
62941
62874
|
var meResolver = (_, __, context) => {
|
|
62942
62875
|
return {
|
|
@@ -63174,7 +63107,7 @@ var sendOtpCodeResolver = async (_, { input }, context) => {
|
|
|
63174
63107
|
const otpClass = new OTP(context.wabe.config.rootKey);
|
|
63175
63108
|
const otp = otpClass.generate(userId);
|
|
63176
63109
|
const mainEmail = context.wabe.config.email?.mainEmail || "noreply@wabe.com";
|
|
63177
|
-
const template = context.wabe.config.email?.htmlTemplates?.sendOTPCode(otp) || sendOtpCodeTemplate(otp);
|
|
63110
|
+
const template = await context.wabe.config.email?.htmlTemplates?.sendOTPCode({ otp }) || sendOtpCodeTemplate(otp);
|
|
63178
63111
|
await emailController.send({
|
|
63179
63112
|
from: mainEmail,
|
|
63180
63113
|
to: [input.email],
|
|
@@ -63198,52 +63131,6 @@ var defaultQueries = {
|
|
|
63198
63131
|
}
|
|
63199
63132
|
},
|
|
63200
63133
|
resolve: meResolver
|
|
63201
|
-
},
|
|
63202
|
-
getInvoices: {
|
|
63203
|
-
type: "Array",
|
|
63204
|
-
typeValue: "Object",
|
|
63205
|
-
required: true,
|
|
63206
|
-
outputObject: {
|
|
63207
|
-
name: "Invoice",
|
|
63208
|
-
fields: {
|
|
63209
|
-
amountDue: {
|
|
63210
|
-
type: "Int",
|
|
63211
|
-
required: true
|
|
63212
|
-
},
|
|
63213
|
-
amountPaid: {
|
|
63214
|
-
type: "Int",
|
|
63215
|
-
required: true
|
|
63216
|
-
},
|
|
63217
|
-
currency: {
|
|
63218
|
-
type: "Currency",
|
|
63219
|
-
required: true
|
|
63220
|
-
},
|
|
63221
|
-
id: {
|
|
63222
|
-
type: "String",
|
|
63223
|
-
required: true
|
|
63224
|
-
},
|
|
63225
|
-
created: {
|
|
63226
|
-
type: "Int",
|
|
63227
|
-
required: true
|
|
63228
|
-
},
|
|
63229
|
-
invoiceUrl: {
|
|
63230
|
-
type: "String",
|
|
63231
|
-
required: true
|
|
63232
|
-
},
|
|
63233
|
-
isPaid: {
|
|
63234
|
-
type: "Boolean",
|
|
63235
|
-
required: true
|
|
63236
|
-
}
|
|
63237
|
-
}
|
|
63238
|
-
},
|
|
63239
|
-
description: "Get invoices of a customer",
|
|
63240
|
-
args: {
|
|
63241
|
-
email: {
|
|
63242
|
-
type: "Email",
|
|
63243
|
-
required: true
|
|
63244
|
-
}
|
|
63245
|
-
},
|
|
63246
|
-
resolve: getInvoicesResolver
|
|
63247
63134
|
}
|
|
63248
63135
|
};
|
|
63249
63136
|
var defaultMutations = {
|
|
@@ -63285,72 +63172,6 @@ var defaultMutations = {
|
|
|
63285
63172
|
},
|
|
63286
63173
|
resolve: sendOtpCodeResolver
|
|
63287
63174
|
},
|
|
63288
|
-
makePayment: {
|
|
63289
|
-
type: "String",
|
|
63290
|
-
description: "Create a payment with the payment provider. Returns the url to redirect the user to pay",
|
|
63291
|
-
args: {
|
|
63292
|
-
input: {
|
|
63293
|
-
customerEmail: {
|
|
63294
|
-
type: "Email",
|
|
63295
|
-
description: "The payer's email, if not provided, the payer's email will be the user's email that call the mutation."
|
|
63296
|
-
},
|
|
63297
|
-
paymentMode: {
|
|
63298
|
-
type: "PaymentMode",
|
|
63299
|
-
required: true
|
|
63300
|
-
},
|
|
63301
|
-
successUrl: {
|
|
63302
|
-
type: "String",
|
|
63303
|
-
required: true
|
|
63304
|
-
},
|
|
63305
|
-
cancelUrl: {
|
|
63306
|
-
type: "String",
|
|
63307
|
-
required: true
|
|
63308
|
-
},
|
|
63309
|
-
products: {
|
|
63310
|
-
type: "Array",
|
|
63311
|
-
typeValue: "Object",
|
|
63312
|
-
object: {
|
|
63313
|
-
name: "Product",
|
|
63314
|
-
fields: {
|
|
63315
|
-
name: {
|
|
63316
|
-
type: "String",
|
|
63317
|
-
required: true
|
|
63318
|
-
},
|
|
63319
|
-
unitAmount: {
|
|
63320
|
-
type: "Int",
|
|
63321
|
-
required: true
|
|
63322
|
-
},
|
|
63323
|
-
quantity: {
|
|
63324
|
-
type: "Int",
|
|
63325
|
-
required: true
|
|
63326
|
-
}
|
|
63327
|
-
}
|
|
63328
|
-
},
|
|
63329
|
-
required: true,
|
|
63330
|
-
requiredValue: true
|
|
63331
|
-
},
|
|
63332
|
-
automaticTax: {
|
|
63333
|
-
type: "Boolean"
|
|
63334
|
-
},
|
|
63335
|
-
recurringInterval: {
|
|
63336
|
-
type: "PaymentReccuringInterval"
|
|
63337
|
-
}
|
|
63338
|
-
}
|
|
63339
|
-
},
|
|
63340
|
-
resolve: makePaymentResolver
|
|
63341
|
-
},
|
|
63342
|
-
cancelSubscription: {
|
|
63343
|
-
type: "Boolean",
|
|
63344
|
-
args: {
|
|
63345
|
-
input: {
|
|
63346
|
-
email: {
|
|
63347
|
-
type: "Email",
|
|
63348
|
-
required: true
|
|
63349
|
-
}
|
|
63350
|
-
}
|
|
63351
|
-
},
|
|
63352
|
-
resolve: cancelSubscriptionResolver
|
|
63353
|
-
},
|
|
63354
63175
|
sendEmail: {
|
|
63355
63176
|
type: "String",
|
|
63356
63177
|
description: "Send basic email with text and html, returns the id of the email",
|
|
@@ -66421,6 +66242,34 @@ class Wobe {
|
|
|
66421
66242
|
this.runtimeAdapter.stopServer(this.server);
|
|
66422
66243
|
}
|
|
66423
66244
|
}
|
|
66245
|
+
|
|
66246
|
+
class WobeStore {
|
|
66247
|
+
options;
|
|
66248
|
+
store;
|
|
66249
|
+
intervalId = undefined;
|
|
66250
|
+
constructor(options) {
|
|
66251
|
+
this.options = options;
|
|
66252
|
+
this.store = {};
|
|
66253
|
+
this._init();
|
|
66254
|
+
}
|
|
66255
|
+
_init() {
|
|
66256
|
+
this.intervalId = setInterval(() => {
|
|
66257
|
+
this.clear();
|
|
66258
|
+
}, this.options.interval);
|
|
66259
|
+
}
|
|
66260
|
+
set(key, value) {
|
|
66261
|
+
this.store[key] = value;
|
|
66262
|
+
}
|
|
66263
|
+
get(key) {
|
|
66264
|
+
return this.store[key];
|
|
66265
|
+
}
|
|
66266
|
+
clear() {
|
|
66267
|
+
this.store = {};
|
|
66268
|
+
}
|
|
66269
|
+
stop() {
|
|
66270
|
+
clearInterval(this.intervalId);
|
|
66271
|
+
}
|
|
66272
|
+
}
|
|
66424
66273
|
var cors = (options) => {
|
|
66425
66274
|
const defaults = {
|
|
66426
66275
|
origin: "*",
|
|
@@ -66467,6 +66316,21 @@ var cors = (options) => {
|
|
|
66467
66316
|
}
|
|
66468
66317
|
};
|
|
66469
66318
|
};
|
|
66319
|
+
var rateLimit = ({
|
|
66320
|
+
interval,
|
|
66321
|
+
numberOfRequests
|
|
66322
|
+
}) => {
|
|
66323
|
+
const store = new WobeStore({
|
|
66324
|
+
interval
|
|
66325
|
+
});
|
|
66326
|
+
return (ctx) => {
|
|
66327
|
+
const ipAdress = ctx.getIpAdress();
|
|
66328
|
+
const userRequests = store.get(ipAdress) || 0;
|
|
66329
|
+
if (userRequests >= numberOfRequests)
|
|
66330
|
+
throw new HttpException(new Response("Rate limit exceeded", { status: 429 }));
|
|
66331
|
+
store.set(ipAdress, userRequests + 1);
|
|
66332
|
+
};
|
|
66333
|
+
};
|
|
66470
66334
|
|
|
66471
66335
|
// ../../node_modules/graphql-yoga/esm/error.js
|
|
66472
66336
|
var import_graphql27 = __toESM(require_graphql2(), 1);
|
|
@@ -75838,7 +75702,7 @@ class Wabe {
|
|
|
75838
75702
|
constructor({
|
|
75839
75703
|
port,
|
|
75840
75704
|
hostname,
|
|
75841
|
-
|
|
75705
|
+
security,
|
|
75842
75706
|
schema,
|
|
75843
75707
|
database,
|
|
75844
75708
|
authentication,
|
|
@@ -75853,7 +75717,7 @@ class Wabe {
|
|
|
75853
75717
|
this.config = {
|
|
75854
75718
|
port,
|
|
75855
75719
|
hostname,
|
|
75856
|
-
|
|
75720
|
+
security,
|
|
75857
75721
|
schema,
|
|
75858
75722
|
database,
|
|
75859
75723
|
codegen,
|
|
@@ -75965,8 +75829,11 @@ class Wabe {
|
|
|
75965
75829
|
}
|
|
75966
75830
|
this.server.options("/*", (ctx) => {
|
|
75967
75831
|
return ctx.res.send("OK");
|
|
75968
|
-
}, cors(this.config.corsOptions));
|
|
75969
|
-
this.
|
|
75832
|
+
}, cors(this.config.security?.corsOptions));
|
|
75833
|
+
const rateLimitOptions = this.config.security?.rateLimit;
|
|
75834
|
+
if (rateLimitOptions)
|
|
75835
|
+
this.server.beforeHandler(rateLimit(rateLimitOptions));
|
|
75836
|
+
this.server.beforeHandler(cors(this.config.security?.corsOptions));
|
|
75970
75837
|
this.server.beforeHandler(async (ctx) => {
|
|
75971
75838
|
const headers = ctx.request.headers;
|
|
75972
75839
|
if (headers.get("Wabe-Root-Key") === this.config.rootKey) {
|
package/generated/schema.graphql
CHANGED
|
@@ -722,9 +722,6 @@ type Query {
|
|
|
722
722
|
"""Hello world description"""
|
|
723
723
|
helloWorld(name: String!): String
|
|
724
724
|
me: MeOutput
|
|
725
|
-
|
|
726
|
-
"""Get invoices of a customer"""
|
|
727
|
-
getInvoices(email: Email!): [Invoice]!
|
|
728
725
|
}
|
|
729
726
|
|
|
730
727
|
"""User class"""
|
|
@@ -1200,16 +1197,6 @@ type MeOutput {
|
|
|
1200
1197
|
user: User
|
|
1201
1198
|
}
|
|
1202
1199
|
|
|
1203
|
-
type Invoice {
|
|
1204
|
-
amountDue: Int!
|
|
1205
|
-
amountPaid: Int!
|
|
1206
|
-
currency: Currency!
|
|
1207
|
-
id: String!
|
|
1208
|
-
created: Int!
|
|
1209
|
-
invoiceUrl: String!
|
|
1210
|
-
isPaid: Boolean!
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
1200
|
type Mutation {
|
|
1214
1201
|
"""User class"""
|
|
1215
1202
|
createUser(input: CreateUserInput!): CreateUserPayload
|
|
@@ -1268,12 +1255,6 @@ type Mutation {
|
|
|
1268
1255
|
"""Send an OTP code by email to the user"""
|
|
1269
1256
|
sendOtpCode(input: SendOtpCodeInput!): Boolean
|
|
1270
1257
|
|
|
1271
|
-
"""
|
|
1272
|
-
Create a payment with the payment provider. Returns the url to redirect the user to pay
|
|
1273
|
-
"""
|
|
1274
|
-
makePayment(input: MakePaymentInput!): String
|
|
1275
|
-
cancelSubscription(input: CancelSubscriptionInput!): Boolean
|
|
1276
|
-
|
|
1277
1258
|
"""Send basic email with text and html, returns the id of the email"""
|
|
1278
1259
|
sendEmail(input: SendEmailInput!): String
|
|
1279
1260
|
signInWith(input: SignInWithInput!): SignInWithOutput
|
|
@@ -1785,26 +1766,6 @@ input SendOtpCodeInput {
|
|
|
1785
1766
|
email: Email!
|
|
1786
1767
|
}
|
|
1787
1768
|
|
|
1788
|
-
input MakePaymentInput {
|
|
1789
|
-
customerEmail: Email
|
|
1790
|
-
paymentMode: PaymentMode!
|
|
1791
|
-
successUrl: String!
|
|
1792
|
-
cancelUrl: String!
|
|
1793
|
-
products: [MakePaymentProductInput]!
|
|
1794
|
-
automaticTax: Boolean
|
|
1795
|
-
recurringInterval: PaymentReccuringInterval
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
input MakePaymentProductInput {
|
|
1799
|
-
name: String!
|
|
1800
|
-
unitAmount: Int!
|
|
1801
|
-
quantity: Int!
|
|
1802
|
-
}
|
|
1803
|
-
|
|
1804
|
-
input CancelSubscriptionInput {
|
|
1805
|
-
email: Email!
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
1769
|
input SendEmailInput {
|
|
1809
1770
|
from: String!
|
|
1810
1771
|
to: [String!]!
|
package/generated/wabe.ts
CHANGED
|
@@ -705,7 +705,6 @@ export type Query = {
|
|
|
705
705
|
_internalConfigs: _InternalConfigConnection;
|
|
706
706
|
helloWorld?: Scalars['String']['output'];
|
|
707
707
|
me?: MeOutput;
|
|
708
|
-
getInvoices: Invoice[];
|
|
709
708
|
};
|
|
710
709
|
|
|
711
710
|
export type QueryUserArgs = {
|
|
@@ -778,10 +777,6 @@ export type QueryHelloWorldArgs = {
|
|
|
778
777
|
name: Scalars['String']['input'];
|
|
779
778
|
};
|
|
780
779
|
|
|
781
|
-
export type QueryGetInvoicesArgs = {
|
|
782
|
-
email: Scalars['Email']['input'];
|
|
783
|
-
};
|
|
784
|
-
|
|
785
780
|
export type UserWhereInput = {
|
|
786
781
|
id?: IdWhereInput;
|
|
787
782
|
name?: StringWhereInput;
|
|
@@ -1246,16 +1241,6 @@ export type MeOutput = {
|
|
|
1246
1241
|
user?: User;
|
|
1247
1242
|
};
|
|
1248
1243
|
|
|
1249
|
-
export type Invoice = {
|
|
1250
|
-
amountDue: Scalars['Int']['output'];
|
|
1251
|
-
amountPaid: Scalars['Int']['output'];
|
|
1252
|
-
currency: Currency;
|
|
1253
|
-
id: Scalars['String']['output'];
|
|
1254
|
-
created: Scalars['Int']['output'];
|
|
1255
|
-
invoiceUrl: Scalars['String']['output'];
|
|
1256
|
-
isPaid: Scalars['Boolean']['output'];
|
|
1257
|
-
};
|
|
1258
|
-
|
|
1259
1244
|
export type Mutation = {
|
|
1260
1245
|
createUser?: CreateUserPayload;
|
|
1261
1246
|
createUsers: UserConnection;
|
|
@@ -1298,8 +1283,6 @@ export type Mutation = {
|
|
|
1298
1283
|
secondCustomMutation?: Scalars['Int']['output'];
|
|
1299
1284
|
resetPassword?: Scalars['Boolean']['output'];
|
|
1300
1285
|
sendOtpCode?: Scalars['Boolean']['output'];
|
|
1301
|
-
makePayment?: Scalars['String']['output'];
|
|
1302
|
-
cancelSubscription?: Scalars['Boolean']['output'];
|
|
1303
1286
|
sendEmail?: Scalars['String']['output'];
|
|
1304
1287
|
signInWith?: SignInWithOutput;
|
|
1305
1288
|
signUpWith?: SignUpWithOutput;
|
|
@@ -1472,14 +1455,6 @@ export type MutationSendOtpCodeArgs = {
|
|
|
1472
1455
|
input: SendOtpCodeInput;
|
|
1473
1456
|
};
|
|
1474
1457
|
|
|
1475
|
-
export type MutationMakePaymentArgs = {
|
|
1476
|
-
input: MakePaymentInput;
|
|
1477
|
-
};
|
|
1478
|
-
|
|
1479
|
-
export type MutationCancelSubscriptionArgs = {
|
|
1480
|
-
input: CancelSubscriptionInput;
|
|
1481
|
-
};
|
|
1482
|
-
|
|
1483
1458
|
export type MutationSendEmailArgs = {
|
|
1484
1459
|
input: SendEmailInput;
|
|
1485
1460
|
};
|
|
@@ -2001,26 +1976,6 @@ export type SendOtpCodeInput = {
|
|
|
2001
1976
|
email: Scalars['Email']['input'];
|
|
2002
1977
|
};
|
|
2003
1978
|
|
|
2004
|
-
export type MakePaymentInput = {
|
|
2005
|
-
customerEmail?: Scalars['Email']['input'];
|
|
2006
|
-
paymentMode: PaymentMode;
|
|
2007
|
-
successUrl: Scalars['String']['input'];
|
|
2008
|
-
cancelUrl: Scalars['String']['input'];
|
|
2009
|
-
products: MakePaymentProductInput[];
|
|
2010
|
-
automaticTax?: Scalars['Boolean']['input'];
|
|
2011
|
-
recurringInterval?: PaymentReccuringInterval;
|
|
2012
|
-
};
|
|
2013
|
-
|
|
2014
|
-
export type MakePaymentProductInput = {
|
|
2015
|
-
name: Scalars['String']['input'];
|
|
2016
|
-
unitAmount: Scalars['Int']['input'];
|
|
2017
|
-
quantity: Scalars['Int']['input'];
|
|
2018
|
-
};
|
|
2019
|
-
|
|
2020
|
-
export type CancelSubscriptionInput = {
|
|
2021
|
-
email: Scalars['Email']['input'];
|
|
2022
|
-
};
|
|
2023
|
-
|
|
2024
1979
|
export type SendEmailInput = {
|
|
2025
1980
|
from: Scalars['String']['input'];
|
|
2026
1981
|
to: Scalars['String']['input'][];
|