Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/adapters/express/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ExpressAdapterOptions {
* Auth service interface with handleRequest method
*/
interface AuthService {
handleRequest(request: Request): Promise<globalThis.Response>;
handleRequest(request: globalThis.Request): Promise<globalThis.Response>;
}

/**
Expand Down
13 changes: 7 additions & 6 deletions packages/adapters/nextjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,15 @@ export interface ServerActionResult<T = any> {
*/
export function createServerActions(options: NextAdapterOptions) {
const dispatcher = new HttpDispatcher(options.kernel);
const emptyContext = { request: undefined };

return {
/**
* Query records from an object
*/
async query(objectName: string, params?: Record<string, any>): Promise<ServerActionResult> {
try {
const result = await dispatcher.handleData(`/${objectName}`, 'GET', {}, params || {}, {});
const result = await dispatcher.handleData(`/${objectName}`, 'GET', {}, params || {}, emptyContext);
if (result.handled && result.response) {
return { success: true, data: result.response.body };
}
Expand All @@ -221,7 +222,7 @@ export function createServerActions(options: NextAdapterOptions) {
*/
async getById(objectName: string, id: string): Promise<ServerActionResult> {
try {
const result = await dispatcher.handleData(`/${objectName}/${id}`, 'GET', {}, {}, {});
const result = await dispatcher.handleData(`/${objectName}/${id}`, 'GET', {}, {}, emptyContext);
if (result.handled && result.response) {
return { success: true, data: result.response.body };
}
Expand All @@ -236,7 +237,7 @@ export function createServerActions(options: NextAdapterOptions) {
*/
async create(objectName: string, data: Record<string, any>): Promise<ServerActionResult> {
try {
const result = await dispatcher.handleData(`/${objectName}`, 'POST', data, {}, {});
const result = await dispatcher.handleData(`/${objectName}`, 'POST', data, {}, emptyContext);
if (result.handled && result.response) {
return { success: true, data: result.response.body };
}
Expand All @@ -251,7 +252,7 @@ export function createServerActions(options: NextAdapterOptions) {
*/
async update(objectName: string, id: string, data: Record<string, any>): Promise<ServerActionResult> {
try {
const result = await dispatcher.handleData(`/${objectName}/${id}`, 'PATCH', data, {}, {});
const result = await dispatcher.handleData(`/${objectName}/${id}`, 'PATCH', data, {}, emptyContext);
if (result.handled && result.response) {
return { success: true, data: result.response.body };
}
Expand All @@ -266,7 +267,7 @@ export function createServerActions(options: NextAdapterOptions) {
*/
async remove(objectName: string, id: string): Promise<ServerActionResult> {
try {
const result = await dispatcher.handleData(`/${objectName}/${id}`, 'DELETE', {}, {}, {});
const result = await dispatcher.handleData(`/${objectName}/${id}`, 'DELETE', {}, {}, emptyContext);
if (result.handled && result.response) {
return { success: true, data: result.response.body };
}
Expand All @@ -281,7 +282,7 @@ export function createServerActions(options: NextAdapterOptions) {
*/
async getMetadata(path?: string): Promise<ServerActionResult> {
try {
const result = await dispatcher.handleMetadata(path || '', {}, 'GET');
const result = await dispatcher.handleMetadata(path || '', emptyContext, 'GET');
if (result.handled && result.response) {
return { success: true, data: result.response.body };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/sveltekit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function createRequestHandler(options: SvelteKitAdapterOptions) {

// --- GraphQL ---
if (segments[0] === 'graphql' && method === 'POST') {
const body = await request.json();
const body = await request.json() as { query: string; variables?: any };
const result = await dispatcher.handleGraphQL(body, { request });
return new Response(JSON.stringify(result), {
status: 200,
Expand Down
Loading