@egdesk/next-api-plugin 1.5.35 → 1.5.38
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/generate-helpers.js +210 -2
- package/dist/generate-middleware.js +47 -1
- package/dist/generate-proxy.js +46 -2
- package/dist/generate-visitor-auth.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/setup-userdata.js +3 -0
- package/package.json +1 -1
package/dist/generate-helpers.js
CHANGED
|
@@ -137,7 +137,7 @@ function generateHelpers(projectPath, options = {}) {
|
|
|
137
137
|
const helperContent = `/**
|
|
138
138
|
* EGDesk Helper Functions for Next.js
|
|
139
139
|
*
|
|
140
|
-
* Type-safe helpers for EGDesk user data, Google Workspace (Sheets / Drive MCP + sync, Gmail, Apps Script),
|
|
140
|
+
* Type-safe helpers for EGDesk user data, Google Workspace (Sheets / Drive / Docs / Slides MCP + sync, Gmail, Apps Script),
|
|
141
141
|
* FinanceHub (banks, cards, Hometax, promissory notes),
|
|
142
142
|
* internal knowledge / business identity / company research (MCP), Korean law (MCP), and browser recorder replay / live browse.
|
|
143
143
|
* Works in both client and server components.
|
|
@@ -154,6 +154,7 @@ function generateHelpers(projectPath, options = {}) {
|
|
|
154
154
|
* - Check that EGDesk is running and MCP tools are actually available before relying on them.
|
|
155
155
|
* - For app code in this repo, keep using these helpers (queryTable, etc.) — MCP is optional for agents.
|
|
156
156
|
* - If MCP tools are missing/empty, fall back to helpers + EGDESK-README.md; ask the user to install MCP from EGDesk.
|
|
157
|
+
* - Tunnel: getEgdeskTunnel() (live prod/dev URLs + X-Api-Key). Embed into Apps Script with setupAppsScriptEgdeskTunnel().
|
|
157
158
|
*/
|
|
158
159
|
|
|
159
160
|
import { EGDESK_CONFIG } from './egdesk.config';
|
|
@@ -1896,6 +1897,16 @@ export async function closeBrowserRecordingSession(sessionId: string) {
|
|
|
1896
1897
|
return callBrowserRecordingTool('browser_recording_close_session', { sessionId });
|
|
1897
1898
|
}
|
|
1898
1899
|
|
|
1900
|
+
/** Workflow clicks/fills/keys logged in an open live session (no passwords) */
|
|
1901
|
+
export async function listBrowserRecordingSessionActions(sessionId: string) {
|
|
1902
|
+
return callBrowserRecordingTool('browser_recording_list_session_actions', { sessionId });
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/** Save the live session as a new *.spec.js (login prefix + logged workflow). Does not close Chrome. */
|
|
1906
|
+
export async function saveBrowserRecordingSession(sessionId: string, name: string) {
|
|
1907
|
+
return callBrowserRecordingTool('browser_recording_save_session', { sessionId, name });
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1899
1910
|
// ==========================================
|
|
1900
1911
|
// AI CENTER (workflows, entities, relations, tags)
|
|
1901
1912
|
// ==========================================
|
|
@@ -3023,6 +3034,7 @@ export async function syncDrive(options: {
|
|
|
3023
3034
|
/**
|
|
3024
3035
|
* Call EGDesk Sheets MCP tool.
|
|
3025
3036
|
*
|
|
3037
|
+
* Auth: personal OAuth, service account, or domain-wide delegation (call getSheetsAuthStatus() first).
|
|
3026
3038
|
* - Server: \`POST {apiUrl}/sheets/tools/call\`
|
|
3027
3039
|
* - Client: \`POST /__sheets_proxy\`
|
|
3028
3040
|
*/
|
|
@@ -3055,6 +3067,11 @@ export async function callSheetsTool(
|
|
|
3055
3067
|
return parseEgdeskMcpToolResponse(response);
|
|
3056
3068
|
}
|
|
3057
3069
|
|
|
3070
|
+
/** Who Sheets/Docs/Slides/Drive calls act as: personal_oauth, service_account, or domain_wide_delegation */
|
|
3071
|
+
export async function getSheetsAuthStatus() {
|
|
3072
|
+
return callSheetsTool('sheets_auth_status', {});
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3058
3075
|
/** Spreadsheet metadata (tabs, dimensions) */
|
|
3059
3076
|
export async function getSpreadsheet(spreadsheetId: string) {
|
|
3060
3077
|
return callSheetsTool('sheets_get_spreadsheet', { spreadsheetId });
|
|
@@ -3124,6 +3141,139 @@ export async function tintSheetDataTab(spreadsheetId: string, sheetName: string)
|
|
|
3124
3141
|
return callSheetsTool('sheets_tint_data_tab', { spreadsheetId, sheetName });
|
|
3125
3142
|
}
|
|
3126
3143
|
|
|
3144
|
+
// ==========================================
|
|
3145
|
+
// Google Docs (MCP)
|
|
3146
|
+
// ==========================================
|
|
3147
|
+
|
|
3148
|
+
export async function callDocsTool(
|
|
3149
|
+
toolName: string,
|
|
3150
|
+
args: Record<string, any> = {}
|
|
3151
|
+
): Promise<any> {
|
|
3152
|
+
const body = JSON.stringify({ tool: toolName, arguments: args });
|
|
3153
|
+
const isServer = typeof window === 'undefined';
|
|
3154
|
+
let response: Response;
|
|
3155
|
+
if (isServer) {
|
|
3156
|
+
const apiUrl =
|
|
3157
|
+
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
|
|
3158
|
+
EGDESK_CONFIG.apiUrl;
|
|
3159
|
+
response = await fetch(\`\${apiUrl}/docs/tools/call\`, {
|
|
3160
|
+
method: 'POST',
|
|
3161
|
+
headers: buildServerEgdeskHeaders(),
|
|
3162
|
+
body
|
|
3163
|
+
});
|
|
3164
|
+
} else {
|
|
3165
|
+
response = await apiFetch('/__docs_proxy', {
|
|
3166
|
+
method: 'POST',
|
|
3167
|
+
headers: { 'Content-Type': 'application/json' },
|
|
3168
|
+
body
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
return parseEgdeskMcpToolResponse(response);
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
export async function getGoogleDocsAuthStatus() {
|
|
3175
|
+
return callDocsTool('docs_auth_status', {});
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
export async function createGoogleDoc(title: string) {
|
|
3179
|
+
return callDocsTool('docs_create', { title });
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
export async function getGoogleDoc(documentId: string) {
|
|
3183
|
+
return callDocsTool('docs_get', { documentId });
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
export async function getGoogleDocText(documentId: string) {
|
|
3187
|
+
return callDocsTool('docs_get_text', { documentId });
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
export async function insertGoogleDocText(documentId: string, text: string, index?: number) {
|
|
3191
|
+
return callDocsTool('docs_insert_text', { documentId, text, index });
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
export async function replaceGoogleDocText(
|
|
3195
|
+
documentId: string,
|
|
3196
|
+
findText: string,
|
|
3197
|
+
replaceText: string,
|
|
3198
|
+
matchCase?: boolean,
|
|
3199
|
+
) {
|
|
3200
|
+
return callDocsTool('docs_replace_text', { documentId, findText, replaceText, matchCase });
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
// ==========================================
|
|
3204
|
+
// Google Slides (MCP)
|
|
3205
|
+
// ==========================================
|
|
3206
|
+
|
|
3207
|
+
export async function callSlidesTool(
|
|
3208
|
+
toolName: string,
|
|
3209
|
+
args: Record<string, any> = {}
|
|
3210
|
+
): Promise<any> {
|
|
3211
|
+
const body = JSON.stringify({ tool: toolName, arguments: args });
|
|
3212
|
+
const isServer = typeof window === 'undefined';
|
|
3213
|
+
let response: Response;
|
|
3214
|
+
if (isServer) {
|
|
3215
|
+
const apiUrl =
|
|
3216
|
+
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
|
|
3217
|
+
EGDESK_CONFIG.apiUrl;
|
|
3218
|
+
response = await fetch(\`\${apiUrl}/slides/tools/call\`, {
|
|
3219
|
+
method: 'POST',
|
|
3220
|
+
headers: buildServerEgdeskHeaders(),
|
|
3221
|
+
body
|
|
3222
|
+
});
|
|
3223
|
+
} else {
|
|
3224
|
+
response = await apiFetch('/__slides_proxy', {
|
|
3225
|
+
method: 'POST',
|
|
3226
|
+
headers: { 'Content-Type': 'application/json' },
|
|
3227
|
+
body
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
return parseEgdeskMcpToolResponse(response);
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
export async function getGoogleSlidesAuthStatus() {
|
|
3234
|
+
return callSlidesTool('slides_auth_status', {});
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
export async function createGoogleSlides(title: string) {
|
|
3238
|
+
return callSlidesTool('slides_create', { title });
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
export async function getGoogleSlides(presentationId: string) {
|
|
3242
|
+
return callSlidesTool('slides_get', { presentationId });
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3245
|
+
export async function getGoogleSlidesText(presentationId: string) {
|
|
3246
|
+
return callSlidesTool('slides_get_text', { presentationId });
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
export async function addGoogleSlide(
|
|
3250
|
+
presentationId: string,
|
|
3251
|
+
options: { text?: string; insertionIndex?: number } = {},
|
|
3252
|
+
) {
|
|
3253
|
+
return callSlidesTool('slides_add_slide', { presentationId, ...options });
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
export async function replaceGoogleSlidesText(
|
|
3257
|
+
presentationId: string,
|
|
3258
|
+
findText: string,
|
|
3259
|
+
replaceText: string,
|
|
3260
|
+
matchCase?: boolean,
|
|
3261
|
+
) {
|
|
3262
|
+
return callSlidesTool('slides_replace_text', { presentationId, findText, replaceText, matchCase });
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
export async function insertGoogleSlidesImage(
|
|
3266
|
+
presentationId: string,
|
|
3267
|
+
options: {
|
|
3268
|
+
filePath?: string;
|
|
3269
|
+
imageUrl?: string;
|
|
3270
|
+
slideIndex?: number;
|
|
3271
|
+
slideObjectId?: string;
|
|
3272
|
+
},
|
|
3273
|
+
) {
|
|
3274
|
+
return callSlidesTool('slides_insert_image', { presentationId, ...options });
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3127
3277
|
// ==========================================
|
|
3128
3278
|
// Google Sheets HTTP sync — My DB ↔ Workspace
|
|
3129
3279
|
// ==========================================
|
|
@@ -3199,6 +3349,11 @@ export async function callGmailTool(
|
|
|
3199
3349
|
return parseEgdeskMcpToolResponse(response);
|
|
3200
3350
|
}
|
|
3201
3351
|
|
|
3352
|
+
/** Who Gmail calls act as: personal_oauth, service_account, or domain_wide_delegation */
|
|
3353
|
+
export async function getGmailAuthStatus() {
|
|
3354
|
+
return callGmailTool('gmail_auth_status', {});
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3202
3357
|
/** Workspace → local: list domain users */
|
|
3203
3358
|
export async function listGmailUsers() {
|
|
3204
3359
|
return callGmailTool('gmail_list_users', {});
|
|
@@ -3220,7 +3375,7 @@ export async function searchGmailMessages(
|
|
|
3220
3375
|
return callGmailTool('gmail_search_messages', { query, ...options });
|
|
3221
3376
|
}
|
|
3222
3377
|
|
|
3223
|
-
/** Local → Workspace: send
|
|
3378
|
+
/** Local → Workspace: send via personal OAuth or service account (see getGmailAuthStatus()) */
|
|
3224
3379
|
export async function sendGmailMessage(options: {
|
|
3225
3380
|
to: string;
|
|
3226
3381
|
subject: string;
|
|
@@ -3266,6 +3421,11 @@ export async function callAppsScriptTool(
|
|
|
3266
3421
|
return parseEgdeskMcpToolResponse(response);
|
|
3267
3422
|
}
|
|
3268
3423
|
|
|
3424
|
+
/** Apps Script auth mode and identity (OAuth or service account / DWD — call before create/push/run) */
|
|
3425
|
+
export async function getAppsScriptAuthStatus() {
|
|
3426
|
+
return callAppsScriptTool('apps_script_auth_status', {});
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3269
3429
|
/** Local → Workspace */
|
|
3270
3430
|
export async function pushAppsScriptToGoogle(
|
|
3271
3431
|
projectId: string,
|
|
@@ -3305,6 +3465,23 @@ export async function createAppsScriptForSpreadsheet(options: {
|
|
|
3305
3465
|
});
|
|
3306
3466
|
}
|
|
3307
3467
|
|
|
3468
|
+
/**
|
|
3469
|
+
* Embed this EGDesk machine's tunnel URL + X-Api-Key into an Apps Script project
|
|
3470
|
+
* (EgdeskConfig.gs / EgdeskClient.gs) and push to Google.
|
|
3471
|
+
* Pass projectId to update an existing project, or fileId to create a bound script.
|
|
3472
|
+
*/
|
|
3473
|
+
export async function setupAppsScriptEgdeskTunnel(options: {
|
|
3474
|
+
projectId?: string;
|
|
3475
|
+
fileId?: string;
|
|
3476
|
+
spreadsheetId?: string;
|
|
3477
|
+
title?: string;
|
|
3478
|
+
role?: 'prod' | 'dev';
|
|
3479
|
+
push?: boolean;
|
|
3480
|
+
force?: boolean;
|
|
3481
|
+
} = {}) {
|
|
3482
|
+
return callAppsScriptTool('apps_script_setup_egdesk_tunnel', options);
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3308
3485
|
/**
|
|
3309
3486
|
* Apps Script HTTP sync (POST /apps-script/sync).
|
|
3310
3487
|
* direction toWorkspace = push; toLocal = pull. Does not accept \`both\`.
|
|
@@ -3520,6 +3697,37 @@ export async function listGeminiApiKeys() {
|
|
|
3520
3697
|
return listApiKeys({ provider: 'google' });
|
|
3521
3698
|
}
|
|
3522
3699
|
|
|
3700
|
+
/** Tunnel URL + API key from env / egdesk.config (no live health check). */
|
|
3701
|
+
export function getEgdeskTunnelFromEnv(): {
|
|
3702
|
+
publicUrl: string;
|
|
3703
|
+
apiKey: string | undefined;
|
|
3704
|
+
userDataToolsCallUrl: string;
|
|
3705
|
+
} {
|
|
3706
|
+
const publicUrl = (
|
|
3707
|
+
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_TUNNEL_URL) ||
|
|
3708
|
+
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_URL) ||
|
|
3709
|
+
(EGDESK_CONFIG as { tunnelUrl?: string }).tunnelUrl ||
|
|
3710
|
+
EGDESK_CONFIG.apiUrl ||
|
|
3711
|
+
''
|
|
3712
|
+
).replace(/\\/$/, '');
|
|
3713
|
+
const apiKey =
|
|
3714
|
+
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_EGDESK_API_KEY) ||
|
|
3715
|
+
EGDESK_CONFIG.apiKey;
|
|
3716
|
+
return {
|
|
3717
|
+
publicUrl,
|
|
3718
|
+
apiKey,
|
|
3719
|
+
userDataToolsCallUrl: publicUrl ? \`\${publicUrl}/user-data/tools/call\` : '',
|
|
3720
|
+
};
|
|
3721
|
+
}
|
|
3722
|
+
|
|
3723
|
+
/**
|
|
3724
|
+
* Live prod/dev tunnel addresses and shared X-Api-Key from EGDesk
|
|
3725
|
+
* (\`egdesk_get_tunnel\`). Use setupAppsScriptEgdeskTunnel() to embed them in Apps Script.
|
|
3726
|
+
*/
|
|
3727
|
+
export async function getEgdeskTunnel(role?: 'prod' | 'dev') {
|
|
3728
|
+
return callEgdeskConfigTool('egdesk_get_tunnel', role ? { role } : {});
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3523
3731
|
// ==========================================
|
|
3524
3732
|
// Phone / Google Messages (MCP)
|
|
3525
3733
|
// ==========================================
|
|
@@ -73,7 +73,7 @@ import type { NextRequest } from 'next/server';
|
|
|
73
73
|
/**
|
|
74
74
|
* EGDesk Database Proxy Middleware
|
|
75
75
|
*
|
|
76
|
-
* Intercepts __user_data_proxy, __browser_recording_proxy, __internal_knowledge_proxy, __company_research_proxy, __kakao_proxy, __drive_proxy, __sheets_proxy, __egdesk_http_proxy, __gmail_proxy, __apps_script_proxy, __visitor_auth_proxy, and __visitor_google_proxy requests
|
|
76
|
+
* Intercepts __user_data_proxy, __browser_recording_proxy, __internal_knowledge_proxy, __company_research_proxy, __kakao_proxy, __drive_proxy, __sheets_proxy, __docs_proxy, __slides_proxy, __egdesk_http_proxy, __gmail_proxy, __apps_script_proxy, __visitor_auth_proxy, and __visitor_google_proxy requests
|
|
77
77
|
* and forwards them to the EGDesk MCP HTTP server.
|
|
78
78
|
* This allows CORS-free database access in both local and tunneled environments.
|
|
79
79
|
*
|
|
@@ -282,6 +282,52 @@ export async function middleware(request: NextRequest) {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
+
if (pathname.includes('__docs_proxy')) {
|
|
286
|
+
try {
|
|
287
|
+
const body = await request.text();
|
|
288
|
+
const apiKey = process.env.NEXT_PUBLIC_EGDESK_API_KEY;
|
|
289
|
+
const apiUrl = process.env.NEXT_PUBLIC_EGDESK_API_URL || 'http://localhost:8080';
|
|
290
|
+
const headers: HeadersInit = { 'Content-Type': 'application/json' };
|
|
291
|
+
if (apiKey) headers['X-Api-Key'] = apiKey;
|
|
292
|
+
|
|
293
|
+
const response = await fetch(\`\${apiUrl}/docs/tools/call\`, {
|
|
294
|
+
method: 'POST',
|
|
295
|
+
headers,
|
|
296
|
+
body,
|
|
297
|
+
});
|
|
298
|
+
const result = await response.json();
|
|
299
|
+
return NextResponse.json(result, { status: response.status });
|
|
300
|
+
} catch (error: any) {
|
|
301
|
+
return NextResponse.json(
|
|
302
|
+
{ error: 'Proxy error', message: error.message },
|
|
303
|
+
{ status: 500 }
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (pathname.includes('__slides_proxy')) {
|
|
309
|
+
try {
|
|
310
|
+
const body = await request.text();
|
|
311
|
+
const apiKey = process.env.NEXT_PUBLIC_EGDESK_API_KEY;
|
|
312
|
+
const apiUrl = process.env.NEXT_PUBLIC_EGDESK_API_URL || 'http://localhost:8080';
|
|
313
|
+
const headers: HeadersInit = { 'Content-Type': 'application/json' };
|
|
314
|
+
if (apiKey) headers['X-Api-Key'] = apiKey;
|
|
315
|
+
|
|
316
|
+
const response = await fetch(\`\${apiUrl}/slides/tools/call\`, {
|
|
317
|
+
method: 'POST',
|
|
318
|
+
headers,
|
|
319
|
+
body,
|
|
320
|
+
});
|
|
321
|
+
const result = await response.json();
|
|
322
|
+
return NextResponse.json(result, { status: response.status });
|
|
323
|
+
} catch (error: any) {
|
|
324
|
+
return NextResponse.json(
|
|
325
|
+
{ error: 'Proxy error', message: error.message },
|
|
326
|
+
{ status: 500 }
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
285
331
|
if (pathname.includes('__sheets_proxy')) {
|
|
286
332
|
try {
|
|
287
333
|
const body = await request.text();
|
package/dist/generate-proxy.js
CHANGED
|
@@ -75,7 +75,7 @@ import type { NextRequest } from 'next/server';
|
|
|
75
75
|
/**
|
|
76
76
|
* EGDesk Database Proxy (Next.js 16+)
|
|
77
77
|
*
|
|
78
|
-
* Intercepts __user_data_proxy, __browser_recording_proxy, __internal_knowledge_proxy, __company_research_proxy, __ai_center_proxy, __korean_law_proxy, __seo_proxy, __ssl_proxy, __local_agent_proxy, __pageindex_proxy, __drive_proxy, __sheets_proxy, __egdesk_http_proxy, __gmail_proxy, __apps_script_proxy, __knowledge_wiki_proxy, __egdesk_config_proxy, __ai_caller_proxy, __kakao_proxy, __phone_proxy, __instagram_proxy, __financehub_proxy, __blog_proxy, __youtube_proxy, __visitor_auth_proxy, and __visitor_google_proxy requests
|
|
78
|
+
* Intercepts __user_data_proxy, __browser_recording_proxy, __internal_knowledge_proxy, __company_research_proxy, __ai_center_proxy, __korean_law_proxy, __seo_proxy, __ssl_proxy, __local_agent_proxy, __pageindex_proxy, __drive_proxy, __sheets_proxy, __docs_proxy, __slides_proxy, __egdesk_http_proxy, __gmail_proxy, __apps_script_proxy, __knowledge_wiki_proxy, __egdesk_config_proxy, __ai_caller_proxy, __kakao_proxy, __phone_proxy, __instagram_proxy, __financehub_proxy, __blog_proxy, __youtube_proxy, __visitor_auth_proxy, and __visitor_google_proxy requests
|
|
79
79
|
* and forwards them to the EGDesk MCP HTTP server. This avoids CORS in local and tunneled environments.
|
|
80
80
|
*
|
|
81
81
|
* Generated by @egdesk/next-api-plugin
|
|
@@ -349,6 +349,50 @@ export async function proxy(request: NextRequest) {
|
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
if (pathname.includes('__docs_proxy')) {
|
|
353
|
+
try {
|
|
354
|
+
const body = await request.text();
|
|
355
|
+
const apiUrl = process.env.NEXT_PUBLIC_EGDESK_API_URL || 'http://localhost:8080';
|
|
356
|
+
|
|
357
|
+
const response = await fetch(\`\${apiUrl}/docs/tools/call\`, {
|
|
358
|
+
method: 'POST',
|
|
359
|
+
headers: buildEgdeskHeaders(),
|
|
360
|
+
body,
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
const result = await response.json();
|
|
364
|
+
|
|
365
|
+
return NextResponse.json(result, { status: response.status });
|
|
366
|
+
} catch (error: any) {
|
|
367
|
+
return NextResponse.json(
|
|
368
|
+
{ error: 'Proxy error', message: error.message },
|
|
369
|
+
{ status: 500 }
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (pathname.includes('__slides_proxy')) {
|
|
375
|
+
try {
|
|
376
|
+
const body = await request.text();
|
|
377
|
+
const apiUrl = process.env.NEXT_PUBLIC_EGDESK_API_URL || 'http://localhost:8080';
|
|
378
|
+
|
|
379
|
+
const response = await fetch(\`\${apiUrl}/slides/tools/call\`, {
|
|
380
|
+
method: 'POST',
|
|
381
|
+
headers: buildEgdeskHeaders(),
|
|
382
|
+
body,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
const result = await response.json();
|
|
386
|
+
|
|
387
|
+
return NextResponse.json(result, { status: response.status });
|
|
388
|
+
} catch (error: any) {
|
|
389
|
+
return NextResponse.json(
|
|
390
|
+
{ error: 'Proxy error', message: error.message },
|
|
391
|
+
{ status: 500 }
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
352
396
|
if (pathname.includes('__sheets_proxy')) {
|
|
353
397
|
try {
|
|
354
398
|
const body = await request.text();
|
|
@@ -693,7 +737,7 @@ export const config = {
|
|
|
693
737
|
matcher: [
|
|
694
738
|
/*
|
|
695
739
|
* Match all paths except static assets
|
|
696
|
-
* The proxy function filters for __user_data_proxy / __browser_recording_proxy / __internal_knowledge_proxy / __company_research_proxy / __ai_center_proxy / __korean_law_proxy / __seo_proxy / __ssl_proxy / __local_agent_proxy / __pageindex_proxy / __drive_proxy / __sheets_proxy / __egdesk_http_proxy / __gmail_proxy / __apps_script_proxy / __knowledge_wiki_proxy / __egdesk_config_proxy / __ai_caller_proxy / __kakao_proxy / __phone_proxy / __instagram_proxy / __financehub_proxy / __blog_proxy / __youtube_proxy / __visitor_auth_proxy / __visitor_google_proxy
|
|
740
|
+
* The proxy function filters for __user_data_proxy / __browser_recording_proxy / __internal_knowledge_proxy / __company_research_proxy / __ai_center_proxy / __korean_law_proxy / __seo_proxy / __ssl_proxy / __local_agent_proxy / __pageindex_proxy / __drive_proxy / __sheets_proxy / __docs_proxy / __slides_proxy / __egdesk_http_proxy / __gmail_proxy / __apps_script_proxy / __knowledge_wiki_proxy / __egdesk_config_proxy / __ai_caller_proxy / __kakao_proxy / __phone_proxy / __instagram_proxy / __financehub_proxy / __blog_proxy / __youtube_proxy / __visitor_auth_proxy / __visitor_google_proxy
|
|
697
741
|
*/
|
|
698
742
|
'/:path*',
|
|
699
743
|
],
|
|
@@ -148,6 +148,8 @@ export const VISITOR_GOOGLE_OAUTH_SCOPES = [
|
|
|
148
148
|
'https://www.googleapis.com/auth/userinfo.profile',
|
|
149
149
|
'https://www.googleapis.com/auth/drive.file',
|
|
150
150
|
'https://www.googleapis.com/auth/spreadsheets',
|
|
151
|
+
'https://www.googleapis.com/auth/documents',
|
|
152
|
+
'https://www.googleapis.com/auth/presentations',
|
|
151
153
|
'openid',
|
|
152
154
|
] as const;
|
|
153
155
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* The minimum EGDesk app version this plugin version is compatible with.
|
|
9
9
|
* The app checks this at setup time and warns on mismatch.
|
|
10
10
|
*/
|
|
11
|
-
export declare const COMPATIBLE_APP_VERSION = "1.4.
|
|
11
|
+
export declare const COMPATIBLE_APP_VERSION = "1.4.48";
|
|
12
12
|
export interface SetupOptions {
|
|
13
13
|
egdeskUrl?: string;
|
|
14
14
|
/** Production EGDesk server URL — written to .env.production.local. Falls back to egdeskUrl. */
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ exports.setupNextApiPlugin = setupNextApiPlugin;
|
|
|
46
46
|
* The minimum EGDesk app version this plugin version is compatible with.
|
|
47
47
|
* The app checks this at setup time and warns on mismatch.
|
|
48
48
|
*/
|
|
49
|
-
exports.COMPATIBLE_APP_VERSION = '1.4.
|
|
49
|
+
exports.COMPATIBLE_APP_VERSION = '1.4.48';
|
|
50
50
|
const fs = __importStar(require("fs"));
|
|
51
51
|
const path = __importStar(require("path"));
|
|
52
52
|
const setup_userdata_1 = require("./setup-userdata");
|
package/dist/setup-userdata.js
CHANGED
|
@@ -215,6 +215,7 @@ prodTables) {
|
|
|
215
215
|
// EGDesk-managed keys — always overwritten with fresh values
|
|
216
216
|
const egdeskKeys = new Set([
|
|
217
217
|
'NEXT_PUBLIC_EGDESK_API_URL',
|
|
218
|
+
'NEXT_PUBLIC_EGDESK_TUNNEL_URL',
|
|
218
219
|
'NEXT_PUBLIC_EGDESK_API_KEY',
|
|
219
220
|
'NEXT_PUBLIC_EGDESK_PROJECT_ID',
|
|
220
221
|
'NEXT_PUBLIC_EGDESK_ENV',
|
|
@@ -249,6 +250,7 @@ prodTables) {
|
|
|
249
250
|
`# Generated at: ${config.generatedAt}`,
|
|
250
251
|
'',
|
|
251
252
|
`NEXT_PUBLIC_EGDESK_API_URL=${apiUrl}`,
|
|
253
|
+
`NEXT_PUBLIC_EGDESK_TUNNEL_URL=${apiUrl}`,
|
|
252
254
|
...(config.egdeskProjectId ? [`NEXT_PUBLIC_EGDESK_PROJECT_ID=${config.egdeskProjectId}`] : []),
|
|
253
255
|
`NEXT_PUBLIC_EGDESK_ENV=${egdeskEnv}`,
|
|
254
256
|
...(config.apiKey ? [`NEXT_PUBLIC_EGDESK_API_KEY=${config.apiKey}`] : []),
|
|
@@ -351,6 +353,7 @@ function generateConfigFile(projectPath, config) {
|
|
|
351
353
|
|
|
352
354
|
export const EGDESK_CONFIG = {
|
|
353
355
|
apiUrl: '${config.baseUrl}',
|
|
356
|
+
tunnelUrl: '${config.prodBaseUrl ?? config.baseUrl}',
|
|
354
357
|
apiKey: ${config.apiKey ? `'${config.apiKey}'` : 'undefined'},
|
|
355
358
|
} as const;
|
|
356
359
|
|