@optimizely/ocp-local-env 1.0.0-beta.4
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/README.md +165 -0
- package/dist/package.json +104 -0
- package/dist/public/bundle.da978bb5437cd82e6d37.js +3 -0
- package/dist/public/bundle.da978bb5437cd82e6d37.js.LICENSE.txt +49 -0
- package/dist/public/bundle.da978bb5437cd82e6d37.js.map +1 -0
- package/dist/public/index.html +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +88 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/executor/FunctionExecutor.d.ts +56 -0
- package/dist/src/executor/FunctionExecutor.js +175 -0
- package/dist/src/executor/FunctionExecutor.js.map +1 -0
- package/dist/src/executor/JobExecutor.d.ts +60 -0
- package/dist/src/executor/JobExecutor.js +203 -0
- package/dist/src/executor/JobExecutor.js.map +1 -0
- package/dist/src/executor/LifecycleExecutor.d.ts +45 -0
- package/dist/src/executor/LifecycleExecutor.js +153 -0
- package/dist/src/executor/LifecycleExecutor.js.map +1 -0
- package/dist/src/executor/watcher.d.ts +63 -0
- package/dist/src/executor/watcher.js +213 -0
- package/dist/src/executor/watcher.js.map +1 -0
- package/dist/src/functions/hello.d.ts +4 -0
- package/dist/src/functions/hello.js +8 -0
- package/dist/src/functions/hello.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/jobs/dailyJob.d.ts +4 -0
- package/dist/src/jobs/dailyJob.js +8 -0
- package/dist/src/jobs/dailyJob.js.map +1 -0
- package/dist/src/local_engine/LocalNotifier.d.ts +10 -0
- package/dist/src/local_engine/LocalNotifier.js +26 -0
- package/dist/src/local_engine/LocalNotifier.js.map +1 -0
- package/dist/src/local_engine/local-engine-child-base.d.ts +79 -0
- package/dist/src/local_engine/local-engine-child-base.js +304 -0
- package/dist/src/local_engine/local-engine-child-base.js.map +1 -0
- package/dist/src/local_engine/local-engine-client.d.ts +80 -0
- package/dist/src/local_engine/local-engine-client.js +333 -0
- package/dist/src/local_engine/local-engine-client.js.map +1 -0
- package/dist/src/local_engine/local-engine-types.d.ts +132 -0
- package/dist/src/local_engine/local-engine-types.js +6 -0
- package/dist/src/local_engine/local-engine-types.js.map +1 -0
- package/dist/src/local_engine/local-engine-unified.d.ts +40 -0
- package/dist/src/local_engine/local-engine-unified.js +406 -0
- package/dist/src/local_engine/local-engine-unified.js.map +1 -0
- package/dist/src/local_engine/local-engine-utils.d.ts +70 -0
- package/dist/src/local_engine/local-engine-utils.js +192 -0
- package/dist/src/local_engine/local-engine-utils.js.map +1 -0
- package/dist/src/local_engine/localSDKConfig.d.ts +30 -0
- package/dist/src/local_engine/localSDKConfig.js +392 -0
- package/dist/src/local_engine/localSDKConfig.js.map +1 -0
- package/dist/src/local_engine/storage/LocalConfigStore.d.ts +56 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js +129 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalJobStore.d.ts +110 -0
- package/dist/src/local_engine/storage/LocalJobStore.js +239 -0
- package/dist/src/local_engine/storage/LocalJobStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalKVStore.d.ts +105 -0
- package/dist/src/local_engine/storage/LocalKVStore.js +1002 -0
- package/dist/src/local_engine/storage/LocalKVStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.d.ts +27 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js +125 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.d.ts +114 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js +319 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.d.ts +161 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js +417 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js.map +1 -0
- package/dist/src/local_engine/storage/NumberSet.d.ts +21 -0
- package/dist/src/local_engine/storage/NumberSet.js +32 -0
- package/dist/src/local_engine/storage/NumberSet.js.map +1 -0
- package/dist/src/local_engine/storage/StringSet.d.ts +21 -0
- package/dist/src/local_engine/storage/StringSet.js +32 -0
- package/dist/src/local_engine/storage/StringSet.js.map +1 -0
- package/dist/src/local_engine/types.d.ts +52 -0
- package/dist/src/local_engine/types.js +6 -0
- package/dist/src/local_engine/types.js.map +1 -0
- package/dist/src/local_engine/utils.d.ts +31 -0
- package/dist/src/local_engine/utils.js +126 -0
- package/dist/src/local_engine/utils.js.map +1 -0
- package/dist/src/logging/LogManager.d.ts +89 -0
- package/dist/src/logging/LogManager.js +237 -0
- package/dist/src/logging/LogManager.js.map +1 -0
- package/dist/src/server/api/functions.d.ts +7 -0
- package/dist/src/server/api/functions.js +80 -0
- package/dist/src/server/api/functions.js.map +1 -0
- package/dist/src/server/api/jobs.d.ts +8 -0
- package/dist/src/server/api/jobs.js +242 -0
- package/dist/src/server/api/jobs.js.map +1 -0
- package/dist/src/server/api/lifecycle.d.ts +6 -0
- package/dist/src/server/api/lifecycle.js +73 -0
- package/dist/src/server/api/lifecycle.js.map +1 -0
- package/dist/src/server/api/settings.d.ts +6 -0
- package/dist/src/server/api/settings.js +117 -0
- package/dist/src/server/api/settings.js.map +1 -0
- package/dist/src/server/api/stores.d.ts +2 -0
- package/dist/src/server/api/stores.js +341 -0
- package/dist/src/server/api/stores.js.map +1 -0
- package/dist/src/server/api/v1.d.ts +10 -0
- package/dist/src/server/api/v1.js +711 -0
- package/dist/src/server/api/v1.js.map +1 -0
- package/dist/src/server/api.d.ts +8 -0
- package/dist/src/server/api.js +154 -0
- package/dist/src/server/api.js.map +1 -0
- package/dist/src/server/app-discovery.d.ts +5 -0
- package/dist/src/server/app-discovery.js +81 -0
- package/dist/src/server/app-discovery.js.map +1 -0
- package/dist/src/server/config.d.ts +21 -0
- package/dist/src/server/config.js +100 -0
- package/dist/src/server/config.js.map +1 -0
- package/dist/src/server/websocket.d.ts +0 -0
- package/dist/src/server/websocket.js +2 -0
- package/dist/src/server/websocket.js.map +1 -0
- package/dist/src/server.d.ts +2 -0
- package/dist/src/server.js +546 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/types/app.d.ts +155 -0
- package/dist/src/types/app.js +24 -0
- package/dist/src/types/app.js.map +1 -0
- package/dist/src/types/kvstore.d.ts +320 -0
- package/dist/src/types/kvstore.js +5 -0
- package/dist/src/types/kvstore.js.map +1 -0
- package/dist/src/ui/components/App.d.ts +6 -0
- package/dist/src/ui/components/App.js +255 -0
- package/dist/src/ui/components/App.js.map +1 -0
- package/dist/src/ui/components/FunctionsView.d.ts +6 -0
- package/dist/src/ui/components/FunctionsView.js +217 -0
- package/dist/src/ui/components/FunctionsView.js.map +1 -0
- package/dist/src/ui/components/JobsView.d.ts +6 -0
- package/dist/src/ui/components/JobsView.js +257 -0
- package/dist/src/ui/components/JobsView.js.map +1 -0
- package/dist/src/ui/components/KVStoreViewer.d.ts +11 -0
- package/dist/src/ui/components/KVStoreViewer.js +168 -0
- package/dist/src/ui/components/KVStoreViewer.js.map +1 -0
- package/dist/src/ui/components/NotificationViewer.d.ts +16 -0
- package/dist/src/ui/components/NotificationViewer.js +69 -0
- package/dist/src/ui/components/NotificationViewer.js.map +1 -0
- package/dist/src/ui/components/SecretsStoreViewer.d.ts +11 -0
- package/dist/src/ui/components/SecretsStoreViewer.js +179 -0
- package/dist/src/ui/components/SecretsStoreViewer.js.map +1 -0
- package/dist/src/ui/components/SettingsStoreViewer.d.ts +24 -0
- package/dist/src/ui/components/SettingsStoreViewer.js +132 -0
- package/dist/src/ui/components/SettingsStoreViewer.js.map +1 -0
- package/dist/src/ui/components/StoreViewer.d.ts +16 -0
- package/dist/src/ui/components/StoreViewer.js +86 -0
- package/dist/src/ui/components/StoreViewer.js.map +1 -0
- package/dist/src/ui/components/TabbedConsole.d.ts +15 -0
- package/dist/src/ui/components/TabbedConsole.js +93 -0
- package/dist/src/ui/components/TabbedConsole.js.map +1 -0
- package/dist/src/ui/components/common/DataTree.d.ts +15 -0
- package/dist/src/ui/components/common/DataTree.js +95 -0
- package/dist/src/ui/components/common/DataTree.js.map +1 -0
- package/dist/src/ui/components/common/EyeIcon.d.ts +11 -0
- package/dist/src/ui/components/common/EyeIcon.js +11 -0
- package/dist/src/ui/components/common/EyeIcon.js.map +1 -0
- package/dist/src/ui/index.d.ts +1 -0
- package/dist/src/ui/index.js +20 -0
- package/dist/src/ui/index.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startServer = void 0;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const http_1 = __importDefault(require("http"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
12
|
+
const open_1 = __importDefault(require("open"));
|
|
13
|
+
const os_1 = __importDefault(require("os"));
|
|
14
|
+
// Import our components
|
|
15
|
+
const watcher_1 = require("./executor/watcher");
|
|
16
|
+
const app_discovery_1 = require("./server/app-discovery");
|
|
17
|
+
const api_1 = require("./server/api");
|
|
18
|
+
const config_1 = require("./server/config");
|
|
19
|
+
const LocalConfigStore_1 = require("./local_engine/storage/LocalConfigStore");
|
|
20
|
+
const LocalSettingsStore_1 = require("./local_engine/storage/LocalSettingsStore");
|
|
21
|
+
const LifecycleExecutor_1 = require("./executor/LifecycleExecutor");
|
|
22
|
+
const FunctionExecutor_1 = require("./executor/FunctionExecutor");
|
|
23
|
+
/**
|
|
24
|
+
* Wait for the dev server to be fully ready
|
|
25
|
+
*/
|
|
26
|
+
async function waitForServerReady(baseUrl) {
|
|
27
|
+
console.log('Waiting for dev server to fully initialize...');
|
|
28
|
+
const maxAttempts = 30; // 30 attempts with 200ms delay = 6 seconds max
|
|
29
|
+
const delayMs = 200;
|
|
30
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
31
|
+
try {
|
|
32
|
+
// Check both health and app endpoints
|
|
33
|
+
const healthUrl = `${baseUrl}/devserver/api/health`;
|
|
34
|
+
const appUrl = `${baseUrl}/devserver/api/app`;
|
|
35
|
+
const [healthResponse, appResponse] = await Promise.all([
|
|
36
|
+
fetch(healthUrl),
|
|
37
|
+
fetch(appUrl)
|
|
38
|
+
]);
|
|
39
|
+
if (healthResponse.ok && appResponse.ok) {
|
|
40
|
+
const healthData = await healthResponse.json();
|
|
41
|
+
const appData = await appResponse.json();
|
|
42
|
+
// Verify health status and app has valid data
|
|
43
|
+
if (healthData.status === 'ok' && appData.name && appData.name !== 'unknown') {
|
|
44
|
+
console.log(`Dev server is ready! (attempt ${attempt}/${maxAttempts})`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// Server not ready yet, continue waiting
|
|
51
|
+
}
|
|
52
|
+
// Wait before next attempt
|
|
53
|
+
await new Promise(resolve => setTimeout(resolve, delayMs));
|
|
54
|
+
}
|
|
55
|
+
console.warn('Dev server may not be fully ready, but proceeding with browser open...');
|
|
56
|
+
}
|
|
57
|
+
async function startServer() {
|
|
58
|
+
// Create Express app
|
|
59
|
+
const app = (0, express_1.default)();
|
|
60
|
+
const server = http_1.default.createServer(app);
|
|
61
|
+
// Parse JSON requests
|
|
62
|
+
app.use(express_1.default.json());
|
|
63
|
+
// Serve static files for dev server
|
|
64
|
+
app.use("/devserver/static", express_1.default.static(path_1.default.join(__dirname, "../public")));
|
|
65
|
+
// Serve static files
|
|
66
|
+
app.use(express_1.default.static(path_1.default.join(__dirname, "../public")));
|
|
67
|
+
// Use the configured app root directory
|
|
68
|
+
const appRootDir = path_1.default.resolve(config_1.config.app.rootDir);
|
|
69
|
+
console.log(`Looking for OCP app in: ${appRootDir}`);
|
|
70
|
+
const ocpApp = await (0, app_discovery_1.discoverApp)(appRootDir);
|
|
71
|
+
if (!ocpApp) {
|
|
72
|
+
console.error(`No OCP app found in ${appRootDir}. Make sure app.yml exists.`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
console.log(`Found OCP app: ${ocpApp.manifest.meta.display_name} v${ocpApp.manifest.meta.version}`);
|
|
76
|
+
// Set up file watcher
|
|
77
|
+
const watcher = new watcher_1.AppWatcher(appRootDir);
|
|
78
|
+
// Set up config store
|
|
79
|
+
const configStore = new LocalConfigStore_1.LocalConfigStore(appRootDir);
|
|
80
|
+
// Set up settings store
|
|
81
|
+
const settingsStore = LocalSettingsStore_1.LocalSettingsStore.getInstance(appRootDir);
|
|
82
|
+
// Set up lifecycle executor
|
|
83
|
+
const lifecycleExecutor = new LifecycleExecutor_1.LifecycleExecutor(appRootDir, ocpApp, settingsStore, configStore);
|
|
84
|
+
// Set up function executor
|
|
85
|
+
const functionExecutor = new FunctionExecutor_1.FunctionExecutor(appRootDir, ocpApp, settingsStore, configStore);
|
|
86
|
+
// Set up API routes with /devserver prefix
|
|
87
|
+
app.use("/devserver/api", (0, api_1.createApiRoutes)(ocpApp, watcher, configStore));
|
|
88
|
+
// Set up v1 API routes at root level
|
|
89
|
+
const { createV1Routes } = require("./server/api/v1");
|
|
90
|
+
app.use("/v1", createV1Routes(ocpApp, watcher, configStore, lifecycleExecutor, settingsStore));
|
|
91
|
+
// Serve assets from the app directory
|
|
92
|
+
app.get("/assets/overview.md", (req, res) => {
|
|
93
|
+
const overviewPath = path_1.default.join(appRootDir, "assets", "directory", "overview.md");
|
|
94
|
+
// Check if the file exists
|
|
95
|
+
if (fs_1.default.existsSync(overviewPath)) {
|
|
96
|
+
// Set content type for markdown
|
|
97
|
+
res.setHeader("Content-Type", "text/markdown; charset=utf-8");
|
|
98
|
+
// Send the file
|
|
99
|
+
res.sendFile(overviewPath);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Return 404 if file doesn't exist
|
|
103
|
+
res.status(404).json({
|
|
104
|
+
error: {
|
|
105
|
+
message: "Overview file not found",
|
|
106
|
+
code: "FILE_NOT_FOUND",
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
app.get("/assets/settings.yml", (req, res) => {
|
|
112
|
+
const settingsPath = path_1.default.join(appRootDir, "forms", "settings.yml");
|
|
113
|
+
// Check if the file exists
|
|
114
|
+
if (fs_1.default.existsSync(settingsPath)) {
|
|
115
|
+
try {
|
|
116
|
+
// Read the file content
|
|
117
|
+
const fileContent = fs_1.default.readFileSync(settingsPath);
|
|
118
|
+
// Set content type for plain text
|
|
119
|
+
res.setHeader("Content-Type", "application/x-yaml");
|
|
120
|
+
// Return just the base64 content
|
|
121
|
+
res.send(fileContent);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
res.status(500).json({
|
|
125
|
+
error: {
|
|
126
|
+
message: "Error reading settings file",
|
|
127
|
+
code: "FILE_READ_ERROR",
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Return 404 if file doesn't exist
|
|
134
|
+
res.status(404).json({
|
|
135
|
+
error: {
|
|
136
|
+
message: "Settings file not found",
|
|
137
|
+
code: "FILE_NOT_FOUND",
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
app.get("/assets/icon.svg", (req, res) => {
|
|
143
|
+
const iconPath = path_1.default.join(appRootDir, "assets", "icon.svg");
|
|
144
|
+
// Check if the file exists
|
|
145
|
+
if (fs_1.default.existsSync(iconPath)) {
|
|
146
|
+
// Set content type for SVG
|
|
147
|
+
res.setHeader("Content-Type", "image/svg+xml");
|
|
148
|
+
// Send the file
|
|
149
|
+
res.sendFile(iconPath);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Return 404 if file doesn't exist
|
|
153
|
+
res.status(404).json({
|
|
154
|
+
error: {
|
|
155
|
+
message: "Icon file not found",
|
|
156
|
+
code: "FILE_NOT_FOUND",
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
app.get("/assets/logo.svg", (req, res) => {
|
|
162
|
+
const logoPath = path_1.default.join(appRootDir, "assets", "logo.svg");
|
|
163
|
+
// Check if the file exists
|
|
164
|
+
if (fs_1.default.existsSync(logoPath)) {
|
|
165
|
+
// Set content type for SVG
|
|
166
|
+
res.setHeader("Content-Type", "image/svg+xml");
|
|
167
|
+
// Send the file
|
|
168
|
+
res.sendFile(logoPath);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
// Return 404 if file doesn't exist
|
|
172
|
+
res.status(404).json({
|
|
173
|
+
error: {
|
|
174
|
+
message: "Logo file not found",
|
|
175
|
+
code: "FILE_NOT_FOUND",
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
// Set up production-like function execution routes
|
|
181
|
+
// Format: /functions/<app_id>/<function_id>/<guid> and /functions/<app_id>/<function_id>/<guid>/*
|
|
182
|
+
const handleFunctionExecution = async (req, res) => {
|
|
183
|
+
const { app_id, function_id, guid } = req.params;
|
|
184
|
+
const payload = req.body;
|
|
185
|
+
console.log(`[FUNCTION] Executing function: ${app_id}/${function_id} (${req.method})`);
|
|
186
|
+
try {
|
|
187
|
+
// Extract path information for InternalRequest
|
|
188
|
+
const remainingPath = req.params[0] || ''; // Everything after GUID
|
|
189
|
+
const fullpath = req.path.replace(/^\/functions/, ''); // Remove /functions prefix
|
|
190
|
+
const path = remainingPath ? `/${remainingPath}` : '/'; // Path for function code
|
|
191
|
+
console.log(`[FUNCTION] Path handling: originalPath=${req.path}, fullpath=${fullpath}, path=${path}`);
|
|
192
|
+
// Validate app_id matches current app
|
|
193
|
+
if (app_id !== ocpApp.manifest.meta.app_id) {
|
|
194
|
+
return res.status(404).json({
|
|
195
|
+
error: {
|
|
196
|
+
message: `App '${app_id}' not found`,
|
|
197
|
+
code: 'APP_NOT_FOUND'
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
// Validate function exists
|
|
202
|
+
const functions = ocpApp.manifest.functions || {};
|
|
203
|
+
if (!functions[function_id]) {
|
|
204
|
+
return res.status(404).json({
|
|
205
|
+
error: {
|
|
206
|
+
message: `Function '${function_id}' not found in app '${app_id}'`,
|
|
207
|
+
code: 'FUNCTION_NOT_FOUND'
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Validate app is installed
|
|
212
|
+
if (!configStore.isInstalled()) {
|
|
213
|
+
return res.status(403).json({
|
|
214
|
+
error: {
|
|
215
|
+
message: 'App must be installed to execute functions',
|
|
216
|
+
code: 'APP_NOT_INSTALLED'
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
// Validate GUID matches stored GUID for this function
|
|
221
|
+
const expectedGuid = configStore.getFunctionGuid(function_id);
|
|
222
|
+
if (guid !== expectedGuid) {
|
|
223
|
+
return res.status(403).json({
|
|
224
|
+
error: {
|
|
225
|
+
message: 'Invalid function GUID',
|
|
226
|
+
code: 'INVALID_GUID'
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
// Prepare function execution request
|
|
231
|
+
const functionRequest = {
|
|
232
|
+
functionId: function_id,
|
|
233
|
+
method: req.method,
|
|
234
|
+
fullpath,
|
|
235
|
+
path,
|
|
236
|
+
params: req.query,
|
|
237
|
+
headers: Object.entries(req.headers),
|
|
238
|
+
body: payload
|
|
239
|
+
};
|
|
240
|
+
// Execute function using FunctionExecutor
|
|
241
|
+
const executionResult = await functionExecutor.executeFunction(functionRequest);
|
|
242
|
+
if (executionResult.success) {
|
|
243
|
+
console.log(`[FUNCTION] Function executed successfully: ${function_id} (${executionResult.executionTime}ms)`);
|
|
244
|
+
// Set response headers if provided
|
|
245
|
+
if (executionResult.headers) {
|
|
246
|
+
for (const [key, value] of executionResult.headers) {
|
|
247
|
+
res.set(key, value);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// Return successful function execution result
|
|
251
|
+
const status = executionResult.status || 200;
|
|
252
|
+
if (executionResult.body !== null && executionResult.body !== undefined) {
|
|
253
|
+
// Function returned a specific response body
|
|
254
|
+
if (Buffer.isBuffer(executionResult.body) || Array.isArray(executionResult.body)) {
|
|
255
|
+
// Binary response
|
|
256
|
+
res.status(status).send(Buffer.from(executionResult.body));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// JSON response
|
|
260
|
+
res.status(status).json(executionResult.body);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
// No specific body, return execution info
|
|
265
|
+
res.status(status).json({
|
|
266
|
+
result: "Function executed successfully",
|
|
267
|
+
logs: executionResult.logs,
|
|
268
|
+
executionTime: executionResult.executionTime
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
console.error(`[FUNCTION] Function execution failed: ${function_id} - ${executionResult.error?.message}`);
|
|
274
|
+
// Return standardized error response for function execution failures
|
|
275
|
+
res.status(500).send("Unexpected error during webhook execution");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
console.error(`Error executing function ${function_id}:`, error);
|
|
280
|
+
res.status(500).send("Unexpected error during webhook execution");
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
// Global function execution handler (no GUID)
|
|
284
|
+
const handleGlobalFunctionExecution = async (req, res) => {
|
|
285
|
+
const { app_id, function_id } = req.params;
|
|
286
|
+
const payload = req.body;
|
|
287
|
+
console.log(`[GLOBAL FUNCTION] Executing global function: ${app_id}/${function_id} (${req.method})`);
|
|
288
|
+
try {
|
|
289
|
+
// Extract path information for InternalRequest
|
|
290
|
+
const remainingPath = req.params[0] || ''; // Everything after function_id
|
|
291
|
+
const fullpath = req.path.replace(/^\/functions/, ''); // Remove /functions prefix
|
|
292
|
+
const path = remainingPath ? `/${remainingPath}` : '/'; // Path for function code
|
|
293
|
+
console.log(`[GLOBAL FUNCTION] Path handling: originalPath=${req.path}, fullpath=${fullpath}, path=${path}`);
|
|
294
|
+
// Validate app_id matches current app
|
|
295
|
+
if (app_id !== ocpApp.manifest.meta.app_id) {
|
|
296
|
+
return res.status(404).json({
|
|
297
|
+
error: {
|
|
298
|
+
message: `App '${app_id}' not found`,
|
|
299
|
+
code: 'APP_NOT_FOUND'
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
// Validate function exists and is global
|
|
304
|
+
const functions = ocpApp.manifest.functions || {};
|
|
305
|
+
if (!functions[function_id]) {
|
|
306
|
+
return res.status(404).json({
|
|
307
|
+
error: {
|
|
308
|
+
message: `Function '${function_id}' not found in app '${app_id}'`,
|
|
309
|
+
code: 'FUNCTION_NOT_FOUND'
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (!functions[function_id].global) {
|
|
314
|
+
return res.status(403).json({
|
|
315
|
+
error: {
|
|
316
|
+
message: `Function '${function_id}' is not a global function`,
|
|
317
|
+
code: 'NOT_GLOBAL_FUNCTION'
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
// Validate app is installed
|
|
322
|
+
if (!configStore.isInstalled()) {
|
|
323
|
+
return res.status(403).json({
|
|
324
|
+
error: {
|
|
325
|
+
message: 'App must be installed to execute functions',
|
|
326
|
+
code: 'APP_NOT_INSTALLED'
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
// Prepare function execution request
|
|
331
|
+
const functionRequest = {
|
|
332
|
+
functionId: function_id,
|
|
333
|
+
method: req.method,
|
|
334
|
+
fullpath,
|
|
335
|
+
path,
|
|
336
|
+
params: req.query,
|
|
337
|
+
headers: Object.entries(req.headers),
|
|
338
|
+
body: payload
|
|
339
|
+
};
|
|
340
|
+
// Execute function using FunctionExecutor
|
|
341
|
+
const executionResult = await functionExecutor.executeFunction(functionRequest);
|
|
342
|
+
if (executionResult.success) {
|
|
343
|
+
console.log(`[GLOBAL FUNCTION] Function executed successfully: ${function_id} (${executionResult.executionTime}ms)`);
|
|
344
|
+
// Set response headers if provided
|
|
345
|
+
if (executionResult.headers) {
|
|
346
|
+
for (const [key, value] of executionResult.headers) {
|
|
347
|
+
res.set(key, value);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
// Return successful function execution result
|
|
351
|
+
const status = executionResult.status || 200;
|
|
352
|
+
if (executionResult.body !== null && executionResult.body !== undefined) {
|
|
353
|
+
// Function returned a specific response body
|
|
354
|
+
if (Buffer.isBuffer(executionResult.body) || Array.isArray(executionResult.body)) {
|
|
355
|
+
// Binary response
|
|
356
|
+
res.status(status).send(Buffer.from(executionResult.body));
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
// JSON response
|
|
360
|
+
res.status(status).json(executionResult.body);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
// No specific body, return execution info
|
|
365
|
+
res.status(status).json({
|
|
366
|
+
result: "Function executed successfully",
|
|
367
|
+
logs: executionResult.logs,
|
|
368
|
+
executionTime: executionResult.executionTime
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
console.error(`[GLOBAL FUNCTION] Function execution failed: ${function_id} - ${executionResult.error?.message}`);
|
|
374
|
+
// Return standardized error response for function execution failures
|
|
375
|
+
res.status(500).send("Unexpected error during webhook execution");
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
console.error(`Error executing global function ${function_id}:`, error);
|
|
380
|
+
res.status(500).send("Unexpected error during webhook execution");
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
// Register function routes for all HTTP methods
|
|
384
|
+
app.get("/functions/:app_id/:function_id/:guid", handleFunctionExecution);
|
|
385
|
+
app.post("/functions/:app_id/:function_id/:guid", handleFunctionExecution);
|
|
386
|
+
app.put("/functions/:app_id/:function_id/:guid", handleFunctionExecution);
|
|
387
|
+
app.delete("/functions/:app_id/:function_id/:guid", handleFunctionExecution);
|
|
388
|
+
app.patch("/functions/:app_id/:function_id/:guid", handleFunctionExecution);
|
|
389
|
+
app.get("/functions/:app_id/:function_id/:guid/*", handleFunctionExecution);
|
|
390
|
+
app.post("/functions/:app_id/:function_id/:guid/*", handleFunctionExecution);
|
|
391
|
+
app.put("/functions/:app_id/:function_id/:guid/*", handleFunctionExecution);
|
|
392
|
+
app.delete("/functions/:app_id/:function_id/:guid/*", handleFunctionExecution);
|
|
393
|
+
app.patch("/functions/:app_id/:function_id/:guid/*", handleFunctionExecution);
|
|
394
|
+
// Register global function routes (no GUID) for all HTTP methods
|
|
395
|
+
app.get("/functions/:app_id/:function_id", handleGlobalFunctionExecution);
|
|
396
|
+
app.post("/functions/:app_id/:function_id", handleGlobalFunctionExecution);
|
|
397
|
+
app.put("/functions/:app_id/:function_id", handleGlobalFunctionExecution);
|
|
398
|
+
app.delete("/functions/:app_id/:function_id", handleGlobalFunctionExecution);
|
|
399
|
+
app.patch("/functions/:app_id/:function_id", handleGlobalFunctionExecution);
|
|
400
|
+
app.get("/functions/:app_id/:function_id/*", handleGlobalFunctionExecution);
|
|
401
|
+
app.post("/functions/:app_id/:function_id/*", handleGlobalFunctionExecution);
|
|
402
|
+
app.put("/functions/:app_id/:function_id/*", handleGlobalFunctionExecution);
|
|
403
|
+
app.delete("/functions/:app_id/:function_id/*", handleGlobalFunctionExecution);
|
|
404
|
+
app.patch("/functions/:app_id/:function_id/*", handleGlobalFunctionExecution);
|
|
405
|
+
// Middleware to modify JavaScript responses containing IFRAME_PARENT_ORIGIN
|
|
406
|
+
app.use(async (req, res, next) => {
|
|
407
|
+
// Skip proxy for /devserver routes, /v1 API routes, /assets routes, /functions routes, and root React app route
|
|
408
|
+
if (req.path.startsWith("/devserver") ||
|
|
409
|
+
req.path.startsWith("/v1") ||
|
|
410
|
+
req.path.startsWith("/assets") ||
|
|
411
|
+
req.path.startsWith("/functions") ||
|
|
412
|
+
req.path === "/") {
|
|
413
|
+
return next();
|
|
414
|
+
}
|
|
415
|
+
// For JavaScript files, we need to potentially modify the content
|
|
416
|
+
const isJSRequest = req.path.endsWith(".js") ||
|
|
417
|
+
req.headers.accept?.includes("javascript") ||
|
|
418
|
+
req.get("content-type")?.includes("javascript");
|
|
419
|
+
if (isJSRequest) {
|
|
420
|
+
try {
|
|
421
|
+
// Fetch from the target directly
|
|
422
|
+
const targetUrl = `https://directory.zaius.com${req.path}${req.url.includes("?") ? req.url.substring(req.url.indexOf("?")) : ""}`;
|
|
423
|
+
const response = await fetch(targetUrl, {
|
|
424
|
+
method: req.method,
|
|
425
|
+
headers: {
|
|
426
|
+
...req.headers,
|
|
427
|
+
host: "directory.zaius.com",
|
|
428
|
+
},
|
|
429
|
+
});
|
|
430
|
+
if (response.ok) {
|
|
431
|
+
const content = await response.text();
|
|
432
|
+
const host = req.get("host") || "localhost:3000";
|
|
433
|
+
const protocol = req.secure ? "https" : "http";
|
|
434
|
+
// Replace the IFRAME_PARENT_ORIGIN logic with our localhost origin
|
|
435
|
+
let modifiedContent = content.replace(/targetOrigin:[a-zA-Z0-9]*,/g, `targetOrigin:'http://localhost:3000',`);
|
|
436
|
+
modifiedContent = modifiedContent.replace(/e\.host=\["api"\]\.concat\(t\)\.join\("\."\)/g, `e.host='localhost:3000'`);
|
|
437
|
+
console.log(content.match(/e\.host=.{0,40}/g));
|
|
438
|
+
console.log(modifiedContent.match(/e\.host=.{0,40}/g));
|
|
439
|
+
// Set response headers
|
|
440
|
+
response.headers.forEach((value, key) => {
|
|
441
|
+
if (key !== "content-length" && key !== "content-encoding") {
|
|
442
|
+
res.set(key, value);
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
res.send(modifiedContent);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
console.error("Error fetching JS file:", error);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// For all other requests, use the normal proxy
|
|
454
|
+
(0, http_proxy_middleware_1.createProxyMiddleware)({
|
|
455
|
+
target: "https://directory.zaius.com",
|
|
456
|
+
changeOrigin: true,
|
|
457
|
+
secure: true,
|
|
458
|
+
})(req, res, next);
|
|
459
|
+
});
|
|
460
|
+
// Serve the React app for /devserver routes and root
|
|
461
|
+
app.get(["/", "/devserver*"], (req, res) => {
|
|
462
|
+
res.sendFile(path_1.default.resolve(__dirname, "../public/index.html"));
|
|
463
|
+
});
|
|
464
|
+
// Start the file watcher
|
|
465
|
+
watcher.start();
|
|
466
|
+
// Start the server
|
|
467
|
+
const port = config_1.config.server.port;
|
|
468
|
+
server.listen(port, async () => {
|
|
469
|
+
const url = `http://localhost:${port}`;
|
|
470
|
+
console.log(`OCP Local Testing Tool running at ${url}`);
|
|
471
|
+
// Auto-open browser unless disabled, and only once per session
|
|
472
|
+
const shouldOpenBrowser = process.env.OCP_LOCAL_OPEN_BROWSER !== "false";
|
|
473
|
+
if (shouldOpenBrowser) {
|
|
474
|
+
// Use a temporary flag file to ensure browser opens only once per session
|
|
475
|
+
const flagFile = path_1.default.join(os_1.default.tmpdir(), `ocp-local-env-browser-opened-${port}`);
|
|
476
|
+
if (!fs_1.default.existsSync(flagFile)) {
|
|
477
|
+
try {
|
|
478
|
+
// Wait for the dev server to be ready before opening browser
|
|
479
|
+
console.log('Waiting for dev server to be ready...');
|
|
480
|
+
await waitForServerReady(url);
|
|
481
|
+
// Create flag file to prevent multiple opens
|
|
482
|
+
fs_1.default.writeFileSync(flagFile, 'opened');
|
|
483
|
+
console.log('Opening browser...');
|
|
484
|
+
await (0, open_1.default)(url);
|
|
485
|
+
// Clean up flag file on process exit
|
|
486
|
+
process.on('exit', () => {
|
|
487
|
+
try {
|
|
488
|
+
if (fs_1.default.existsSync(flagFile)) {
|
|
489
|
+
fs_1.default.unlinkSync(flagFile);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
catch (e) {
|
|
493
|
+
// Ignore cleanup errors
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
console.warn('Failed to open browser automatically:', error instanceof Error ? error.message : String(error));
|
|
499
|
+
console.log(`Please open your browser manually and go to: ${url}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
console.log(`Open your browser and go to: ${url}`);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
// Handle shutdown
|
|
508
|
+
const shutdown = async () => {
|
|
509
|
+
console.log("Shutting down...");
|
|
510
|
+
// Stop watcher
|
|
511
|
+
watcher.stop();
|
|
512
|
+
// Cleanup IPC connections
|
|
513
|
+
try {
|
|
514
|
+
await lifecycleExecutor.cleanup();
|
|
515
|
+
await functionExecutor.cleanup();
|
|
516
|
+
console.log("IPC connections cleaned up");
|
|
517
|
+
}
|
|
518
|
+
catch (e) {
|
|
519
|
+
console.warn("Error during IPC cleanup:", e);
|
|
520
|
+
}
|
|
521
|
+
// Close server
|
|
522
|
+
server.close();
|
|
523
|
+
// Clean up browser flag file
|
|
524
|
+
try {
|
|
525
|
+
const flagFile = path_1.default.join(os_1.default.tmpdir(), `ocp-local-env-browser-opened-${port}`);
|
|
526
|
+
if (fs_1.default.existsSync(flagFile)) {
|
|
527
|
+
fs_1.default.unlinkSync(flagFile);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
catch (e) {
|
|
531
|
+
// Ignore cleanup errors
|
|
532
|
+
}
|
|
533
|
+
process.exit(0);
|
|
534
|
+
};
|
|
535
|
+
process.on("SIGINT", shutdown);
|
|
536
|
+
process.on("SIGTERM", shutdown);
|
|
537
|
+
}
|
|
538
|
+
exports.startServer = startServer;
|
|
539
|
+
// Start the server when this file is executed directly
|
|
540
|
+
if (require.main === module) {
|
|
541
|
+
startServer().catch((error) => {
|
|
542
|
+
console.error('Failed to start server:', error);
|
|
543
|
+
process.exit(1);
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAqD;AACrD,gDAAwB;AACxB,gDAAwB;AACxB,4CAAoB;AACpB,iEAA8D;AAC9D,gDAAwB;AACxB,4CAAoB;AAEpB,wBAAwB;AACxB,gDAAgD;AAChD,0DAAqD;AACrD,sCAA+C;AAC/C,4CAAyC;AACzC,8EAA2E;AAC3E,kFAA+E;AAC/E,oEAAiE;AACjE,kEAA+D;AAE/D;;GAEG;AACH,KAAK,UAAU,kBAAkB,CAAC,OAAe;IAC/C,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAE7D,MAAM,WAAW,GAAG,EAAE,CAAC,CAAC,+CAA+C;IACvE,MAAM,OAAO,GAAG,GAAG,CAAC;IAEpB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE;QACvD,IAAI;YACF,sCAAsC;YACtC,MAAM,SAAS,GAAG,GAAG,OAAO,uBAAuB,CAAC;YACpD,MAAM,MAAM,GAAG,GAAG,OAAO,oBAAoB,CAAC;YAE9C,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACtD,KAAK,CAAC,SAAS,CAAC;gBAChB,KAAK,CAAC,MAAM,CAAC;aACd,CAAC,CAAC;YAEH,IAAI,cAAc,CAAC,EA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