@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,215 @@
|
|
|
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.JobExecutor = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const app_1 = require("../types/app");
|
|
9
|
+
const LocalJobStore_1 = require("../local_engine/storage/LocalJobStore");
|
|
10
|
+
const local_engine_client_1 = require("../local_engine/local-engine-client");
|
|
11
|
+
const crypto_1 = require("crypto");
|
|
12
|
+
/**
|
|
13
|
+
* Executes jobs of an OCP app in isolated processes
|
|
14
|
+
*/
|
|
15
|
+
class JobExecutor {
|
|
16
|
+
constructor(appDir, app, accountConfig, watcher) {
|
|
17
|
+
this.appDir = appDir;
|
|
18
|
+
this.app = app;
|
|
19
|
+
this.jobStore = LocalJobStore_1.LocalJobStore.getInstance(appDir);
|
|
20
|
+
this.localEngineClient = local_engine_client_1.LocalEngineClient.getInstance();
|
|
21
|
+
this.accountConfig = accountConfig;
|
|
22
|
+
this.watcher = watcher;
|
|
23
|
+
// Listen for build success events to reload code
|
|
24
|
+
if (this.watcher) {
|
|
25
|
+
this.watcher.on('buildSuccess', () => {
|
|
26
|
+
console.log('[JobExecutor] Build succeeded, closing connections to reload code');
|
|
27
|
+
this.localEngineClient.closeAllConnections().catch(err => {
|
|
28
|
+
console.error('[JobExecutor] Error closing connections:', err);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get job definitions from app manifest
|
|
35
|
+
*/
|
|
36
|
+
getJobs() {
|
|
37
|
+
const jobs = [];
|
|
38
|
+
const manifest = this.app.manifest;
|
|
39
|
+
// Regular jobs
|
|
40
|
+
if (manifest.jobs) {
|
|
41
|
+
Object.entries(manifest.jobs).forEach(([id, job]) => {
|
|
42
|
+
jobs.push({
|
|
43
|
+
id,
|
|
44
|
+
entry_point: job.entry_point,
|
|
45
|
+
description: job.description,
|
|
46
|
+
cron: job.cron,
|
|
47
|
+
parameters: job.parameters,
|
|
48
|
+
isSourceJob: false
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Source jobs (nested under sources)
|
|
53
|
+
if (manifest.sources) {
|
|
54
|
+
Object.entries(manifest.sources).forEach(([sourceId, source]) => {
|
|
55
|
+
if (source.jobs) {
|
|
56
|
+
Object.entries(source.jobs).forEach(([jobId, job]) => {
|
|
57
|
+
jobs.push({
|
|
58
|
+
id: `${sourceId}_${jobId}`,
|
|
59
|
+
entry_point: job.entry_point,
|
|
60
|
+
description: job.description,
|
|
61
|
+
parameters: job.parameters,
|
|
62
|
+
isSourceJob: true
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return jobs;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get job execution history
|
|
72
|
+
*/
|
|
73
|
+
getExecutions(jobId) {
|
|
74
|
+
return this.jobStore.getExecutions(jobId);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get specific execution details
|
|
78
|
+
*/
|
|
79
|
+
getExecution(executionId) {
|
|
80
|
+
return this.jobStore.getExecution(executionId);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get execution state history
|
|
84
|
+
*/
|
|
85
|
+
getExecutionStates(executionId) {
|
|
86
|
+
return this.jobStore.getExecutionStates(executionId);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Start a job execution
|
|
90
|
+
*/
|
|
91
|
+
async executeJob(request) {
|
|
92
|
+
try {
|
|
93
|
+
// Validate job exists
|
|
94
|
+
const jobs = this.getJobs();
|
|
95
|
+
const jobDef = jobs.find(j => j.id === request.jobId);
|
|
96
|
+
if (!jobDef) {
|
|
97
|
+
throw new Error(`Job not found: ${request.jobId}`);
|
|
98
|
+
}
|
|
99
|
+
// Create execution record
|
|
100
|
+
const execution = this.jobStore.createExecution(request.jobId, request.parameters || {});
|
|
101
|
+
// Update status to running
|
|
102
|
+
this.jobStore.updateExecutionStatus(execution.id, LocalJobStore_1.JobExecutionStatus.RUNNING);
|
|
103
|
+
// Start job execution asynchronously (don't await)
|
|
104
|
+
this.executeJobAsync(request, execution.id).catch(error => {
|
|
105
|
+
console.error('Job execution failed:', error);
|
|
106
|
+
this.jobStore.updateExecutionStatus(execution.id, LocalJobStore_1.JobExecutionStatus.FAILED, {
|
|
107
|
+
message: error.message,
|
|
108
|
+
stack: error.stack
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
// Return immediately with running status
|
|
112
|
+
return {
|
|
113
|
+
success: true,
|
|
114
|
+
executionId: execution.id,
|
|
115
|
+
status: app_1.JobExecutionStatus.RUNNING,
|
|
116
|
+
startedAt: execution.startedAt,
|
|
117
|
+
logs: [], // IPC handles logging separately
|
|
118
|
+
executionTime: 0, // Job just started
|
|
119
|
+
stateCount: 0
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
return {
|
|
124
|
+
success: false,
|
|
125
|
+
executionId: (0, crypto_1.randomUUID)(), // Generate ID even for failed creation
|
|
126
|
+
status: app_1.JobExecutionStatus.FAILED,
|
|
127
|
+
startedAt: new Date(),
|
|
128
|
+
completedAt: new Date(),
|
|
129
|
+
logs: [],
|
|
130
|
+
error: {
|
|
131
|
+
message: error.message,
|
|
132
|
+
stack: error.stack
|
|
133
|
+
},
|
|
134
|
+
executionTime: 0,
|
|
135
|
+
stateCount: 0
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Execute job asynchronously in the background
|
|
141
|
+
*/
|
|
142
|
+
async executeJobAsync(request, executionId) {
|
|
143
|
+
const startTime = Date.now();
|
|
144
|
+
try {
|
|
145
|
+
// Prepare IPC request
|
|
146
|
+
const ipcRequest = {
|
|
147
|
+
jobId: request.jobId,
|
|
148
|
+
parameters: request.parameters || {},
|
|
149
|
+
dataSyncId: request.dataSyncId,
|
|
150
|
+
sourceKey: request.sourceKey,
|
|
151
|
+
executionId: executionId,
|
|
152
|
+
appDir: this.appDir
|
|
153
|
+
};
|
|
154
|
+
// Prepare app config for IPC
|
|
155
|
+
const appConfig = {
|
|
156
|
+
manifest: this.app.manifest,
|
|
157
|
+
path: this.appDir,
|
|
158
|
+
isBuilt: true,
|
|
159
|
+
isValid: true,
|
|
160
|
+
account: this.accountConfig
|
|
161
|
+
};
|
|
162
|
+
// Execute via local engine
|
|
163
|
+
const result = await this.localEngineClient.executeJob(ipcRequest, appConfig, this.appDir);
|
|
164
|
+
// Update execution status
|
|
165
|
+
this.jobStore.updateExecutionStatus(executionId, LocalJobStore_1.JobExecutionStatus.COMPLETED);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
console.error('Job execution failed:', error);
|
|
169
|
+
this.jobStore.updateExecutionStatus(executionId, LocalJobStore_1.JobExecutionStatus.FAILED, {
|
|
170
|
+
message: error.message,
|
|
171
|
+
stack: error.stack
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Check if job file exists and is built
|
|
177
|
+
*/
|
|
178
|
+
validateJob(jobId) {
|
|
179
|
+
const jobs = this.getJobs();
|
|
180
|
+
const jobDef = jobs.find(j => j.id === jobId);
|
|
181
|
+
if (!jobDef) {
|
|
182
|
+
return { valid: false, error: `Job not found: ${jobId}` };
|
|
183
|
+
}
|
|
184
|
+
// Check if built job file exists
|
|
185
|
+
const jobPath = path_1.default.join(this.appDir, 'dist', 'jobs', `${jobDef.entry_point}.js`);
|
|
186
|
+
const fs = require('fs');
|
|
187
|
+
if (!fs.existsSync(jobPath)) {
|
|
188
|
+
return {
|
|
189
|
+
valid: false,
|
|
190
|
+
error: `Job file not built or not found. Expected: dist/jobs/${jobDef.entry_point}.js`
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return { valid: true };
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Get job statistics
|
|
197
|
+
*/
|
|
198
|
+
getStats() {
|
|
199
|
+
return this.jobStore.getStats();
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Clean up old job executions
|
|
203
|
+
*/
|
|
204
|
+
cleanup() {
|
|
205
|
+
this.jobStore.cleanup();
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Cleanup local engine connections when executor is destroyed
|
|
209
|
+
*/
|
|
210
|
+
async dispose() {
|
|
211
|
+
await this.localEngineClient.closeAllConnections();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.JobExecutor = JobExecutor;
|
|
215
|
+
//# sourceMappingURL=JobExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JobExecutor.js","sourceRoot":"","sources":["../../../src/executor/JobExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,sCAAiH;AACjH,yEAAmI;AACnI,6EAAwE;AAExE,mCAAoC;AAsBpC;;GAEG;AACH,MAAa,WAAW;IAQtB,YAAY,MAAc,EAAE,GAAQ,EAAE,aAA6B,EAAE,OAAoB;QACvF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,6BAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,iBAAiB,GAAG,uCAAiB,CAAC,WAAW,EAAE,CAAC;QACzD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,iDAAiD;QACjD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBACnC,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;gBACjF,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;oBACvD,OAAO,CAAC,KAAK,CAAC,0CAA0C,E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,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,KAAK,EAAE,EAAE,CAAC;QAC5D,CAAC;QAED,iCAAiC;QACjC,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,KAAK,CAAC,CAAC;QACnF,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,wDAAwD,MAAM,CAAC,WAAW,KAAK;aACvF,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;IACrD,CAAC;CACF;AAtOD,kCAsOC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LifecycleHookExecutionResponse, App } from '../types/app';
|
|
2
|
+
import { LocalSettingsStore } from '../local_engine/storage/LocalSettingsStore';
|
|
3
|
+
import { AppWatcher } from './watcher';
|
|
4
|
+
/**
|
|
5
|
+
* Account configuration for local testing
|
|
6
|
+
*/
|
|
7
|
+
export interface AccountConfig {
|
|
8
|
+
organizationId?: string;
|
|
9
|
+
instanceId?: string;
|
|
10
|
+
trackerId?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Account configuration for local testing
|
|
14
|
+
*/
|
|
15
|
+
export interface AccountConfig {
|
|
16
|
+
organizationId?: string;
|
|
17
|
+
instanceId?: string;
|
|
18
|
+
trackerId?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Executes lifecycle methods of an OCP app
|
|
22
|
+
*/
|
|
23
|
+
export declare class LifecycleExecutor {
|
|
24
|
+
private appDir;
|
|
25
|
+
private app;
|
|
26
|
+
private settingsStore;
|
|
27
|
+
private configStore;
|
|
28
|
+
private localEngineClient;
|
|
29
|
+
private accountConfig?;
|
|
30
|
+
private watcher?;
|
|
31
|
+
constructor(appDir: string, app: App, settingsStore: LocalSettingsStore, configStore: any, accountConfig?: AccountConfig, watcher?: AppWatcher);
|
|
32
|
+
/**
|
|
33
|
+
* Execute the onInstall lifecycle method
|
|
34
|
+
*/
|
|
35
|
+
executeInstall(): Promise<LifecycleHookExecutionResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Execute the onUninstall lifecycle method
|
|
38
|
+
*/
|
|
39
|
+
executeUninstall(): Promise<LifecycleHookExecutionResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Execute the canUninstall lifecycle method
|
|
42
|
+
*/
|
|
43
|
+
executeCanUninstall(): Promise<LifecycleHookExecutionResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Execute the onUpgrade lifecycle method
|
|
46
|
+
*/
|
|
47
|
+
executeUpgrade(fromVersion: string): Promise<LifecycleHookExecutionResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Execute the onSettingsForm lifecycle method
|
|
50
|
+
*/
|
|
51
|
+
executeSettingsForm(page: string, action: string, formData: any): Promise<LifecycleHookExecutionResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Execute a lifecycle method by running it in the app's built environment
|
|
54
|
+
*/
|
|
55
|
+
private executeLifecycleMethod;
|
|
56
|
+
/**
|
|
57
|
+
* Execute the lifecycle script using IPC
|
|
58
|
+
*/
|
|
59
|
+
private executeLifecycleScript;
|
|
60
|
+
/**
|
|
61
|
+
* Cleanup IPC connections when executor is destroyed
|
|
62
|
+
*/
|
|
63
|
+
cleanup(): Promise<void>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
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.LifecycleExecutor = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const local_engine_client_1 = require("../local_engine/local-engine-client");
|
|
9
|
+
const config_1 = require("../server/config");
|
|
10
|
+
/**
|
|
11
|
+
* Executes lifecycle methods of an OCP app
|
|
12
|
+
*/
|
|
13
|
+
class LifecycleExecutor {
|
|
14
|
+
constructor(appDir, app, settingsStore, configStore, accountConfig, watcher) {
|
|
15
|
+
this.appDir = appDir;
|
|
16
|
+
this.app = app;
|
|
17
|
+
this.settingsStore = settingsStore;
|
|
18
|
+
this.configStore = configStore;
|
|
19
|
+
this.localEngineClient = local_engine_client_1.LocalEngineClient.getInstance();
|
|
20
|
+
this.accountConfig = accountConfig;
|
|
21
|
+
this.watcher = watcher;
|
|
22
|
+
// Listen for build success events to reload code
|
|
23
|
+
if (this.watcher) {
|
|
24
|
+
this.watcher.on('buildSuccess', () => {
|
|
25
|
+
console.log('[LifecycleExecutor] Build succeeded, closing connections to reload code');
|
|
26
|
+
this.localEngineClient.closeAllConnections().catch(err => {
|
|
27
|
+
console.error('[LifecycleExecutor] Error closing connections:', err);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Execute the onInstall lifecycle method
|
|
34
|
+
*/
|
|
35
|
+
async executeInstall() {
|
|
36
|
+
return this.executeLifecycleMethod("onInstall");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Execute the onUninstall lifecycle method
|
|
40
|
+
*/
|
|
41
|
+
async executeUninstall() {
|
|
42
|
+
return this.executeLifecycleMethod("onUninstall");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Execute the canUninstall lifecycle method
|
|
46
|
+
*/
|
|
47
|
+
async executeCanUninstall() {
|
|
48
|
+
return this.executeLifecycleMethod("canUninstall");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Execute the onUpgrade lifecycle method
|
|
52
|
+
*/
|
|
53
|
+
async executeUpgrade(fromVersion) {
|
|
54
|
+
return this.executeLifecycleMethod("onUpgrade", { fromVersion });
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Execute the onSettingsForm lifecycle method
|
|
58
|
+
*/
|
|
59
|
+
async executeSettingsForm(page, action, formData) {
|
|
60
|
+
return this.executeLifecycleMethod("onSettingsForm", {
|
|
61
|
+
page,
|
|
62
|
+
action,
|
|
63
|
+
formData,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Execute a lifecycle method by running it in the app's built environment
|
|
68
|
+
*/
|
|
69
|
+
async executeLifecycleMethod(method, params) {
|
|
70
|
+
const startTime = Date.now();
|
|
71
|
+
const logs = [];
|
|
72
|
+
try {
|
|
73
|
+
// Check if lifecycle file exists
|
|
74
|
+
const lifecyclePath = path_1.default.join(this.appDir, "src", "lifecycle", "Lifecycle.ts");
|
|
75
|
+
const distLifecyclePath = path_1.default.join(this.appDir, "dist", "lifecycle", "Lifecycle.js");
|
|
76
|
+
// Try to execute the built lifecycle file if it exists
|
|
77
|
+
const executionResult = await this.executeLifecycleScript(method, params, distLifecyclePath);
|
|
78
|
+
const executionTime = Date.now() - startTime;
|
|
79
|
+
if (executionResult.success) {
|
|
80
|
+
logs.push(`${method} lifecycle hook started`);
|
|
81
|
+
logs.push(...executionResult.logs);
|
|
82
|
+
logs.push(`${method} lifecycle hook completed successfully`);
|
|
83
|
+
return {
|
|
84
|
+
success: true,
|
|
85
|
+
logs,
|
|
86
|
+
executionTime,
|
|
87
|
+
result: executionResult.result,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
logs.push(`${method} lifecycle hook started`);
|
|
92
|
+
logs.push(...executionResult.logs);
|
|
93
|
+
logs.push(`${method} lifecycle hook failed: ${executionResult.error}`);
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
logs,
|
|
97
|
+
error: {
|
|
98
|
+
message: executionResult.error || "Lifecycle method execution failed",
|
|
99
|
+
stack: executionResult.stack,
|
|
100
|
+
},
|
|
101
|
+
executionTime,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
const executionTime = Date.now() - startTime;
|
|
107
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
108
|
+
logs.push(`${method} lifecycle hook started`);
|
|
109
|
+
logs.push(`Error executing ${method}: ${errorMessage}`);
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
logs,
|
|
113
|
+
error: {
|
|
114
|
+
message: errorMessage,
|
|
115
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
116
|
+
},
|
|
117
|
+
executionTime,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Execute the lifecycle script using IPC
|
|
123
|
+
*/
|
|
124
|
+
async executeLifecycleScript(method, params = {}, scriptPath) {
|
|
125
|
+
try {
|
|
126
|
+
// Convert request to IPC format
|
|
127
|
+
const ipcRequest = {
|
|
128
|
+
method,
|
|
129
|
+
params,
|
|
130
|
+
scriptPath,
|
|
131
|
+
appDir: this.appDir
|
|
132
|
+
};
|
|
133
|
+
// Prepare app config for IPC
|
|
134
|
+
const appConfig = {
|
|
135
|
+
manifest: this.app.manifest,
|
|
136
|
+
path: this.appDir,
|
|
137
|
+
isBuilt: true,
|
|
138
|
+
isValid: true,
|
|
139
|
+
account: this.accountConfig,
|
|
140
|
+
baseUrl: `http://${config_1.config.server.host}:${config_1.config.server.port}`
|
|
141
|
+
};
|
|
142
|
+
// Execute via IPC
|
|
143
|
+
const result = await this.localEngineClient.executeLifecycle(ipcRequest, appConfig, this.appDir);
|
|
144
|
+
return {
|
|
145
|
+
success: result.success || true,
|
|
146
|
+
logs: [], // IPC handles logging separately
|
|
147
|
+
result: result.result
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
return {
|
|
152
|
+
success: false,
|
|
153
|
+
logs: [],
|
|
154
|
+
error: error.message,
|
|
155
|
+
stack: error.stack
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Cleanup IPC connections when executor is destroyed
|
|
161
|
+
*/
|
|
162
|
+
async cleanup() {
|
|
163
|
+
await this.localEngineClient.closeAllConnections();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.LifecycleExecutor = LifecycleExecutor;
|
|
167
|
+
//# sourceMappingURL=LifecycleExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LifecycleExecutor.js","sourceRoot":"","sources":["../../../src/executor/LifecycleExecutor.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,6EAAwE;AAGxE,6CAA0C;AAoB1C;;GAEG;AACH,MAAa,iBAAiB;IAS5B,YAAY,MAAc,EAAE,GAAQ,EAAE,aAAiC,EAAE,WAAgB,EAAE,aAA6B,EAAE,OAAoB;QAC5I,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,iBAAiB,GAAG,uCAAiB,CAAC,WAAW,EAAE,CAAC;QACzD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAA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AAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAEjG,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI;gBAC/B,IAAI,EAAE,EAAE,EAAE,iCAAiC;gBAC3C,MAAM,EAAE,MAAM,CAAC,MAAM;aACtB,CAAC;QAEJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,EAAE;gBACR,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC;QACJ,CAAC;IACH,CAAC;IAGD;;OAEG;IACI,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;IACrD,CAAC;CACF;AAtND,8CAsNC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { App } from '../types/app';
|
|
2
|
+
import { SourceWebhookRequest, SourceJobRequest } from '../local_engine/local-engine-types';
|
|
3
|
+
import { LocalConfigStore } from '../local_engine/storage/LocalConfigStore';
|
|
4
|
+
export interface SourceWebhookResponse {
|
|
5
|
+
status: number;
|
|
6
|
+
headers: [string, string][];
|
|
7
|
+
body: any;
|
|
8
|
+
}
|
|
9
|
+
export interface SourceCallbackResponse {
|
|
10
|
+
success: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SourceJobResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
logs: string[];
|
|
16
|
+
executionTime: number;
|
|
17
|
+
error?: string;
|
|
18
|
+
result?: any;
|
|
19
|
+
}
|
|
20
|
+
export declare class SourceExecutor {
|
|
21
|
+
private app;
|
|
22
|
+
private localEngineClient;
|
|
23
|
+
private configStore;
|
|
24
|
+
constructor(app: App, configStore: LocalConfigStore);
|
|
25
|
+
executeSourceWebhook(request: SourceWebhookRequest): Promise<SourceWebhookResponse>;
|
|
26
|
+
executeSourceCreate(sourceId: string): Promise<SourceCallbackResponse>;
|
|
27
|
+
executeSourceUpdate(sourceId: string): Promise<SourceCallbackResponse>;
|
|
28
|
+
executeSourceDelete(sourceId: string): Promise<SourceCallbackResponse>;
|
|
29
|
+
executeSourceEnable(sourceId: string): Promise<SourceCallbackResponse>;
|
|
30
|
+
executeSourcePause(sourceId: string): Promise<SourceCallbackResponse>;
|
|
31
|
+
executeSourceJob(request: SourceJobRequest): Promise<SourceJobResult>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceExecutor = void 0;
|
|
4
|
+
const local_engine_client_1 = require("../local_engine/local-engine-client");
|
|
5
|
+
const LogManager_1 = require("../logging/LogManager");
|
|
6
|
+
const config_1 = require("../server/config");
|
|
7
|
+
const logger = LogManager_1.LogManager.getInstance();
|
|
8
|
+
/**
|
|
9
|
+
* Create app configuration object for IPC communication
|
|
10
|
+
*/
|
|
11
|
+
function createAppConfig(app) {
|
|
12
|
+
return {
|
|
13
|
+
manifest: app.manifest,
|
|
14
|
+
isBuilt: true,
|
|
15
|
+
isValid: true,
|
|
16
|
+
path: app.path,
|
|
17
|
+
baseUrl: `http://${config_1.config.server.host}:${config_1.config.server.port}`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
class SourceExecutor {
|
|
21
|
+
constructor(app, configStore) {
|
|
22
|
+
this.app = app;
|
|
23
|
+
this.localEngineClient = local_engine_client_1.LocalEngineClient.getInstance();
|
|
24
|
+
this.configStore = configStore;
|
|
25
|
+
}
|
|
26
|
+
async executeSourceWebhook(request) {
|
|
27
|
+
try {
|
|
28
|
+
logger.logSourceExecution(request.sourceId, 'webhook', 'started', {
|
|
29
|
+
method: request.method,
|
|
30
|
+
path: request.path
|
|
31
|
+
});
|
|
32
|
+
const source = this.app.manifest.sources?.[request.sourceId];
|
|
33
|
+
if (!source) {
|
|
34
|
+
throw new Error(`Source ${request.sourceId} not found in manifest`);
|
|
35
|
+
}
|
|
36
|
+
const result = await this.localEngineClient.executeSourceWebhook(request, createAppConfig(this.app));
|
|
37
|
+
logger.logSourceExecution(request.sourceId, 'webhook', 'success', {
|
|
38
|
+
status: result.status
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logger.logSourceExecution(request.sourceId, 'webhook', 'error', { error });
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async executeSourceCreate(sourceId) {
|
|
48
|
+
try {
|
|
49
|
+
logger.logSourceExecution(sourceId, 'create', 'started');
|
|
50
|
+
const source = this.app.manifest.sources?.[sourceId];
|
|
51
|
+
if (!source) {
|
|
52
|
+
throw new Error(`Source ${sourceId} not found in manifest`);
|
|
53
|
+
}
|
|
54
|
+
// Retrieve GUID from config store
|
|
55
|
+
const guid = this.configStore.getSourceGuid(sourceId);
|
|
56
|
+
const result = await this.localEngineClient.executeSourceCreate(sourceId, guid, createAppConfig(this.app));
|
|
57
|
+
logger.logSourceExecution(sourceId, 'create', 'success', { result });
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
logger.logSourceExecution(sourceId, 'create', 'error', { error });
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async executeSourceUpdate(sourceId) {
|
|
66
|
+
try {
|
|
67
|
+
logger.logSourceExecution(sourceId, 'update', 'started');
|
|
68
|
+
const source = this.app.manifest.sources?.[sourceId];
|
|
69
|
+
if (!source) {
|
|
70
|
+
throw new Error(`Source ${sourceId} not found in manifest`);
|
|
71
|
+
}
|
|
72
|
+
// Retrieve GUID from config store
|
|
73
|
+
const guid = this.configStore.getSourceGuid(sourceId);
|
|
74
|
+
const result = await this.localEngineClient.executeSourceUpdate(sourceId, guid, createAppConfig(this.app));
|
|
75
|
+
logger.logSourceExecution(sourceId, 'update', 'success', { result });
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
logger.logSourceExecution(sourceId, 'update', 'error', { error });
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async executeSourceDelete(sourceId) {
|
|
84
|
+
try {
|
|
85
|
+
logger.logSourceExecution(sourceId, 'delete', 'started');
|
|
86
|
+
const source = this.app.manifest.sources?.[sourceId];
|
|
87
|
+
if (!source) {
|
|
88
|
+
throw new Error(`Source ${sourceId} not found in manifest`);
|
|
89
|
+
}
|
|
90
|
+
// Retrieve GUID from config store
|
|
91
|
+
const guid = this.configStore.getSourceGuid(sourceId);
|
|
92
|
+
const result = await this.localEngineClient.executeSourceDelete(sourceId, guid, createAppConfig(this.app));
|
|
93
|
+
logger.logSourceExecution(sourceId, 'delete', 'success', { result });
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
logger.logSourceExecution(sourceId, 'delete', 'error', { error });
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async executeSourceEnable(sourceId) {
|
|
102
|
+
try {
|
|
103
|
+
logger.logSourceExecution(sourceId, 'enable', 'started');
|
|
104
|
+
const source = this.app.manifest.sources?.[sourceId];
|
|
105
|
+
if (!source) {
|
|
106
|
+
throw new Error(`Source ${sourceId} not found in manifest`);
|
|
107
|
+
}
|
|
108
|
+
// Retrieve GUID from config store
|
|
109
|
+
const guid = this.configStore.getSourceGuid(sourceId);
|
|
110
|
+
const result = await this.localEngineClient.executeSourceEnable(sourceId, guid, createAppConfig(this.app));
|
|
111
|
+
logger.logSourceExecution(sourceId, 'enable', 'success', { result });
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
logger.logSourceExecution(sourceId, 'enable', 'error', { error });
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async executeSourcePause(sourceId) {
|
|
120
|
+
try {
|
|
121
|
+
logger.logSourceExecution(sourceId, 'pause', 'started');
|
|
122
|
+
const source = this.app.manifest.sources?.[sourceId];
|
|
123
|
+
if (!source) {
|
|
124
|
+
throw new Error(`Source ${sourceId} not found in manifest`);
|
|
125
|
+
}
|
|
126
|
+
// Retrieve GUID from config store
|
|
127
|
+
const guid = this.configStore.getSourceGuid(sourceId);
|
|
128
|
+
const result = await this.localEngineClient.executeSourcePause(sourceId, guid, createAppConfig(this.app));
|
|
129
|
+
logger.logSourceExecution(sourceId, 'pause', 'success', { result });
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
logger.logSourceExecution(sourceId, 'pause', 'error', { error });
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async executeSourceJob(request) {
|
|
138
|
+
try {
|
|
139
|
+
logger.logSourceExecution(request.sourceId, 'job', 'started', {
|
|
140
|
+
jobId: request.jobId
|
|
141
|
+
});
|
|
142
|
+
const source = this.app.manifest.sources?.[request.sourceId];
|
|
143
|
+
if (!source) {
|
|
144
|
+
throw new Error(`Source ${request.sourceId} not found in manifest`);
|
|
145
|
+
}
|
|
146
|
+
const result = await this.localEngineClient.executeSourceJob(request, createAppConfig(this.app));
|
|
147
|
+
logger.logSourceExecution(request.sourceId, 'job', 'success', {
|
|
148
|
+
jobId: request.jobId,
|
|
149
|
+
executionTime: result.executionTime
|
|
150
|
+
});
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
logger.logSourceExecution(request.sourceId, 'job', 'error', {
|
|
155
|
+
jobId: request.jobId,
|
|
156
|
+
error
|
|
157
|
+
});
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.SourceExecutor = SourceExecutor;
|
|
163
|
+
//# sourceMappingURL=SourceExecutor.js.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