wabe 0.5.22 → 0.5.23
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 +4 -1
- package/dist/index.js +24 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -932,6 +932,8 @@ export interface AuthenticationConfig<T extends WabeTypes> {
|
|
|
932
932
|
roles?: RoleConfig;
|
|
933
933
|
successRedirectPath?: string;
|
|
934
934
|
failureRedirectPath?: string;
|
|
935
|
+
frontDomain?: string;
|
|
936
|
+
backDomain?: string;
|
|
935
937
|
providers?: Partial<Record<ProviderEnum, ProviderConfig>>;
|
|
936
938
|
customAuthenticationMethods?: CustomAuthenticationMethods<T>[];
|
|
937
939
|
}
|
|
@@ -1286,6 +1288,7 @@ export type SecurityConfig = {
|
|
|
1286
1288
|
};
|
|
1287
1289
|
export interface WabeConfig<T extends WabeTypes> {
|
|
1288
1290
|
port: number;
|
|
1291
|
+
isProduction?: boolean;
|
|
1289
1292
|
hostname?: string;
|
|
1290
1293
|
security?: SecurityConfig;
|
|
1291
1294
|
schema?: SchemaInterface<T>;
|
|
@@ -1322,7 +1325,7 @@ export declare class Wabe<T extends WabeTypes> {
|
|
|
1322
1325
|
server: Wobe<WobeCustomContext<T>>;
|
|
1323
1326
|
config: WabeConfig<T>;
|
|
1324
1327
|
controllers: WabeControllers<T>;
|
|
1325
|
-
constructor({ port, hostname, security, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
|
|
1328
|
+
constructor({ isProduction, port, hostname, security, schema, database, authentication, rootKey, codegen, hooks, file, email, payment, routes, }: WabeConfig<T>);
|
|
1326
1329
|
loadRoleEnum(): void;
|
|
1327
1330
|
loadAuthenticationMethods(): void;
|
|
1328
1331
|
loadHooks(): void;
|
package/dist/index.js
CHANGED
|
@@ -63019,7 +63019,8 @@ class Google {
|
|
|
63019
63019
|
const googleConfig = config.authentication?.providers?.google;
|
|
63020
63020
|
if (!googleConfig)
|
|
63021
63021
|
throw new Error("Google config not found");
|
|
63022
|
-
const
|
|
63022
|
+
const baseUrl = `http${config.isProduction ? "s" : ""}://${config.authentication?.backDomain || "127.0.0.1:" + config.port || 3000}`;
|
|
63023
|
+
const redirectURI = `${baseUrl}/auth/oauth/callback`;
|
|
63023
63024
|
this.client = new OAuth2Client(googleConfig.clientId, authorizeEndpoint, tokenEndpoint, redirectURI);
|
|
63024
63025
|
this.clientSecret = googleConfig.clientSecret;
|
|
63025
63026
|
}
|
|
@@ -63886,7 +63887,7 @@ class Schema {
|
|
|
63886
63887
|
}
|
|
63887
63888
|
|
|
63888
63889
|
// src/server/index.ts
|
|
63889
|
-
var
|
|
63890
|
+
var import_graphql49 = __toESM(require_graphql2(), 1);
|
|
63890
63891
|
|
|
63891
63892
|
// src/graphql/types.ts
|
|
63892
63893
|
var import_graphql2 = __toESM(require_graphql2(), 1);
|
|
@@ -75938,7 +75939,22 @@ class PaymentController {
|
|
|
75938
75939
|
}
|
|
75939
75940
|
|
|
75940
75941
|
// ../../node_modules/@graphql-yoga/plugin-disable-introspection/esm/index.js
|
|
75942
|
+
var import_graphql48 = __toESM(require_graphql2(), 1);
|
|
75941
75943
|
var store = new WeakMap;
|
|
75944
|
+
var useDisableIntrospection = (props) => {
|
|
75945
|
+
return {
|
|
75946
|
+
async onRequest({ request }) {
|
|
75947
|
+
const isDisabled = props?.isDisabled ? await props.isDisabled(request) : true;
|
|
75948
|
+
store.set(request, isDisabled);
|
|
75949
|
+
},
|
|
75950
|
+
onValidate({ addValidationRule, context }) {
|
|
75951
|
+
const isDisabled = store.get(context.request) ?? true;
|
|
75952
|
+
if (isDisabled) {
|
|
75953
|
+
addValidationRule(import_graphql48.NoSchemaIntrospectionCustomRule);
|
|
75954
|
+
}
|
|
75955
|
+
}
|
|
75956
|
+
};
|
|
75957
|
+
};
|
|
75942
75958
|
|
|
75943
75959
|
// src/server/index.ts
|
|
75944
75960
|
class Wabe {
|
|
@@ -75946,6 +75962,7 @@ class Wabe {
|
|
|
75946
75962
|
config;
|
|
75947
75963
|
controllers;
|
|
75948
75964
|
constructor({
|
|
75965
|
+
isProduction,
|
|
75949
75966
|
port,
|
|
75950
75967
|
hostname,
|
|
75951
75968
|
security,
|
|
@@ -75961,6 +75978,7 @@ class Wabe {
|
|
|
75961
75978
|
routes
|
|
75962
75979
|
}) {
|
|
75963
75980
|
this.config = {
|
|
75981
|
+
isProduction,
|
|
75964
75982
|
port,
|
|
75965
75983
|
hostname,
|
|
75966
75984
|
security,
|
|
@@ -76053,12 +76071,12 @@ class Wabe {
|
|
|
76053
76071
|
this.config.schema = wabeSchema.schema;
|
|
76054
76072
|
const graphqlSchema = new GraphQLSchema(wabeSchema);
|
|
76055
76073
|
const types3 = graphqlSchema.createSchema();
|
|
76056
|
-
const schema = new
|
|
76057
|
-
query: new
|
|
76074
|
+
const schema = new import_graphql49.GraphQLSchema({
|
|
76075
|
+
query: new import_graphql49.GraphQLObjectType({
|
|
76058
76076
|
name: "Query",
|
|
76059
76077
|
fields: types3.queries
|
|
76060
76078
|
}),
|
|
76061
|
-
mutation: new
|
|
76079
|
+
mutation: new import_graphql49.GraphQLObjectType({
|
|
76062
76080
|
name: "Mutation",
|
|
76063
76081
|
fields: types3.mutations
|
|
76064
76082
|
}),
|
|
@@ -76126,9 +76144,7 @@ class Wabe {
|
|
|
76126
76144
|
schema,
|
|
76127
76145
|
maskedErrors: false,
|
|
76128
76146
|
graphqlEndpoint: "/graphql",
|
|
76129
|
-
plugins: [
|
|
76130
|
-
false
|
|
76131
|
-
],
|
|
76147
|
+
plugins: this.config.isProduction ? [useDisableIntrospection()] : [],
|
|
76132
76148
|
context: async (ctx) => ctx.wabe,
|
|
76133
76149
|
graphqlMiddleware: async (resolve, res) => {
|
|
76134
76150
|
const response = await resolve();
|