@optimizely/ocp-local-env 1.0.0-beta.6 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +2 -1
- package/dist/public/bundle.7a5338c67e783e9b42f7.js +3 -0
- package/dist/public/{bundle.932ab47a0dbf0319bc8b.js.LICENSE.txt → bundle.7a5338c67e783e9b42f7.js.LICENSE.txt} +33 -0
- package/dist/public/bundle.7a5338c67e783e9b42f7.js.map +1 -0
- package/dist/public/index.html +1 -1
- package/dist/src/executor/DestinationExecutor.js +10 -7
- package/dist/src/executor/DestinationExecutor.js.map +1 -1
- package/dist/src/executor/FunctionExecutor.js +1 -1
- package/dist/src/executor/FunctionExecutor.js.map +1 -1
- package/dist/src/executor/JobExecutor.js +1 -1
- package/dist/src/executor/JobExecutor.js.map +1 -1
- package/dist/src/executor/LifecycleExecutor.js +1 -1
- package/dist/src/executor/LifecycleExecutor.js.map +1 -1
- package/dist/src/executor/SourceExecutor.d.ts +32 -0
- package/dist/src/executor/SourceExecutor.js +161 -0
- package/dist/src/executor/SourceExecutor.js.map +1 -0
- package/dist/src/local_engine/LocalJobApi.d.ts +38 -0
- package/dist/src/local_engine/LocalJobApi.js +180 -0
- package/dist/src/local_engine/LocalJobApi.js.map +1 -0
- package/dist/src/local_engine/local-engine-child-base.d.ts +16 -0
- package/dist/src/local_engine/local-engine-child-base.js +201 -14
- package/dist/src/local_engine/local-engine-child-base.js.map +1 -1
- package/dist/src/local_engine/local-engine-client.d.ts +70 -1
- package/dist/src/local_engine/local-engine-client.js +545 -26
- package/dist/src/local_engine/local-engine-client.js.map +1 -1
- package/dist/src/local_engine/local-engine-types.d.ts +98 -2
- package/dist/src/local_engine/local-engine-unified.d.ts +18 -0
- package/dist/src/local_engine/local-engine-unified.js +227 -1
- package/dist/src/local_engine/local-engine-unified.js.map +1 -1
- package/dist/src/local_engine/local-engine-utils.js +34 -7
- package/dist/src/local_engine/local-engine-utils.js.map +1 -1
- package/dist/src/local_engine/localSDKConfig.js +237 -39
- package/dist/src/local_engine/localSDKConfig.js.map +1 -1
- package/dist/src/local_engine/storage/LocalConfigStore.d.ts +18 -0
- package/dist/src/local_engine/storage/LocalConfigStore.js +52 -3
- package/dist/src/local_engine/storage/LocalConfigStore.js.map +1 -1
- package/dist/src/local_engine/storage/LocalJobStore.d.ts +1 -0
- package/dist/src/local_engine/storage/LocalJobStore.js +12 -2
- package/dist/src/local_engine/storage/LocalJobStore.js.map +1 -1
- package/dist/src/local_engine/storage/LocalKVStore.d.ts +1 -0
- package/dist/src/local_engine/storage/LocalKVStore.js +134 -75
- package/dist/src/local_engine/storage/LocalKVStore.js.map +1 -1
- package/dist/src/local_engine/storage/LocalNotificationStore.d.ts +1 -0
- package/dist/src/local_engine/storage/LocalNotificationStore.js +17 -3
- package/dist/src/local_engine/storage/LocalNotificationStore.js.map +1 -1
- package/dist/src/local_engine/storage/LocalSecretsStore.d.ts +1 -0
- package/dist/src/local_engine/storage/LocalSecretsStore.js +37 -6
- package/dist/src/local_engine/storage/LocalSecretsStore.js.map +1 -1
- package/dist/src/local_engine/storage/LocalSettingsStore.d.ts +1 -0
- package/dist/src/local_engine/storage/LocalSettingsStore.js +61 -11
- package/dist/src/local_engine/storage/LocalSettingsStore.js.map +1 -1
- 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/utils.js +20 -4
- package/dist/src/local_engine/utils.js.map +1 -1
- package/dist/src/logging/LogManager.d.ts +191 -34
- package/dist/src/logging/LogManager.js +209 -103
- package/dist/src/logging/LogManager.js.map +1 -1
- package/dist/src/server/api/destinations.js +30 -6
- package/dist/src/server/api/destinations.js.map +1 -1
- package/dist/src/server/api/jobs.js +3 -0
- package/dist/src/server/api/jobs.js.map +1 -1
- package/dist/src/server/api/sources.d.ts +7 -0
- package/dist/src/server/api/sources.js +380 -0
- package/dist/src/server/api/sources.js.map +1 -0
- package/dist/src/server/api.js +64 -3
- package/dist/src/server/api.js.map +1 -1
- package/dist/src/server.js +203 -19
- package/dist/src/server.js.map +1 -1
- package/dist/src/ui/components/App.js +165 -21
- package/dist/src/ui/components/App.js.map +1 -1
- package/dist/src/ui/components/DestinationsView.d.ts +8 -0
- package/dist/src/ui/components/DestinationsView.js +30 -9
- package/dist/src/ui/components/DestinationsView.js.map +1 -1
- package/dist/src/ui/components/FunctionsView.d.ts +7 -0
- package/dist/src/ui/components/FunctionsView.js +69 -9
- package/dist/src/ui/components/FunctionsView.js.map +1 -1
- package/dist/src/ui/components/JobsView.d.ts +7 -0
- package/dist/src/ui/components/JobsView.js +55 -15
- package/dist/src/ui/components/JobsView.js.map +1 -1
- 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 +168 -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/TabbedConsole.d.ts +3 -1
- package/dist/src/ui/components/TabbedConsole.js +81 -11
- package/dist/src/ui/components/TabbedConsole.js.map +1 -1
- 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.js +3 -2
- package/dist/src/ui/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/public/bundle.932ab47a0dbf0319bc8b.js +0 -3
- package/dist/public/bundle.932ab47a0dbf0319bc8b.js.map +0 -1
- package/dist/src/server/api/lifecycle.d.ts +0 -6
- package/dist/src/server/api/lifecycle.js +0 -72
- package/dist/src/server/api/lifecycle.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SourceDataContext = 'webhook' | 'job';
|
|
2
|
+
export interface SourceDataEntry {
|
|
3
|
+
timestamp: number;
|
|
4
|
+
data: any;
|
|
5
|
+
context: SourceDataContext;
|
|
6
|
+
metadata?: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export interface SourceDataFile {
|
|
9
|
+
sourceId: string;
|
|
10
|
+
entries: SourceDataEntry[];
|
|
11
|
+
}
|
|
12
|
+
export declare class SourceDataStore {
|
|
13
|
+
private storageDir;
|
|
14
|
+
private maxEntries;
|
|
15
|
+
constructor(appRootDir: string);
|
|
16
|
+
private ensureStorageDir;
|
|
17
|
+
private getFilePath;
|
|
18
|
+
private readFile;
|
|
19
|
+
private writeFile;
|
|
20
|
+
push(sourceId: string, data: any, context: SourceDataContext, metadata?: Record<string, any>): void;
|
|
21
|
+
getData(sourceId: string, context?: SourceDataContext, limit?: number): SourceDataEntry[];
|
|
22
|
+
clear(sourceId: string, context?: SourceDataContext): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.SourceDataStore = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
class SourceDataStore {
|
|
10
|
+
constructor(appRootDir) {
|
|
11
|
+
this.maxEntries = 50;
|
|
12
|
+
this.storageDir = path_1.default.join(appRootDir, 'storage', 'source-data');
|
|
13
|
+
this.ensureStorageDir();
|
|
14
|
+
}
|
|
15
|
+
ensureStorageDir() {
|
|
16
|
+
if (!fs_1.default.existsSync(this.storageDir)) {
|
|
17
|
+
fs_1.default.mkdirSync(this.storageDir, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
getFilePath(sourceId) {
|
|
21
|
+
return path_1.default.join(this.storageDir, `${sourceId}.json`);
|
|
22
|
+
}
|
|
23
|
+
readFile(sourceId) {
|
|
24
|
+
const filePath = this.getFilePath(sourceId);
|
|
25
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
26
|
+
return { sourceId, entries: [] };
|
|
27
|
+
}
|
|
28
|
+
const content = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
29
|
+
return JSON.parse(content);
|
|
30
|
+
}
|
|
31
|
+
writeFile(data) {
|
|
32
|
+
const filePath = this.getFilePath(data.sourceId);
|
|
33
|
+
fs_1.default.writeFileSync(filePath, JSON.stringify(data, null, 2));
|
|
34
|
+
}
|
|
35
|
+
push(sourceId, data, context, metadata) {
|
|
36
|
+
const file = this.readFile(sourceId);
|
|
37
|
+
// Add new entry
|
|
38
|
+
file.entries.push({
|
|
39
|
+
timestamp: Date.now(),
|
|
40
|
+
data,
|
|
41
|
+
context,
|
|
42
|
+
metadata
|
|
43
|
+
});
|
|
44
|
+
// Prune to keep only last maxEntries per context
|
|
45
|
+
const webhookEntries = file.entries.filter(e => e.context === 'webhook');
|
|
46
|
+
const jobEntries = file.entries.filter(e => e.context === 'job');
|
|
47
|
+
// Keep last maxEntries for each context
|
|
48
|
+
const prunedWebhook = webhookEntries.slice(-this.maxEntries);
|
|
49
|
+
const prunedJob = jobEntries.slice(-this.maxEntries);
|
|
50
|
+
// Merge and sort by timestamp
|
|
51
|
+
file.entries = [...prunedWebhook, ...prunedJob].sort((a, b) => a.timestamp - b.timestamp);
|
|
52
|
+
this.writeFile(file);
|
|
53
|
+
}
|
|
54
|
+
getData(sourceId, context, limit) {
|
|
55
|
+
const file = this.readFile(sourceId);
|
|
56
|
+
let entries = file.entries;
|
|
57
|
+
// Filter by context if specified
|
|
58
|
+
if (context) {
|
|
59
|
+
entries = entries.filter(e => e.context === context);
|
|
60
|
+
}
|
|
61
|
+
if (limit && limit > 0) {
|
|
62
|
+
return entries.slice(-limit);
|
|
63
|
+
}
|
|
64
|
+
return entries;
|
|
65
|
+
}
|
|
66
|
+
clear(sourceId, context) {
|
|
67
|
+
if (!context) {
|
|
68
|
+
// Clear all data
|
|
69
|
+
const filePath = this.getFilePath(sourceId);
|
|
70
|
+
if (fs_1.default.existsSync(filePath)) {
|
|
71
|
+
fs_1.default.unlinkSync(filePath);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// Clear only specific context
|
|
76
|
+
const file = this.readFile(sourceId);
|
|
77
|
+
file.entries = file.entries.filter(e => e.context !== context);
|
|
78
|
+
this.writeFile(file);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.SourceDataStore = SourceDataStore;
|
|
83
|
+
//# sourceMappingURL=SourceDataStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AAiC;QACjC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,QAAgB,EAAE,OAA2B;QACjD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,iBAAiB;YACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,8BAA8B;YAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;YAC/D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AAxFD,0CAwFC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface SourceJobExecution {
|
|
2
|
+
jobId: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
success: boolean;
|
|
5
|
+
logs: string[];
|
|
6
|
+
executionTime: number;
|
|
7
|
+
error?: string;
|
|
8
|
+
result?: any;
|
|
9
|
+
}
|
|
10
|
+
export interface SourceJobExecutionFile {
|
|
11
|
+
sourceId: string;
|
|
12
|
+
executions: SourceJobExecution[];
|
|
13
|
+
}
|
|
14
|
+
export declare class SourceJobExecutionStore {
|
|
15
|
+
private storageDir;
|
|
16
|
+
private maxExecutions;
|
|
17
|
+
constructor(appRootDir: string);
|
|
18
|
+
private ensureStorageDir;
|
|
19
|
+
private getFilePath;
|
|
20
|
+
private readFile;
|
|
21
|
+
private writeFile;
|
|
22
|
+
addExecution(sourceId: string, execution: SourceJobExecution): void;
|
|
23
|
+
getExecutions(sourceId: string, jobId?: string): SourceJobExecution[];
|
|
24
|
+
clear(sourceId: string): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.SourceJobExecutionStore = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
class SourceJobExecutionStore {
|
|
10
|
+
constructor(appRootDir) {
|
|
11
|
+
this.maxExecutions = 100;
|
|
12
|
+
this.storageDir = path_1.default.join(appRootDir, 'storage', 'source-job-executions');
|
|
13
|
+
this.ensureStorageDir();
|
|
14
|
+
}
|
|
15
|
+
ensureStorageDir() {
|
|
16
|
+
if (!fs_1.default.existsSync(this.storageDir)) {
|
|
17
|
+
fs_1.default.mkdirSync(this.storageDir, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
getFilePath(sourceId) {
|
|
21
|
+
return path_1.default.join(this.storageDir, `${sourceId}.json`);
|
|
22
|
+
}
|
|
23
|
+
readFile(sourceId) {
|
|
24
|
+
const filePath = this.getFilePath(sourceId);
|
|
25
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
26
|
+
return { sourceId, executions: [] };
|
|
27
|
+
}
|
|
28
|
+
const content = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
29
|
+
return JSON.parse(content);
|
|
30
|
+
}
|
|
31
|
+
writeFile(data) {
|
|
32
|
+
const filePath = this.getFilePath(data.sourceId);
|
|
33
|
+
fs_1.default.writeFileSync(filePath, JSON.stringify(data, null, 2));
|
|
34
|
+
}
|
|
35
|
+
addExecution(sourceId, execution) {
|
|
36
|
+
const file = this.readFile(sourceId);
|
|
37
|
+
file.executions.push(execution);
|
|
38
|
+
// Prune to keep only last maxExecutions
|
|
39
|
+
if (file.executions.length > this.maxExecutions) {
|
|
40
|
+
file.executions = file.executions.slice(-this.maxExecutions);
|
|
41
|
+
}
|
|
42
|
+
this.writeFile(file);
|
|
43
|
+
}
|
|
44
|
+
getExecutions(sourceId, jobId) {
|
|
45
|
+
const file = this.readFile(sourceId);
|
|
46
|
+
let executions = file.executions;
|
|
47
|
+
if (jobId) {
|
|
48
|
+
executions = executions.filter(e => e.jobId === jobId);
|
|
49
|
+
}
|
|
50
|
+
// Return in reverse chronological order (most recent first)
|
|
51
|
+
return executions.reverse();
|
|
52
|
+
}
|
|
53
|
+
clear(sourceId) {
|
|
54
|
+
const filePath = this.getFilePath(sourceId);
|
|
55
|
+
if (fs_1.default.existsSync(filePath)) {
|
|
56
|
+
fs_1.default.unlinkSync(filePath);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.SourceJobExecutionStore = SourceJobExecutionStore;
|
|
61
|
+
//# sourceMappingURL=SourceJobExecutionStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceJobExecutionStore.js","sourceRoot":"","sources":["../../../../src/local_engine/storage/SourceJobExecutionStore.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AAiBpB,MAAa,uBAAuB;IAIlC,YAAY,UAAkB;QAFtB,kBAAa,GAAW,GAAG,CAAC;QAGlC,IAAI,CAAC,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,uBAAu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AC,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YAChD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,aAAa,CAAC,QAAgB,EAAE,KAAc;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAErC,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjC,IAAI,KAAK,EAAE,CAAC;YACV,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QACzD,CAAC;QAED,4DAA4D;QAC5D,OAAO,UAAU,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,QAAgB;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF;AAjED,0DAiEC"}
|
|
@@ -14,6 +14,8 @@ exports.outputResult = outputResult;
|
|
|
14
14
|
*/
|
|
15
15
|
const path_1 = __importDefault(require("path"));
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const LogManager_1 = require("../logging/LogManager");
|
|
18
|
+
const logManager = LogManager_1.LogManager.getInstance();
|
|
17
19
|
/**
|
|
18
20
|
* Dynamically load the SDK from the app's node_modules
|
|
19
21
|
*/
|
|
@@ -112,13 +114,27 @@ function parseWrapperArgs() {
|
|
|
112
114
|
*/
|
|
113
115
|
function outputResult(result) {
|
|
114
116
|
if (result.success) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
logManager.info(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, 'SUCCESS', {
|
|
118
|
+
id: 'utils',
|
|
119
|
+
operation: 'output'
|
|
120
|
+
});
|
|
121
|
+
logManager.info(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, `RESULT: ${JSON.stringify(result.result || null)}`, {
|
|
122
|
+
id: 'utils',
|
|
123
|
+
operation: 'output'
|
|
124
|
+
});
|
|
117
125
|
}
|
|
118
126
|
else {
|
|
119
|
-
|
|
127
|
+
logManager.error(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, `FAILED: ${result.error || 'Unknown error'}`, {
|
|
128
|
+
id: 'utils',
|
|
129
|
+
operation: 'output',
|
|
130
|
+
error: result.error
|
|
131
|
+
});
|
|
120
132
|
if (result.stack) {
|
|
121
|
-
|
|
133
|
+
logManager.error(LogManager_1.LogSource.System, LogManager_1.LogCategory.AppRunner, `STACK: ${result.stack}`, {
|
|
134
|
+
id: 'utils',
|
|
135
|
+
operation: 'output',
|
|
136
|
+
stack: result.stack
|
|
137
|
+
});
|
|
122
138
|
}
|
|
123
139
|
}
|
|
124
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/local_engine/utils.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/local_engine/utils.ts"],"names":[],"mappings":";;;;;AAoBA,gCAiBC;AAKD,4CAmBC;AAKD,8CAmBC;AAKD,gDAmBC;AAKD,4CAYC;AAKD,oCAwBC;AA3JD;;GAEG;AACH,gDAAwB;AACxB,4CAAoB;AACpB,sDAA2E;AAE3E,MAAM,UAAU,GAAG,uBAAU,CAAC,WAAW,EAAE,CAAC;AAU5C;;GAEG;AACH,SAAgB,UAAU,CAAC,OAAe;IACxC,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC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S,EAAE,QAAQ;YACnB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,UAAU,CAAC,KAAK,CAAC,sBAAS,CAAC,MAAM,EAAE,wBAAW,CAAC,SAAS,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE;gBAClF,EAAE,EAAE,OAAO;gBACX,SAAS,EAAE,QAAQ;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -2,15 +2,164 @@
|
|
|
2
2
|
* Centralized logging system for the OCP Local Environment
|
|
3
3
|
* Captures logs from builds, function executions, lifecycle hooks, and general operations
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Log source types - reduced to 2 sources
|
|
7
|
+
*/
|
|
8
|
+
export declare enum LogSource {
|
|
9
|
+
App = "app",
|
|
10
|
+
System = "system"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Log category types - specific categories for different log types
|
|
14
|
+
*/
|
|
15
|
+
export declare enum LogCategory {
|
|
16
|
+
Build = "build",
|
|
17
|
+
Function = "function",
|
|
18
|
+
Lifecycle = "lifecycle",
|
|
19
|
+
Destination = "destination",
|
|
20
|
+
Source = "source",
|
|
21
|
+
Jobs = "jobs",
|
|
22
|
+
Notifications = "notifications",
|
|
23
|
+
KVStore = "kvstore",
|
|
24
|
+
Settings = "settings",
|
|
25
|
+
Secrets = "secrets",
|
|
26
|
+
Config = "config",
|
|
27
|
+
AppRunner = "app-runner"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Log levels
|
|
31
|
+
*/
|
|
32
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
33
|
+
/**
|
|
34
|
+
* Base context interface - common fields for all log contexts
|
|
35
|
+
*/
|
|
36
|
+
export interface BaseLogContext {
|
|
37
|
+
id: string;
|
|
38
|
+
error?: any;
|
|
39
|
+
errorMessage?: string;
|
|
40
|
+
stack?: string;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Empty context for categories that don't need specific context
|
|
45
|
+
*/
|
|
46
|
+
export interface EmptyLogContext extends BaseLogContext {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Function execution context
|
|
50
|
+
* id = function identifier (e.g., 'my-function')
|
|
51
|
+
*/
|
|
52
|
+
export interface FunctionLogContext extends BaseLogContext {
|
|
53
|
+
method?: string;
|
|
54
|
+
path?: string;
|
|
55
|
+
executionTime?: number;
|
|
56
|
+
status?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Lifecycle execution context
|
|
60
|
+
* id = hook name (e.g., 'onInstall')
|
|
61
|
+
*/
|
|
62
|
+
export interface LifecycleLogContext extends BaseLogContext {
|
|
63
|
+
executionTime?: number;
|
|
64
|
+
status?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Destination execution context
|
|
68
|
+
* id = destination identifier (e.g., 'analytics-destination')
|
|
69
|
+
*/
|
|
70
|
+
export interface DestinationLogContext extends BaseLogContext {
|
|
71
|
+
operation?: 'ready' | 'deliver' | 'schema';
|
|
72
|
+
batchSize?: number;
|
|
73
|
+
ready?: boolean;
|
|
74
|
+
retryable?: boolean;
|
|
75
|
+
failureReason?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Source execution context
|
|
79
|
+
* id = source identifier (e.g., 'my-source')
|
|
80
|
+
*/
|
|
81
|
+
export interface SourceLogContext extends BaseLogContext {
|
|
82
|
+
operation?: string;
|
|
83
|
+
error?: any;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Job operation context
|
|
87
|
+
* id = job identifier or 'unknown'
|
|
88
|
+
*/
|
|
89
|
+
export interface JobLogContext extends BaseLogContext {
|
|
90
|
+
operation?: 'schedule' | 'execute' | 'cancel' | 'list';
|
|
91
|
+
status?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Notification operation context
|
|
95
|
+
* id = notification identifier or 'unknown'
|
|
96
|
+
*/
|
|
97
|
+
export interface NotificationLogContext extends BaseLogContext {
|
|
98
|
+
operation?: 'send' | 'list' | 'clear';
|
|
99
|
+
recipient?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Storage operation context (kvstore, settings, secrets, config)
|
|
103
|
+
* id = key identifier (e.g., 'user:123') or 'unknown'
|
|
104
|
+
*/
|
|
105
|
+
export interface StorageLogContext extends BaseLogContext {
|
|
106
|
+
store: string;
|
|
107
|
+
operation: 'get' | 'set' | 'delete' | 'exists' | 'list' | 'clear';
|
|
108
|
+
key?: string;
|
|
109
|
+
value?: any;
|
|
110
|
+
ttl?: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* IPC communication context
|
|
114
|
+
* id = request identifier or 'unknown'
|
|
115
|
+
*/
|
|
116
|
+
export interface IPCLogContext extends BaseLogContext {
|
|
117
|
+
messageType?: string;
|
|
118
|
+
connectionId?: string;
|
|
119
|
+
timeout?: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Process management context
|
|
123
|
+
* id = process identifier or 'unknown'
|
|
124
|
+
*/
|
|
125
|
+
export interface ProcessLogContext extends BaseLogContext {
|
|
126
|
+
connectionId?: string;
|
|
127
|
+
operation?: string;
|
|
128
|
+
exitCode?: number;
|
|
129
|
+
signal?: string;
|
|
130
|
+
processId?: string;
|
|
131
|
+
appId?: string;
|
|
132
|
+
port?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Map each category to its context type
|
|
136
|
+
*/
|
|
137
|
+
export type CategoryContextMap = {
|
|
138
|
+
[LogCategory.Build]: EmptyLogContext;
|
|
139
|
+
[LogCategory.Function]: FunctionLogContext;
|
|
140
|
+
[LogCategory.Lifecycle]: LifecycleLogContext;
|
|
141
|
+
[LogCategory.Destination]: DestinationLogContext;
|
|
142
|
+
[LogCategory.Source]: SourceLogContext;
|
|
143
|
+
[LogCategory.Jobs]: JobLogContext;
|
|
144
|
+
[LogCategory.Notifications]: NotificationLogContext;
|
|
145
|
+
[LogCategory.KVStore]: StorageLogContext;
|
|
146
|
+
[LogCategory.Settings]: StorageLogContext;
|
|
147
|
+
[LogCategory.Secrets]: StorageLogContext;
|
|
148
|
+
[LogCategory.Config]: StorageLogContext;
|
|
149
|
+
[LogCategory.AppRunner]: ProcessLogContext | IPCLogContext;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Type-safe log entry
|
|
153
|
+
*/
|
|
154
|
+
export type LogEntry<C extends LogCategory = LogCategory> = {
|
|
6
155
|
id: string;
|
|
7
156
|
timestamp: string;
|
|
8
|
-
source:
|
|
9
|
-
|
|
10
|
-
|
|
157
|
+
source: LogSource;
|
|
158
|
+
category: C;
|
|
159
|
+
level: LogLevel;
|
|
11
160
|
message: string;
|
|
12
|
-
|
|
13
|
-
}
|
|
161
|
+
context?: CategoryContextMap[C];
|
|
162
|
+
};
|
|
14
163
|
export declare class LogManager {
|
|
15
164
|
private static instance;
|
|
16
165
|
private logs;
|
|
@@ -22,60 +171,68 @@ export declare class LogManager {
|
|
|
22
171
|
*/
|
|
23
172
|
static getInstance(): LogManager;
|
|
24
173
|
/**
|
|
25
|
-
*
|
|
174
|
+
* Core log method - accepts type-safe log entries
|
|
26
175
|
*/
|
|
27
|
-
log(entry: Omit<LogEntry
|
|
176
|
+
log<C extends LogCategory>(entry: Omit<LogEntry<C>, 'id' | 'timestamp'>): void;
|
|
28
177
|
/**
|
|
29
|
-
* Convenience methods
|
|
178
|
+
* Convenience methods with type-safe contexts
|
|
30
179
|
*/
|
|
31
|
-
debug(source:
|
|
32
|
-
info(source:
|
|
33
|
-
warn(source:
|
|
34
|
-
error(source:
|
|
180
|
+
debug<C extends LogCategory>(source: LogSource, category: C, message: string, context?: CategoryContextMap[C]): void;
|
|
181
|
+
info<C extends LogCategory>(source: LogSource, category: C, message: string, context?: CategoryContextMap[C]): void;
|
|
182
|
+
warn<C extends LogCategory>(source: LogSource, category: C, message: string, context?: CategoryContextMap[C]): void;
|
|
183
|
+
error<C extends LogCategory>(source: LogSource, category: C, message: string, context?: CategoryContextMap[C]): void;
|
|
35
184
|
/**
|
|
36
|
-
*
|
|
185
|
+
* Specialized convenience method for function execution
|
|
37
186
|
*/
|
|
38
|
-
|
|
39
|
-
limit?: number;
|
|
40
|
-
source?: LogEntry['source'];
|
|
41
|
-
level?: LogEntry['level'];
|
|
42
|
-
since?: string;
|
|
43
|
-
category?: string;
|
|
44
|
-
}): LogEntry[];
|
|
187
|
+
logFunctionExecution(functionId: string, status: 'started' | 'success' | 'error', details?: Partial<FunctionLogContext>): void;
|
|
45
188
|
/**
|
|
46
|
-
*
|
|
189
|
+
* Specialized convenience method for lifecycle execution
|
|
47
190
|
*/
|
|
48
|
-
|
|
191
|
+
logLifecycleExecution(hookName: string, status: 'started' | 'success' | 'error', details?: Partial<LifecycleLogContext>): void;
|
|
49
192
|
/**
|
|
50
|
-
*
|
|
193
|
+
* Specialized convenience method for destination execution
|
|
51
194
|
*/
|
|
52
|
-
|
|
195
|
+
logDestinationExecution(destinationId: string, operation: 'ready' | 'deliver' | 'schema', status: 'started' | 'success' | 'error', details?: Partial<DestinationLogContext>): void;
|
|
53
196
|
/**
|
|
54
|
-
*
|
|
197
|
+
* Specialized convenience method for build events
|
|
55
198
|
*/
|
|
56
|
-
|
|
199
|
+
logBuildEvent(status: 'started' | 'success' | 'error', details?: any): void;
|
|
57
200
|
/**
|
|
58
201
|
* Log function output/console logs
|
|
59
202
|
*/
|
|
60
203
|
logFunctionOutput(functionId: string, output: string, isError?: boolean): void;
|
|
61
204
|
/**
|
|
62
|
-
* Log
|
|
205
|
+
* Log build output
|
|
63
206
|
*/
|
|
64
|
-
|
|
207
|
+
logBuildOutput(output: string, isError?: boolean): void;
|
|
65
208
|
/**
|
|
66
|
-
* Log
|
|
209
|
+
* Log source execution events
|
|
67
210
|
*/
|
|
68
|
-
|
|
211
|
+
logSourceExecution(sourceId: string, operation: string, status: 'started' | 'success' | 'error', additionalContext?: any): void;
|
|
69
212
|
/**
|
|
70
|
-
*
|
|
213
|
+
* Get logs with optional filtering
|
|
71
214
|
*/
|
|
72
|
-
|
|
215
|
+
getLogs(options?: {
|
|
216
|
+
limit?: number;
|
|
217
|
+
source?: LogSource;
|
|
218
|
+
level?: LogLevel;
|
|
219
|
+
since?: string;
|
|
220
|
+
category?: LogCategory;
|
|
221
|
+
}): LogEntry[];
|
|
222
|
+
/**
|
|
223
|
+
* Clear all logs
|
|
224
|
+
*/
|
|
225
|
+
clearLogs(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Add a listener for new log entries
|
|
228
|
+
*/
|
|
229
|
+
addListener(listener: (log: LogEntry) => void): () => void;
|
|
73
230
|
/**
|
|
74
231
|
* Generate a unique ID for log entries
|
|
75
232
|
*/
|
|
76
233
|
private generateId;
|
|
77
234
|
/**
|
|
78
|
-
* Log to console with
|
|
235
|
+
* Log to console with new format
|
|
79
236
|
*/
|
|
80
237
|
private logToConsole;
|
|
81
238
|
/**
|