@optimizely/ocp-local-env 1.0.0-beta.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/README.md +51 -0
- package/dist/package.json +112 -0
- package/dist/public/bundle.82dc5d29fffb9f205051.js +3 -0
- package/dist/public/bundle.82dc5d29fffb9f205051.js.LICENSE.txt +92 -0
- package/dist/public/bundle.82dc5d29fffb9f205051.js.map +1 -0
- package/dist/public/index.html +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +115 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/executor/DestinationExecutor.d.ts +19 -0
- package/dist/src/executor/DestinationExecutor.js +72 -0
- package/dist/src/executor/DestinationExecutor.js.map +1 -0
- package/dist/src/executor/FunctionExecutor.d.ts +67 -0
- package/dist/src/executor/FunctionExecutor.js +189 -0
- package/dist/src/executor/FunctionExecutor.js.map +1 -0
- package/dist/src/executor/JobExecutor.d.ts +79 -0
- package/dist/src/executor/JobExecutor.js +215 -0
- package/dist/src/executor/JobExecutor.js.map +1 -0
- package/dist/src/executor/LifecycleExecutor.d.ts +64 -0
- package/dist/src/executor/LifecycleExecutor.js +167 -0
- package/dist/src/executor/LifecycleExecutor.js.map +1 -0
- package/dist/src/executor/SourceExecutor.d.ts +32 -0
- package/dist/src/executor/SourceExecutor.js +163 -0
- package/dist/src/executor/SourceExecutor.js.map +1 -0
- package/dist/src/executor/watcher.d.ts +62 -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/LocalFunctionApi.d.ts +17 -0
- package/dist/src/local_engine/LocalFunctionApi.js +54 -0
- package/dist/src/local_engine/LocalFunctionApi.js.map +1 -0
- package/dist/src/local_engine/LocalJobApi.d.ts +67 -0
- package/dist/src/local_engine/LocalJobApi.js +205 -0
- package/dist/src/local_engine/LocalJobApi.js.map +1 -0
- package/dist/src/local_engine/LocalNotifier.d.ts +9 -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 +110 -0
- package/dist/src/local_engine/local-engine-child-base.js +607 -0
- package/dist/src/local_engine/local-engine-child-base.js.map +1 -0
- package/dist/src/local_engine/local-engine-client.d.ts +161 -0
- package/dist/src/local_engine/local-engine-client.js +888 -0
- package/dist/src/local_engine/local-engine-client.js.map +1 -0
- package/dist/src/local_engine/local-engine-types.d.ts +245 -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 +71 -0
- package/dist/src/local_engine/local-engine-unified.js +723 -0
- package/dist/src/local_engine/local-engine-unified.js.map +1 -0
- package/dist/src/local_engine/local-engine-utils.d.ts +68 -0
- package/dist/src/local_engine/local-engine-utils.js +219 -0
- package/dist/src/local_engine/local-engine-utils.js.map +1 -0
- package/dist/src/local_engine/localSDKConfig.d.ts +40 -0
- package/dist/src/local_engine/localSDKConfig.js +247 -0
- package/dist/src/local_engine/localSDKConfig.js.map +1 -0
- package/dist/src/local_engine/storage/BaseKVStoreWrapper.d.ts +37 -0
- package/dist/src/local_engine/storage/BaseKVStoreWrapper.js +110 -0
- package/dist/src/local_engine/storage/BaseKVStoreWrapper.js.map +1 -0
- package/dist/src/local_engine/storage/LocalConfigStore.d.ts +74 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js +178 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalJobStore.d.ts +111 -0
- package/dist/src/local_engine/storage/LocalJobStore.js +249 -0
- package/dist/src/local_engine/storage/LocalJobStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalKVStore.d.ts +106 -0
- package/dist/src/local_engine/storage/LocalKVStore.js +1061 -0
- package/dist/src/local_engine/storage/LocalKVStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.d.ts +28 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js +149 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.d.ts +115 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js +350 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSecretsStoreWrapper.d.ts +19 -0
- package/dist/src/local_engine/storage/LocalSecretsStoreWrapper.js +52 -0
- package/dist/src/local_engine/storage/LocalSecretsStoreWrapper.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.d.ts +168 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js +509 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js.map +1 -0
- package/dist/src/local_engine/storage/LocalSettingsStoreWrapper.d.ts +15 -0
- package/dist/src/local_engine/storage/LocalSettingsStoreWrapper.js +28 -0
- package/dist/src/local_engine/storage/LocalSettingsStoreWrapper.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/SourceDataStore.d.ts +23 -0
- package/dist/src/local_engine/storage/SourceDataStore.js +83 -0
- package/dist/src/local_engine/storage/SourceDataStore.js.map +1 -0
- package/dist/src/local_engine/storage/SourceJobExecutionStore.d.ts +25 -0
- package/dist/src/local_engine/storage/SourceJobExecutionStore.js +61 -0
- package/dist/src/local_engine/storage/SourceJobExecutionStore.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 +53 -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 +33 -0
- package/dist/src/local_engine/utils.js +143 -0
- package/dist/src/local_engine/utils.js.map +1 -0
- package/dist/src/logging/LogManager.d.ts +246 -0
- package/dist/src/logging/LogManager.js +343 -0
- package/dist/src/logging/LogManager.js.map +1 -0
- package/dist/src/server/api/destinations.d.ts +7 -0
- package/dist/src/server/api/destinations.js +170 -0
- package/dist/src/server/api/destinations.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 +10 -0
- package/dist/src/server/api/jobs.js +244 -0
- package/dist/src/server/api/jobs.js.map +1 -0
- package/dist/src/server/api/settings.d.ts +6 -0
- package/dist/src/server/api/settings.js +116 -0
- package/dist/src/server/api/settings.js.map +1 -0
- package/dist/src/server/api/sources.d.ts +7 -0
- package/dist/src/server/api/sources.js +382 -0
- package/dist/src/server/api/sources.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 +718 -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 +217 -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 +113 -0
- package/dist/src/server/app-discovery.js.map +1 -0
- package/dist/src/server/config.d.ts +26 -0
- package/dist/src/server/config.js +112 -0
- package/dist/src/server/config.js.map +1 -0
- package/dist/src/server/mockDataGenerator.d.ts +1 -0
- package/dist/src/server/mockDataGenerator.js +154 -0
- package/dist/src/server/mockDataGenerator.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 +735 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/types/app.d.ts +154 -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 +432 -0
- package/dist/src/ui/components/App.js.map +1 -0
- package/dist/src/ui/components/DestinationBatchEditor.d.ts +7 -0
- package/dist/src/ui/components/DestinationBatchEditor.js +160 -0
- package/dist/src/ui/components/DestinationBatchEditor.js.map +1 -0
- package/dist/src/ui/components/DestinationSchemaViewer.d.ts +7 -0
- package/dist/src/ui/components/DestinationSchemaViewer.js +61 -0
- package/dist/src/ui/components/DestinationSchemaViewer.js.map +1 -0
- package/dist/src/ui/components/DestinationsView.d.ts +14 -0
- package/dist/src/ui/components/DestinationsView.js +68 -0
- package/dist/src/ui/components/DestinationsView.js.map +1 -0
- package/dist/src/ui/components/FunctionsView.d.ts +13 -0
- package/dist/src/ui/components/FunctionsView.js +288 -0
- package/dist/src/ui/components/FunctionsView.js.map +1 -0
- package/dist/src/ui/components/JobsView.d.ts +13 -0
- package/dist/src/ui/components/JobsView.js +320 -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/MetadataModal.d.ts +14 -0
- package/dist/src/ui/components/MetadataModal.js +28 -0
- package/dist/src/ui/components/MetadataModal.js.map +1 -0
- package/dist/src/ui/components/MetadataModal.test.d.ts +1 -0
- package/dist/src/ui/components/MetadataModal.test.js +143 -0
- package/dist/src/ui/components/MetadataModal.test.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/SourceDataViewer.d.ts +8 -0
- package/dist/src/ui/components/SourceDataViewer.js +84 -0
- package/dist/src/ui/components/SourceDataViewer.js.map +1 -0
- package/dist/src/ui/components/SourceJobsSection.d.ts +8 -0
- package/dist/src/ui/components/SourceJobsSection.js +99 -0
- package/dist/src/ui/components/SourceJobsSection.js.map +1 -0
- package/dist/src/ui/components/SourceLifecycleSection.d.ts +7 -0
- package/dist/src/ui/components/SourceLifecycleSection.js +58 -0
- package/dist/src/ui/components/SourceLifecycleSection.js.map +1 -0
- package/dist/src/ui/components/SourceSchemaViewer.d.ts +7 -0
- package/dist/src/ui/components/SourceSchemaViewer.js +65 -0
- package/dist/src/ui/components/SourceSchemaViewer.js.map +1 -0
- package/dist/src/ui/components/SourceWebhookEditor.d.ts +8 -0
- package/dist/src/ui/components/SourceWebhookEditor.js +181 -0
- package/dist/src/ui/components/SourceWebhookEditor.js.map +1 -0
- package/dist/src/ui/components/SourcesView.d.ts +14 -0
- package/dist/src/ui/components/SourcesView.js +74 -0
- package/dist/src/ui/components/SourcesView.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 +17 -0
- package/dist/src/ui/components/TabbedConsole.js +163 -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/hooks/useEntityNavigation.d.ts +72 -0
- package/dist/src/ui/hooks/useEntityNavigation.js +150 -0
- package/dist/src/ui/hooks/useEntityNavigation.js.map +1 -0
- package/dist/src/ui/hooks/useQueryParams.d.ts +6 -0
- package/dist/src/ui/hooks/useQueryParams.js +39 -0
- package/dist/src/ui/hooks/useQueryParams.js.map +1 -0
- package/dist/src/ui/index.d.ts +1 -0
- package/dist/src/ui/index.js +23 -0
- package/dist/src/ui/index.js.map +1 -0
- package/dist/src/ui/store/formStateSlice.d.ts +54 -0
- package/dist/src/ui/store/formStateSlice.js +94 -0
- package/dist/src/ui/store/formStateSlice.js.map +1 -0
- package/dist/src/ui/store/hooks.d.ts +6 -0
- package/dist/src/ui/store/hooks.js +8 -0
- package/dist/src/ui/store/hooks.js.map +1 -0
- package/dist/src/ui/store/index.d.ts +11 -0
- package/dist/src/ui/store/index.js +107 -0
- package/dist/src/ui/store/index.js.map +1 -0
- package/dist/src/utils/functionEndpoints.d.ts +24 -0
- package/dist/src/utils/functionEndpoints.js +45 -0
- package/dist/src/utils/functionEndpoints.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
/**
|
|
3
|
+
* Watches for file changes in an OCP app and triggers rebuilds
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppWatcher extends EventEmitter {
|
|
6
|
+
private watcher;
|
|
7
|
+
private buildInProgress;
|
|
8
|
+
private appDir;
|
|
9
|
+
private buildCommand;
|
|
10
|
+
private lastBuildSuccess;
|
|
11
|
+
private lastBuildTimestamp;
|
|
12
|
+
private lastBuildError;
|
|
13
|
+
private buildLogs;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new file watcher for the specified app directory
|
|
16
|
+
*/
|
|
17
|
+
constructor(appDir: string);
|
|
18
|
+
/**
|
|
19
|
+
* Start watching for file changes
|
|
20
|
+
*/
|
|
21
|
+
start(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Stop watching for file changes
|
|
24
|
+
*/
|
|
25
|
+
stop(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Handle a file change event
|
|
28
|
+
*/
|
|
29
|
+
private handleFileChange;
|
|
30
|
+
/**
|
|
31
|
+
* Build the app using the configured build command
|
|
32
|
+
*/
|
|
33
|
+
private buildApp;
|
|
34
|
+
/**
|
|
35
|
+
* Trigger a manual build of the app
|
|
36
|
+
*/
|
|
37
|
+
triggerBuild(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns whether a build is currently in progress
|
|
40
|
+
*/
|
|
41
|
+
isBuildInProgress(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Returns whether the last build was successful
|
|
44
|
+
*/
|
|
45
|
+
getLastBuildSuccess(): boolean | null;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the timestamp of the last build
|
|
48
|
+
*/
|
|
49
|
+
getLastBuildTimestamp(): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the error message from the last failed build
|
|
52
|
+
*/
|
|
53
|
+
getLastBuildError(): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the most recent build logs
|
|
56
|
+
*/
|
|
57
|
+
getBuildLogs(limit?: number): Array<{
|
|
58
|
+
type: 'stdout' | 'stderr';
|
|
59
|
+
data: string;
|
|
60
|
+
timestamp: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
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.AppWatcher = void 0;
|
|
7
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const events_1 = require("events");
|
|
11
|
+
const config_1 = require("../server/config");
|
|
12
|
+
const LogManager_1 = require("../logging/LogManager");
|
|
13
|
+
/**
|
|
14
|
+
* Watches for file changes in an OCP app and triggers rebuilds
|
|
15
|
+
*/
|
|
16
|
+
class AppWatcher extends events_1.EventEmitter {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new file watcher for the specified app directory
|
|
19
|
+
*/
|
|
20
|
+
constructor(appDir) {
|
|
21
|
+
super();
|
|
22
|
+
this.watcher = null;
|
|
23
|
+
this.buildInProgress = false;
|
|
24
|
+
this.lastBuildSuccess = null;
|
|
25
|
+
this.lastBuildTimestamp = null;
|
|
26
|
+
this.lastBuildError = null;
|
|
27
|
+
this.buildLogs = [];
|
|
28
|
+
this.appDir = appDir;
|
|
29
|
+
this.buildCommand = config_1.config.app.buildCommand;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Start watching for file changes
|
|
33
|
+
*/
|
|
34
|
+
start() {
|
|
35
|
+
const watchPaths = config_1.config.app.watchPaths.map(pattern => path_1.default.join(this.appDir, pattern));
|
|
36
|
+
this.watcher = chokidar_1.default.watch(watchPaths, {
|
|
37
|
+
ignored: config_1.config.app.ignorePaths,
|
|
38
|
+
persistent: true,
|
|
39
|
+
ignoreInitial: true
|
|
40
|
+
});
|
|
41
|
+
this.watcher.on('change', (filePath) => {
|
|
42
|
+
this.handleFileChange(filePath);
|
|
43
|
+
});
|
|
44
|
+
this.watcher.on('add', (filePath) => {
|
|
45
|
+
this.handleFileChange(filePath);
|
|
46
|
+
});
|
|
47
|
+
this.watcher.on('unlink', (filePath) => {
|
|
48
|
+
this.handleFileChange(filePath);
|
|
49
|
+
});
|
|
50
|
+
console.log(`Watching for file changes in ${this.appDir}`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Stop watching for file changes
|
|
54
|
+
*/
|
|
55
|
+
stop() {
|
|
56
|
+
if (this.watcher) {
|
|
57
|
+
this.watcher.close();
|
|
58
|
+
this.watcher = null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Handle a file change event
|
|
63
|
+
*/
|
|
64
|
+
async handleFileChange(filePath) {
|
|
65
|
+
if (this.buildInProgress) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Normalize path for logging
|
|
69
|
+
const relativePath = path_1.default.relative(this.appDir, filePath);
|
|
70
|
+
console.log(`File changed: ${relativePath}`);
|
|
71
|
+
this.buildInProgress = true;
|
|
72
|
+
// Use super.emit() to satisfy TypeScript
|
|
73
|
+
super.emit('buildStart', { file: relativePath });
|
|
74
|
+
const logManager = LogManager_1.LogManager.getInstance();
|
|
75
|
+
logManager.logBuildEvent('started', { file: relativePath });
|
|
76
|
+
try {
|
|
77
|
+
await this.buildApp();
|
|
78
|
+
this.lastBuildSuccess = true;
|
|
79
|
+
this.lastBuildTimestamp = new Date().toISOString();
|
|
80
|
+
this.lastBuildError = null;
|
|
81
|
+
logManager.logBuildEvent('success');
|
|
82
|
+
super.emit('buildSuccess');
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
this.lastBuildSuccess = false;
|
|
86
|
+
this.lastBuildTimestamp = new Date().toISOString();
|
|
87
|
+
this.lastBuildError = error instanceof Error ? error.message : String(error);
|
|
88
|
+
logManager.logBuildEvent('error', {
|
|
89
|
+
error: this.lastBuildError,
|
|
90
|
+
file: relativePath
|
|
91
|
+
});
|
|
92
|
+
super.emit('buildError', error);
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
this.buildInProgress = false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Build the app using the configured build command
|
|
100
|
+
*/
|
|
101
|
+
buildApp() {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
console.log(`Building app with command: ${this.buildCommand}`);
|
|
104
|
+
// Split the command into parts for spawn
|
|
105
|
+
const [command, ...args] = this.buildCommand.split(' ');
|
|
106
|
+
const buildProcess = (0, child_process_1.spawn)(command, args, {
|
|
107
|
+
cwd: this.appDir,
|
|
108
|
+
stdio: 'pipe',
|
|
109
|
+
shell: true
|
|
110
|
+
});
|
|
111
|
+
let stdout = '';
|
|
112
|
+
let stderr = '';
|
|
113
|
+
const logManager = LogManager_1.LogManager.getInstance();
|
|
114
|
+
buildProcess.stdout.on('data', (data) => {
|
|
115
|
+
const output = data.toString();
|
|
116
|
+
stdout += output;
|
|
117
|
+
const logEntry = {
|
|
118
|
+
type: 'stdout',
|
|
119
|
+
data: output,
|
|
120
|
+
timestamp: new Date().toISOString()
|
|
121
|
+
};
|
|
122
|
+
this.buildLogs.push(logEntry);
|
|
123
|
+
super.emit('buildLog', logEntry);
|
|
124
|
+
// Log to centralized logging system
|
|
125
|
+
logManager.logBuildOutput(output.trim());
|
|
126
|
+
});
|
|
127
|
+
buildProcess.stderr.on('data', (data) => {
|
|
128
|
+
const output = data.toString();
|
|
129
|
+
stderr += output;
|
|
130
|
+
const logEntry = {
|
|
131
|
+
type: 'stderr',
|
|
132
|
+
data: output,
|
|
133
|
+
timestamp: new Date().toISOString()
|
|
134
|
+
};
|
|
135
|
+
this.buildLogs.push(logEntry);
|
|
136
|
+
super.emit('buildLog', logEntry);
|
|
137
|
+
// Log to centralized logging system
|
|
138
|
+
logManager.logBuildOutput(output.trim(), true);
|
|
139
|
+
});
|
|
140
|
+
buildProcess.on('close', (code) => {
|
|
141
|
+
if (code === 0) {
|
|
142
|
+
console.log('Build completed successfully');
|
|
143
|
+
resolve();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const error = new Error(`Build failed with exit code ${code}.\n${stderr}`);
|
|
147
|
+
console.error(error);
|
|
148
|
+
reject(error);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Trigger a manual build of the app
|
|
155
|
+
*/
|
|
156
|
+
async triggerBuild() {
|
|
157
|
+
if (this.buildInProgress) {
|
|
158
|
+
throw new Error('Build already in progress');
|
|
159
|
+
}
|
|
160
|
+
this.buildInProgress = true;
|
|
161
|
+
super.emit('buildStart', { file: null });
|
|
162
|
+
try {
|
|
163
|
+
await this.buildApp();
|
|
164
|
+
this.lastBuildSuccess = true;
|
|
165
|
+
this.lastBuildTimestamp = new Date().toISOString();
|
|
166
|
+
this.lastBuildError = null;
|
|
167
|
+
super.emit('buildSuccess');
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
this.lastBuildSuccess = false;
|
|
171
|
+
this.lastBuildTimestamp = new Date().toISOString();
|
|
172
|
+
this.lastBuildError = error instanceof Error ? error.message : String(error);
|
|
173
|
+
super.emit('buildError', error);
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
this.buildInProgress = false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Returns whether a build is currently in progress
|
|
182
|
+
*/
|
|
183
|
+
isBuildInProgress() {
|
|
184
|
+
return this.buildInProgress;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Returns whether the last build was successful
|
|
188
|
+
*/
|
|
189
|
+
getLastBuildSuccess() {
|
|
190
|
+
return this.lastBuildSuccess;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Returns the timestamp of the last build
|
|
194
|
+
*/
|
|
195
|
+
getLastBuildTimestamp() {
|
|
196
|
+
return this.lastBuildTimestamp;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Returns the error message from the last failed build
|
|
200
|
+
*/
|
|
201
|
+
getLastBuildError() {
|
|
202
|
+
return this.lastBuildError;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Returns the most recent build logs
|
|
206
|
+
*/
|
|
207
|
+
getBuildLogs(limit = 100) {
|
|
208
|
+
// Return the most recent logs up to the limit
|
|
209
|
+
return this.buildLogs.slice(-limit);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.AppWatcher = AppWatcher;
|
|
213
|
+
//# sourceMappingURL=watcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watcher.js","sourceRoot":"","sources":["../../../src/executor/watcher.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,iDAAsC;AACtC,gDAAwB;AACxB,mCAAsC;AACtC,6CAA0C;AAC1C,sDAAmD;AAEnD;;GAEG;AACH,MAAa,UAAW,SAAQ,qBAAY;IAU1C;;OAEG;IACH,YAAY,MAAc;QACxB,KAAK,EAAE,CAAC;QAbF,YAAO,GAA8B,IAAI,CAAC;QAC1C,oBAAe,GAAG,KAAK,CAAC;QAGxB,qBAAgB,GAAmB,IAAI,CAAC;QACxC,uBAAkB,GAAkB,IAAI,CAAC;QACzC,mBAAc,GAAkB,IAAI,CAAC;QACrC,cAAS,GAAwE,EAAE,CAAC;QAO1F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,eAAM,CAAC,GAAG,CAAC,YAAY,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK;QACH,MAAM,UAAU,GAAG,eAAM,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CACrD,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAChC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC,KAAK,C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,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC;IAC3C,OAAO;QACL,OAAO,EAAE,UAAU,IAAI,GAAG;KAC3B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { startServer } from './server';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startServer = void 0;
|
|
4
|
+
// Export all components for external use
|
|
5
|
+
var server_1 = require("./server");
|
|
6
|
+
Object.defineProperty(exports, "startServer", { enumerable: true, get: function () { return server_1.startServer; } });
|
|
7
|
+
// CLI is the main entry point when installed globally
|
|
8
|
+
// It's not exported as it's meant to be run directly
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,mCAAuC;AAA9B,qGAAA,WAAW,OAAA;AAEpB,sDAAsD;AACtD,qDAAqD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dailyJob.js","sourceRoot":"","sources":["../../../src/jobs/dailyJob.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG,KAAK,WAAU,OAAO;IACrC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,OAAO;QACL,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local implementation of FunctionApi that returns URLs pointing to the local test server
|
|
3
|
+
*/
|
|
4
|
+
export declare class LocalFunctionApi {
|
|
5
|
+
private appPath;
|
|
6
|
+
private baseUrl;
|
|
7
|
+
private appManifest;
|
|
8
|
+
private configStore;
|
|
9
|
+
constructor(appPath: string, appManifest: any, configStore: any, baseUrl?: string);
|
|
10
|
+
getEndpoints(installId?: number): Promise<{
|
|
11
|
+
[name: string]: string;
|
|
12
|
+
}>;
|
|
13
|
+
getGlobalEndpoints(): Promise<{
|
|
14
|
+
[name: string]: string;
|
|
15
|
+
}>;
|
|
16
|
+
getAuthorizationGrantUrl(): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalFunctionApi = void 0;
|
|
4
|
+
const LogManager_1 = require("../logging/LogManager");
|
|
5
|
+
const functionEndpoints_1 = require("../utils/functionEndpoints");
|
|
6
|
+
const logManager = LogManager_1.LogManager.getInstance();
|
|
7
|
+
/**
|
|
8
|
+
* Local implementation of FunctionApi that returns URLs pointing to the local test server
|
|
9
|
+
*/
|
|
10
|
+
class LocalFunctionApi {
|
|
11
|
+
constructor(appPath, appManifest, configStore, baseUrl = 'http://localhost:3000') {
|
|
12
|
+
this.appPath = appPath;
|
|
13
|
+
this.baseUrl = baseUrl;
|
|
14
|
+
this.appManifest = appManifest;
|
|
15
|
+
this.configStore = configStore;
|
|
16
|
+
}
|
|
17
|
+
async getEndpoints(installId) {
|
|
18
|
+
const actualInstallId = installId || 1;
|
|
19
|
+
const endpoints = (0, functionEndpoints_1.buildNonGlobalFunctionEndpoints)({
|
|
20
|
+
baseUrl: this.baseUrl,
|
|
21
|
+
appId: this.appManifest.meta.app_id,
|
|
22
|
+
functions: this.appManifest.functions || {},
|
|
23
|
+
getGuid: (functionId) => this.configStore.getFunctionGuid(functionId),
|
|
24
|
+
});
|
|
25
|
+
logManager.debug(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, `Generated non-global endpoints for install ${actualInstallId}: ${JSON.stringify(endpoints)}`, {
|
|
26
|
+
id: 'sdkconfig',
|
|
27
|
+
operation: 'configure'
|
|
28
|
+
});
|
|
29
|
+
return endpoints;
|
|
30
|
+
}
|
|
31
|
+
async getGlobalEndpoints() {
|
|
32
|
+
const endpoints = (0, functionEndpoints_1.buildGlobalFunctionEndpoints)({
|
|
33
|
+
baseUrl: this.baseUrl,
|
|
34
|
+
appId: this.appManifest.meta.app_id,
|
|
35
|
+
functions: this.appManifest.functions || {},
|
|
36
|
+
getGuid: (functionId) => this.configStore.getFunctionGuid(functionId),
|
|
37
|
+
});
|
|
38
|
+
logManager.debug(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, `Generated global endpoints: ${JSON.stringify(endpoints)}`, {
|
|
39
|
+
id: 'sdkconfig',
|
|
40
|
+
operation: 'configure'
|
|
41
|
+
});
|
|
42
|
+
return endpoints;
|
|
43
|
+
}
|
|
44
|
+
getAuthorizationGrantUrl() {
|
|
45
|
+
const grantUrl = `${this.baseUrl}/auth/grant`;
|
|
46
|
+
logManager.debug(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, `Generated authorization grant URL: ${grantUrl}`, {
|
|
47
|
+
id: 'sdkconfig',
|
|
48
|
+
operation: 'configure'
|
|
49
|
+
});
|
|
50
|
+
return grantUrl;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.LocalFunctionApi = LocalFunctionApi;
|
|
54
|
+
//# sourceMappingURL=LocalFunctionApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalFunctionApi.js","sourceRoot":"","sources":["../../../src/local_engine/LocalFunctionApi.ts"],"names":[],"mappings":";;;AAAA,sDAA2E;AAC3E,kEAA2G;AAE3G,MAAM,UAAU,GAAG,uBAAU,CAAC,WAAW,EAAE,CAAC;AAE5C;;GAEG;AACH,MAAa,gBAAgB;IAM3B,YAAY,OAAe,EAAE,WAAgB,EAAE,WAAgB,EAAE,UAAkB,uBAAuB;QACxG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAA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AS,EAAE,WAAW;SACvB,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,wBAAwB;QACtB,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,OAAO,aAAa,CAAC;QAC9C,UAAU,CAAC,KAAK,CAAC,sBAAS,CAAC,MAAM,EAAE,wBAAW,CAAC,SAAS,EAAE,sCAAsC,QAAQ,EAAE,EAAE;YAC1G,EAAE,EAAE,WAAW;YACf,SAAS,EAAE,WAAW;SACvB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AApDD,4CAoDC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local type definitions matching @zaiusinc/app-sdk interfaces
|
|
3
|
+
* These are defined locally to avoid compile-time dependency on app-sdk
|
|
4
|
+
*/
|
|
5
|
+
export type ValueHash = Record<string, any>;
|
|
6
|
+
export declare enum JobRunStatus {
|
|
7
|
+
Pending = "pending",
|
|
8
|
+
Running = "running",
|
|
9
|
+
Complete = "complete",
|
|
10
|
+
Error = "error",
|
|
11
|
+
Terminated = "terminated"
|
|
12
|
+
}
|
|
13
|
+
export interface JobDetail {
|
|
14
|
+
jobId: string;
|
|
15
|
+
status: JobRunStatus;
|
|
16
|
+
definition: {
|
|
17
|
+
name: string;
|
|
18
|
+
parameters: ValueHash;
|
|
19
|
+
};
|
|
20
|
+
errors: string;
|
|
21
|
+
startedAt?: string;
|
|
22
|
+
completedAt?: string;
|
|
23
|
+
terminatedAt?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class JobApiError extends Error {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class JobNotFoundError extends Error {
|
|
29
|
+
constructor(message: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Local implementation of JobApi for ocp-local-env
|
|
33
|
+
* Sends IPC messages to parent process to trigger jobs
|
|
34
|
+
*
|
|
35
|
+
* NOTE: This runs in the child process (app context), not the parent process.
|
|
36
|
+
* It communicates with the parent via IPC to request job execution.
|
|
37
|
+
*/
|
|
38
|
+
export declare class LocalJobApi {
|
|
39
|
+
/**
|
|
40
|
+
* Trigger a job execution via IPC
|
|
41
|
+
* @throws {JobNotFoundError} if job not found in manifest
|
|
42
|
+
* @throws {JobApiError} if job is already running or other failure
|
|
43
|
+
*/
|
|
44
|
+
trigger(jobName: string, parameters: ValueHash): Promise<JobDetail>;
|
|
45
|
+
/**
|
|
46
|
+
* Get details of a specific job execution via IPC
|
|
47
|
+
* @throws {JobNotFoundError} if execution not found
|
|
48
|
+
*/
|
|
49
|
+
getDetail(executionId: string): Promise<JobDetail>;
|
|
50
|
+
/**
|
|
51
|
+
* Get status of a specific job execution via IPC
|
|
52
|
+
* @throws {JobNotFoundError} if execution not found
|
|
53
|
+
*/
|
|
54
|
+
getStatus(executionId: string): Promise<JobRunStatus>;
|
|
55
|
+
/**
|
|
56
|
+
* Generic IPC request helper
|
|
57
|
+
*/
|
|
58
|
+
private sendIPCRequest;
|
|
59
|
+
/**
|
|
60
|
+
* Generate a unique request ID for IPC correlation
|
|
61
|
+
*/
|
|
62
|
+
private generateRequestId;
|
|
63
|
+
/**
|
|
64
|
+
* Transform status string to JobRunStatus enum
|
|
65
|
+
*/
|
|
66
|
+
private transformStatus;
|
|
67
|
+
}
|