@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.
Files changed (244) hide show
  1. package/README.md +51 -0
  2. package/dist/package.json +112 -0
  3. package/dist/public/bundle.82dc5d29fffb9f205051.js +3 -0
  4. package/dist/public/bundle.82dc5d29fffb9f205051.js.LICENSE.txt +92 -0
  5. package/dist/public/bundle.82dc5d29fffb9f205051.js.map +1 -0
  6. package/dist/public/index.html +1 -0
  7. package/dist/src/cli.d.ts +2 -0
  8. package/dist/src/cli.js +115 -0
  9. package/dist/src/cli.js.map +1 -0
  10. package/dist/src/executor/DestinationExecutor.d.ts +19 -0
  11. package/dist/src/executor/DestinationExecutor.js +72 -0
  12. package/dist/src/executor/DestinationExecutor.js.map +1 -0
  13. package/dist/src/executor/FunctionExecutor.d.ts +67 -0
  14. package/dist/src/executor/FunctionExecutor.js +189 -0
  15. package/dist/src/executor/FunctionExecutor.js.map +1 -0
  16. package/dist/src/executor/JobExecutor.d.ts +79 -0
  17. package/dist/src/executor/JobExecutor.js +215 -0
  18. package/dist/src/executor/JobExecutor.js.map +1 -0
  19. package/dist/src/executor/LifecycleExecutor.d.ts +64 -0
  20. package/dist/src/executor/LifecycleExecutor.js +167 -0
  21. package/dist/src/executor/LifecycleExecutor.js.map +1 -0
  22. package/dist/src/executor/SourceExecutor.d.ts +32 -0
  23. package/dist/src/executor/SourceExecutor.js +163 -0
  24. package/dist/src/executor/SourceExecutor.js.map +1 -0
  25. package/dist/src/executor/watcher.d.ts +62 -0
  26. package/dist/src/executor/watcher.js +213 -0
  27. package/dist/src/executor/watcher.js.map +1 -0
  28. package/dist/src/functions/hello.d.ts +4 -0
  29. package/dist/src/functions/hello.js +8 -0
  30. package/dist/src/functions/hello.js.map +1 -0
  31. package/dist/src/index.d.ts +1 -0
  32. package/dist/src/index.js +9 -0
  33. package/dist/src/index.js.map +1 -0
  34. package/dist/src/jobs/dailyJob.d.ts +4 -0
  35. package/dist/src/jobs/dailyJob.js +8 -0
  36. package/dist/src/jobs/dailyJob.js.map +1 -0
  37. package/dist/src/local_engine/LocalFunctionApi.d.ts +17 -0
  38. package/dist/src/local_engine/LocalFunctionApi.js +54 -0
  39. package/dist/src/local_engine/LocalFunctionApi.js.map +1 -0
  40. package/dist/src/local_engine/LocalJobApi.d.ts +67 -0
  41. package/dist/src/local_engine/LocalJobApi.js +205 -0
  42. package/dist/src/local_engine/LocalJobApi.js.map +1 -0
  43. package/dist/src/local_engine/LocalNotifier.d.ts +9 -0
  44. package/dist/src/local_engine/LocalNotifier.js +26 -0
  45. package/dist/src/local_engine/LocalNotifier.js.map +1 -0
  46. package/dist/src/local_engine/local-engine-child-base.d.ts +110 -0
  47. package/dist/src/local_engine/local-engine-child-base.js +607 -0
  48. package/dist/src/local_engine/local-engine-child-base.js.map +1 -0
  49. package/dist/src/local_engine/local-engine-client.d.ts +161 -0
  50. package/dist/src/local_engine/local-engine-client.js +888 -0
  51. package/dist/src/local_engine/local-engine-client.js.map +1 -0
  52. package/dist/src/local_engine/local-engine-types.d.ts +245 -0
  53. package/dist/src/local_engine/local-engine-types.js +6 -0
  54. package/dist/src/local_engine/local-engine-types.js.map +1 -0
  55. package/dist/src/local_engine/local-engine-unified.d.ts +71 -0
  56. package/dist/src/local_engine/local-engine-unified.js +723 -0
  57. package/dist/src/local_engine/local-engine-unified.js.map +1 -0
  58. package/dist/src/local_engine/local-engine-utils.d.ts +68 -0
  59. package/dist/src/local_engine/local-engine-utils.js +219 -0
  60. package/dist/src/local_engine/local-engine-utils.js.map +1 -0
  61. package/dist/src/local_engine/localSDKConfig.d.ts +40 -0
  62. package/dist/src/local_engine/localSDKConfig.js +247 -0
  63. package/dist/src/local_engine/localSDKConfig.js.map +1 -0
  64. package/dist/src/local_engine/storage/BaseKVStoreWrapper.d.ts +37 -0
  65. package/dist/src/local_engine/storage/BaseKVStoreWrapper.js +110 -0
  66. package/dist/src/local_engine/storage/BaseKVStoreWrapper.js.map +1 -0
  67. package/dist/src/local_engine/storage/LocalConfigStore.d.ts +74 -0
  68. package/dist/src/local_engine/storage/LocalConfigStore.js +178 -0
  69. package/dist/src/local_engine/storage/LocalConfigStore.js.map +1 -0
  70. package/dist/src/local_engine/storage/LocalJobStore.d.ts +111 -0
  71. package/dist/src/local_engine/storage/LocalJobStore.js +249 -0
  72. package/dist/src/local_engine/storage/LocalJobStore.js.map +1 -0
  73. package/dist/src/local_engine/storage/LocalKVStore.d.ts +106 -0
  74. package/dist/src/local_engine/storage/LocalKVStore.js +1061 -0
  75. package/dist/src/local_engine/storage/LocalKVStore.js.map +1 -0
  76. package/dist/src/local_engine/storage/LocalNotificationStore.d.ts +28 -0
  77. package/dist/src/local_engine/storage/LocalNotificationStore.js +149 -0
  78. package/dist/src/local_engine/storage/LocalNotificationStore.js.map +1 -0
  79. package/dist/src/local_engine/storage/LocalSecretsStore.d.ts +115 -0
  80. package/dist/src/local_engine/storage/LocalSecretsStore.js +350 -0
  81. package/dist/src/local_engine/storage/LocalSecretsStore.js.map +1 -0
  82. package/dist/src/local_engine/storage/LocalSecretsStoreWrapper.d.ts +19 -0
  83. package/dist/src/local_engine/storage/LocalSecretsStoreWrapper.js +52 -0
  84. package/dist/src/local_engine/storage/LocalSecretsStoreWrapper.js.map +1 -0
  85. package/dist/src/local_engine/storage/LocalSettingsStore.d.ts +168 -0
  86. package/dist/src/local_engine/storage/LocalSettingsStore.js +509 -0
  87. package/dist/src/local_engine/storage/LocalSettingsStore.js.map +1 -0
  88. package/dist/src/local_engine/storage/LocalSettingsStoreWrapper.d.ts +15 -0
  89. package/dist/src/local_engine/storage/LocalSettingsStoreWrapper.js +28 -0
  90. package/dist/src/local_engine/storage/LocalSettingsStoreWrapper.js.map +1 -0
  91. package/dist/src/local_engine/storage/NumberSet.d.ts +21 -0
  92. package/dist/src/local_engine/storage/NumberSet.js +32 -0
  93. package/dist/src/local_engine/storage/NumberSet.js.map +1 -0
  94. package/dist/src/local_engine/storage/SourceDataStore.d.ts +23 -0
  95. package/dist/src/local_engine/storage/SourceDataStore.js +83 -0
  96. package/dist/src/local_engine/storage/SourceDataStore.js.map +1 -0
  97. package/dist/src/local_engine/storage/SourceJobExecutionStore.d.ts +25 -0
  98. package/dist/src/local_engine/storage/SourceJobExecutionStore.js +61 -0
  99. package/dist/src/local_engine/storage/SourceJobExecutionStore.js.map +1 -0
  100. package/dist/src/local_engine/storage/StringSet.d.ts +21 -0
  101. package/dist/src/local_engine/storage/StringSet.js +32 -0
  102. package/dist/src/local_engine/storage/StringSet.js.map +1 -0
  103. package/dist/src/local_engine/types.d.ts +53 -0
  104. package/dist/src/local_engine/types.js +6 -0
  105. package/dist/src/local_engine/types.js.map +1 -0
  106. package/dist/src/local_engine/utils.d.ts +33 -0
  107. package/dist/src/local_engine/utils.js +143 -0
  108. package/dist/src/local_engine/utils.js.map +1 -0
  109. package/dist/src/logging/LogManager.d.ts +246 -0
  110. package/dist/src/logging/LogManager.js +343 -0
  111. package/dist/src/logging/LogManager.js.map +1 -0
  112. package/dist/src/server/api/destinations.d.ts +7 -0
  113. package/dist/src/server/api/destinations.js +170 -0
  114. package/dist/src/server/api/destinations.js.map +1 -0
  115. package/dist/src/server/api/functions.d.ts +7 -0
  116. package/dist/src/server/api/functions.js +80 -0
  117. package/dist/src/server/api/functions.js.map +1 -0
  118. package/dist/src/server/api/jobs.d.ts +10 -0
  119. package/dist/src/server/api/jobs.js +244 -0
  120. package/dist/src/server/api/jobs.js.map +1 -0
  121. package/dist/src/server/api/settings.d.ts +6 -0
  122. package/dist/src/server/api/settings.js +116 -0
  123. package/dist/src/server/api/settings.js.map +1 -0
  124. package/dist/src/server/api/sources.d.ts +7 -0
  125. package/dist/src/server/api/sources.js +382 -0
  126. package/dist/src/server/api/sources.js.map +1 -0
  127. package/dist/src/server/api/stores.d.ts +2 -0
  128. package/dist/src/server/api/stores.js +341 -0
  129. package/dist/src/server/api/stores.js.map +1 -0
  130. package/dist/src/server/api/v1.d.ts +10 -0
  131. package/dist/src/server/api/v1.js +718 -0
  132. package/dist/src/server/api/v1.js.map +1 -0
  133. package/dist/src/server/api.d.ts +8 -0
  134. package/dist/src/server/api.js +217 -0
  135. package/dist/src/server/api.js.map +1 -0
  136. package/dist/src/server/app-discovery.d.ts +5 -0
  137. package/dist/src/server/app-discovery.js +113 -0
  138. package/dist/src/server/app-discovery.js.map +1 -0
  139. package/dist/src/server/config.d.ts +26 -0
  140. package/dist/src/server/config.js +112 -0
  141. package/dist/src/server/config.js.map +1 -0
  142. package/dist/src/server/mockDataGenerator.d.ts +1 -0
  143. package/dist/src/server/mockDataGenerator.js +154 -0
  144. package/dist/src/server/mockDataGenerator.js.map +1 -0
  145. package/dist/src/server/websocket.d.ts +0 -0
  146. package/dist/src/server/websocket.js +2 -0
  147. package/dist/src/server/websocket.js.map +1 -0
  148. package/dist/src/server.d.ts +2 -0
  149. package/dist/src/server.js +735 -0
  150. package/dist/src/server.js.map +1 -0
  151. package/dist/src/types/app.d.ts +154 -0
  152. package/dist/src/types/app.js +24 -0
  153. package/dist/src/types/app.js.map +1 -0
  154. package/dist/src/types/kvstore.d.ts +320 -0
  155. package/dist/src/types/kvstore.js +5 -0
  156. package/dist/src/types/kvstore.js.map +1 -0
  157. package/dist/src/ui/components/App.d.ts +6 -0
  158. package/dist/src/ui/components/App.js +432 -0
  159. package/dist/src/ui/components/App.js.map +1 -0
  160. package/dist/src/ui/components/DestinationBatchEditor.d.ts +7 -0
  161. package/dist/src/ui/components/DestinationBatchEditor.js +160 -0
  162. package/dist/src/ui/components/DestinationBatchEditor.js.map +1 -0
  163. package/dist/src/ui/components/DestinationSchemaViewer.d.ts +7 -0
  164. package/dist/src/ui/components/DestinationSchemaViewer.js +61 -0
  165. package/dist/src/ui/components/DestinationSchemaViewer.js.map +1 -0
  166. package/dist/src/ui/components/DestinationsView.d.ts +14 -0
  167. package/dist/src/ui/components/DestinationsView.js +68 -0
  168. package/dist/src/ui/components/DestinationsView.js.map +1 -0
  169. package/dist/src/ui/components/FunctionsView.d.ts +13 -0
  170. package/dist/src/ui/components/FunctionsView.js +288 -0
  171. package/dist/src/ui/components/FunctionsView.js.map +1 -0
  172. package/dist/src/ui/components/JobsView.d.ts +13 -0
  173. package/dist/src/ui/components/JobsView.js +320 -0
  174. package/dist/src/ui/components/JobsView.js.map +1 -0
  175. package/dist/src/ui/components/KVStoreViewer.d.ts +11 -0
  176. package/dist/src/ui/components/KVStoreViewer.js +168 -0
  177. package/dist/src/ui/components/KVStoreViewer.js.map +1 -0
  178. package/dist/src/ui/components/MetadataModal.d.ts +14 -0
  179. package/dist/src/ui/components/MetadataModal.js +28 -0
  180. package/dist/src/ui/components/MetadataModal.js.map +1 -0
  181. package/dist/src/ui/components/MetadataModal.test.d.ts +1 -0
  182. package/dist/src/ui/components/MetadataModal.test.js +143 -0
  183. package/dist/src/ui/components/MetadataModal.test.js.map +1 -0
  184. package/dist/src/ui/components/NotificationViewer.d.ts +16 -0
  185. package/dist/src/ui/components/NotificationViewer.js +69 -0
  186. package/dist/src/ui/components/NotificationViewer.js.map +1 -0
  187. package/dist/src/ui/components/SecretsStoreViewer.d.ts +11 -0
  188. package/dist/src/ui/components/SecretsStoreViewer.js +179 -0
  189. package/dist/src/ui/components/SecretsStoreViewer.js.map +1 -0
  190. package/dist/src/ui/components/SettingsStoreViewer.d.ts +24 -0
  191. package/dist/src/ui/components/SettingsStoreViewer.js +132 -0
  192. package/dist/src/ui/components/SettingsStoreViewer.js.map +1 -0
  193. package/dist/src/ui/components/SourceDataViewer.d.ts +8 -0
  194. package/dist/src/ui/components/SourceDataViewer.js +84 -0
  195. package/dist/src/ui/components/SourceDataViewer.js.map +1 -0
  196. package/dist/src/ui/components/SourceJobsSection.d.ts +8 -0
  197. package/dist/src/ui/components/SourceJobsSection.js +99 -0
  198. package/dist/src/ui/components/SourceJobsSection.js.map +1 -0
  199. package/dist/src/ui/components/SourceLifecycleSection.d.ts +7 -0
  200. package/dist/src/ui/components/SourceLifecycleSection.js +58 -0
  201. package/dist/src/ui/components/SourceLifecycleSection.js.map +1 -0
  202. package/dist/src/ui/components/SourceSchemaViewer.d.ts +7 -0
  203. package/dist/src/ui/components/SourceSchemaViewer.js +65 -0
  204. package/dist/src/ui/components/SourceSchemaViewer.js.map +1 -0
  205. package/dist/src/ui/components/SourceWebhookEditor.d.ts +8 -0
  206. package/dist/src/ui/components/SourceWebhookEditor.js +181 -0
  207. package/dist/src/ui/components/SourceWebhookEditor.js.map +1 -0
  208. package/dist/src/ui/components/SourcesView.d.ts +14 -0
  209. package/dist/src/ui/components/SourcesView.js +74 -0
  210. package/dist/src/ui/components/SourcesView.js.map +1 -0
  211. package/dist/src/ui/components/StoreViewer.d.ts +16 -0
  212. package/dist/src/ui/components/StoreViewer.js +86 -0
  213. package/dist/src/ui/components/StoreViewer.js.map +1 -0
  214. package/dist/src/ui/components/TabbedConsole.d.ts +17 -0
  215. package/dist/src/ui/components/TabbedConsole.js +163 -0
  216. package/dist/src/ui/components/TabbedConsole.js.map +1 -0
  217. package/dist/src/ui/components/common/DataTree.d.ts +15 -0
  218. package/dist/src/ui/components/common/DataTree.js +95 -0
  219. package/dist/src/ui/components/common/DataTree.js.map +1 -0
  220. package/dist/src/ui/components/common/EyeIcon.d.ts +11 -0
  221. package/dist/src/ui/components/common/EyeIcon.js +11 -0
  222. package/dist/src/ui/components/common/EyeIcon.js.map +1 -0
  223. package/dist/src/ui/hooks/useEntityNavigation.d.ts +72 -0
  224. package/dist/src/ui/hooks/useEntityNavigation.js +150 -0
  225. package/dist/src/ui/hooks/useEntityNavigation.js.map +1 -0
  226. package/dist/src/ui/hooks/useQueryParams.d.ts +6 -0
  227. package/dist/src/ui/hooks/useQueryParams.js +39 -0
  228. package/dist/src/ui/hooks/useQueryParams.js.map +1 -0
  229. package/dist/src/ui/index.d.ts +1 -0
  230. package/dist/src/ui/index.js +23 -0
  231. package/dist/src/ui/index.js.map +1 -0
  232. package/dist/src/ui/store/formStateSlice.d.ts +54 -0
  233. package/dist/src/ui/store/formStateSlice.js +94 -0
  234. package/dist/src/ui/store/formStateSlice.js.map +1 -0
  235. package/dist/src/ui/store/hooks.d.ts +6 -0
  236. package/dist/src/ui/store/hooks.js +8 -0
  237. package/dist/src/ui/store/hooks.js.map +1 -0
  238. package/dist/src/ui/store/index.d.ts +11 -0
  239. package/dist/src/ui/store/index.js +107 -0
  240. package/dist/src/ui/store/index.js.map +1 -0
  241. package/dist/src/utils/functionEndpoints.d.ts +24 -0
  242. package/dist/src/utils/functionEndpoints.js +45 -0
  243. package/dist/src/utils/functionEndpoints.js.map +1 -0
  244. package/package.json +112 -0
@@ -0,0 +1,37 @@
1
+ import { LogManager, LogCategory } from '../../logging/LogManager';
2
+ /**
3
+ * Abstract base class for KV store wrappers that adapt local stores to BaseKVStore interface.
4
+ * Eliminates code duplication between LocalSettingsStoreWrapper and LocalSecretsStoreWrapper.
5
+ */
6
+ export declare abstract class BaseKVStoreWrapper {
7
+ protected logManager: LogManager;
8
+ /** Name of the store for logging purposes */
9
+ protected abstract readonly storeName: string;
10
+ /** Log category to use for this store */
11
+ protected abstract readonly logCategory: LogCategory;
12
+ /**
13
+ * Get all data for a section/key
14
+ */
15
+ protected abstract getSectionData(key: string): Record<string, any>;
16
+ /**
17
+ * Update/replace data for a section/key
18
+ */
19
+ protected abstract updateSectionData(key: string, value: any): void;
20
+ /**
21
+ * Check if a section/key has data
22
+ */
23
+ protected abstract hasSectionData(key: string): boolean;
24
+ /**
25
+ * Filter an object to only include specified fields
26
+ */
27
+ private filterFields;
28
+ /**
29
+ * Create log metadata object with proper typing
30
+ */
31
+ private logMeta;
32
+ get(key: string, fields?: string[]): Promise<any>;
33
+ put(key: string, value: any): Promise<true>;
34
+ patch(key: string, value: any): Promise<any>;
35
+ delete(key: string, fields?: string[]): Promise<true>;
36
+ exists(key: string): Promise<boolean>;
37
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseKVStoreWrapper = void 0;
4
+ const LogManager_1 = require("../../logging/LogManager");
5
+ /**
6
+ * Abstract base class for KV store wrappers that adapt local stores to BaseKVStore interface.
7
+ * Eliminates code duplication between LocalSettingsStoreWrapper and LocalSecretsStoreWrapper.
8
+ */
9
+ class BaseKVStoreWrapper {
10
+ constructor() {
11
+ this.logManager = LogManager_1.LogManager.getInstance();
12
+ }
13
+ /**
14
+ * Filter an object to only include specified fields
15
+ */
16
+ filterFields(data, fields) {
17
+ const result = {};
18
+ for (const field of fields) {
19
+ if (data[field] !== undefined) {
20
+ result[field] = data[field];
21
+ }
22
+ }
23
+ return result;
24
+ }
25
+ /**
26
+ * Create log metadata object with proper typing
27
+ */
28
+ logMeta(key, operation) {
29
+ return {
30
+ id: key || 'unknown',
31
+ store: this.storeName,
32
+ operation,
33
+ key
34
+ };
35
+ }
36
+ async get(key, fields) {
37
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `GET: key="${key}"`, this.logMeta(key, 'get'));
38
+ try {
39
+ const data = this.getSectionData(key);
40
+ const result = fields?.length ? this.filterFields(data, fields) : data;
41
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `GET result: key="${key}"`, this.logMeta(key, 'get'));
42
+ return result;
43
+ }
44
+ catch (error) {
45
+ this.logManager.error(LogManager_1.LogSource.System, this.logCategory, `GET failed: key="${key}"`, { ...this.logMeta(key, 'get'), error });
46
+ return {};
47
+ }
48
+ }
49
+ async put(key, value) {
50
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `PUT: key="${key}"`, this.logMeta(key, 'set'));
51
+ try {
52
+ this.updateSectionData(key, value);
53
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `PUT completed: key="${key}"`, this.logMeta(key, 'set'));
54
+ return true;
55
+ }
56
+ catch (error) {
57
+ this.logManager.error(LogManager_1.LogSource.System, this.logCategory, `PUT failed: key="${key}"`, { ...this.logMeta(key, 'set'), error });
58
+ return true;
59
+ }
60
+ }
61
+ async patch(key, value) {
62
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `PATCH: key="${key}"`, this.logMeta(key, 'set'));
63
+ try {
64
+ const currentData = this.getSectionData(key);
65
+ this.updateSectionData(key, value);
66
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `PATCH completed: key="${key}"`, this.logMeta(key, 'set'));
67
+ return currentData;
68
+ }
69
+ catch (error) {
70
+ this.logManager.error(LogManager_1.LogSource.System, this.logCategory, `PATCH failed: key="${key}"`, { ...this.logMeta(key, 'set'), error });
71
+ return {};
72
+ }
73
+ }
74
+ async delete(key, fields) {
75
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `DELETE: key="${key}", fields=${JSON.stringify(fields)}`, this.logMeta(key, 'delete'));
76
+ try {
77
+ if (fields?.length) {
78
+ const currentData = this.getSectionData(key);
79
+ for (const field of fields) {
80
+ delete currentData[field];
81
+ }
82
+ this.updateSectionData(key, currentData);
83
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `DELETE completed: removed fields from "${key}"`, this.logMeta(key, 'delete'));
84
+ }
85
+ else {
86
+ this.updateSectionData(key, {});
87
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `DELETE completed: cleared "${key}"`, this.logMeta(key, 'clear'));
88
+ }
89
+ return true;
90
+ }
91
+ catch (error) {
92
+ this.logManager.error(LogManager_1.LogSource.System, this.logCategory, `DELETE failed: key="${key}"`, { ...this.logMeta(key, 'delete'), error });
93
+ return true;
94
+ }
95
+ }
96
+ async exists(key) {
97
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `EXISTS: key="${key}"`, this.logMeta(key, 'exists'));
98
+ try {
99
+ const exists = this.hasSectionData(key);
100
+ this.logManager.debug(LogManager_1.LogSource.System, this.logCategory, `EXISTS result: key="${key}" -> ${exists}`, this.logMeta(key, 'exists'));
101
+ return exists;
102
+ }
103
+ catch (error) {
104
+ this.logManager.error(LogManager_1.LogSource.System, this.logCategory, `EXISTS failed: key="${key}"`, { ...this.logMeta(key, 'exists'), error });
105
+ return false;
106
+ }
107
+ }
108
+ }
109
+ exports.BaseKVStoreWrapper = BaseKVStoreWrapper;
110
+ //# sourceMappingURL=BaseKVStoreWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseKVStoreWrapper.js","sourceRoot":"","sources":["../../../../src/local_engine/storage/BaseKVStoreWrapper.ts"],"names":[],"mappings":";;;AAAA,yDAAiG;AAIjG;;;GAGG;AACH,MAAsB,kBAAkB;IAAxC;QACY,eAAU,GAAG,uBAAU,CAAC,WAAW,EAAE,CAAC;IAsHlD,CAAC;IA/FC;;OAEG;IACK,YAAY,CAAC,IAAyB,EAAE,MAAgB;QAC9D,MAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,OAAO,CAAC,GAAW,EAAE,SAA2B;QACtD,OAAO;YACL,EAAE,EAAE,GAAG,IAAI,SAAS;YACpB,KAAK,EAAE,IAAI,CAAC,SAAS;YACrB,SAAS;YACT,GAAG;SACJ,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,MAAiB;QACtC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sBAAS,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QACzG,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YACtC,MAAM,MAAM,GAAG,MAAM,EA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AC,sBAAS,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,gBAAgB,GAAG,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/G,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sBAAS,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,uBAAuB,GAAG,QAAQ,MAAM,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnI,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,sBAAS,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,uBAAuB,GAAG,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACpI,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAvHD,gDAuHC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Configuration interface for local app state
3
+ */
4
+ export interface LocalAppConfig {
5
+ isInstalled: boolean;
6
+ functionGuids?: Record<string, string>;
7
+ sourceGuids?: Record<string, string>;
8
+ }
9
+ /**
10
+ * Local configuration store that manages app state in .ocp-local/config.json
11
+ */
12
+ export declare class LocalConfigStore {
13
+ private logManager;
14
+ private configPath;
15
+ private configDirPath;
16
+ private config;
17
+ constructor(appRootDir: string);
18
+ /**
19
+ * Load configuration from disk or create default if not exists
20
+ */
21
+ private loadConfig;
22
+ /**
23
+ * Save configuration to disk
24
+ */
25
+ private saveConfigToDisk;
26
+ /**
27
+ * Get the current configuration
28
+ */
29
+ getConfig(): LocalAppConfig;
30
+ /**
31
+ * Get the installation status
32
+ */
33
+ isInstalled(): boolean;
34
+ /**
35
+ * Set the installation status
36
+ */
37
+ setInstalled(isInstalled: boolean): void;
38
+ /**
39
+ * Update the entire configuration
40
+ */
41
+ updateConfig(newConfig: Partial<LocalAppConfig>): void;
42
+ /**
43
+ * Reset configuration to defaults
44
+ */
45
+ resetConfig(): void;
46
+ /**
47
+ * Get or generate a GUID for a function
48
+ */
49
+ getFunctionGuid(functionName: string): string;
50
+ /**
51
+ * Get all function GUIDs
52
+ */
53
+ getAllFunctionGuids(): Record<string, string>;
54
+ /**
55
+ * Clear all function GUIDs (useful on uninstall)
56
+ */
57
+ clearFunctionGuids(): void;
58
+ /**
59
+ * Get or generate a GUID for a source
60
+ */
61
+ getSourceGuid(sourceId: string): string;
62
+ /**
63
+ * Set a GUID for a source
64
+ */
65
+ setSourceGuid(sourceId: string, guid: string): void;
66
+ /**
67
+ * Get all source GUIDs
68
+ */
69
+ getAllSourceGuids(): Record<string, string>;
70
+ /**
71
+ * Clear all source GUIDs (useful on uninstall)
72
+ */
73
+ clearSourceGuids(): void;
74
+ }
@@ -0,0 +1,178 @@
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.LocalConfigStore = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const crypto_1 = require("crypto");
10
+ const LogManager_1 = require("../../logging/LogManager");
11
+ /**
12
+ * Default configuration values
13
+ */
14
+ const DEFAULT_CONFIG = {
15
+ isInstalled: false,
16
+ functionGuids: {},
17
+ sourceGuids: {}
18
+ };
19
+ /**
20
+ * Local configuration store that manages app state in .ocp-local/config.json
21
+ */
22
+ class LocalConfigStore {
23
+ constructor(appRootDir) {
24
+ this.logManager = LogManager_1.LogManager.getInstance();
25
+ this.configDirPath = path_1.default.join(appRootDir, '.ocp-local');
26
+ this.configPath = path_1.default.join(this.configDirPath, 'config.json');
27
+ this.config = this.loadConfig();
28
+ }
29
+ /**
30
+ * Load configuration from disk or create default if not exists
31
+ */
32
+ loadConfig() {
33
+ try {
34
+ // Ensure the .ocp-local directory exists
35
+ if (!fs_1.default.existsSync(this.configDirPath)) {
36
+ fs_1.default.mkdirSync(this.configDirPath, { recursive: true });
37
+ }
38
+ // Load existing config if file exists
39
+ if (fs_1.default.existsSync(this.configPath)) {
40
+ const configData = fs_1.default.readFileSync(this.configPath, 'utf-8');
41
+ const parsedConfig = JSON.parse(configData);
42
+ // Merge with defaults to ensure all required properties exist
43
+ return { ...DEFAULT_CONFIG, ...parsedConfig };
44
+ }
45
+ // Create default config file
46
+ this.saveConfigToDisk(DEFAULT_CONFIG);
47
+ return { ...DEFAULT_CONFIG };
48
+ }
49
+ catch (error) {
50
+ this.logManager.warn(LogManager_1.LogSource.System, LogManager_1.LogCategory.Config, `Failed to load config from ${this.configPath}, using defaults`, {
51
+ id: 'config',
52
+ store: 'LocalConfigStore',
53
+ operation: 'get',
54
+ error
55
+ });
56
+ return { ...DEFAULT_CONFIG };
57
+ }
58
+ }
59
+ /**
60
+ * Save configuration to disk
61
+ */
62
+ saveConfigToDisk(config) {
63
+ try {
64
+ // Ensure the .ocp-local directory exists
65
+ if (!fs_1.default.existsSync(this.configDirPath)) {
66
+ fs_1.default.mkdirSync(this.configDirPath, { recursive: true });
67
+ }
68
+ // Write config to file
69
+ fs_1.default.writeFileSync(this.configPath, JSON.stringify(config, null, 2), 'utf-8');
70
+ }
71
+ catch (error) {
72
+ this.logManager.error(LogManager_1.LogSource.System, LogManager_1.LogCategory.Config, `Failed to save config to ${this.configPath}`, {
73
+ id: 'config',
74
+ store: 'LocalConfigStore',
75
+ operation: 'set',
76
+ error
77
+ });
78
+ throw error;
79
+ }
80
+ }
81
+ /**
82
+ * Get the current configuration
83
+ */
84
+ getConfig() {
85
+ return { ...this.config };
86
+ }
87
+ /**
88
+ * Get the installation status
89
+ */
90
+ isInstalled() {
91
+ return this.config.isInstalled;
92
+ }
93
+ /**
94
+ * Set the installation status
95
+ */
96
+ setInstalled(isInstalled) {
97
+ this.config.isInstalled = isInstalled;
98
+ this.saveConfigToDisk(this.config);
99
+ }
100
+ /**
101
+ * Update the entire configuration
102
+ */
103
+ updateConfig(newConfig) {
104
+ this.config = { ...this.config, ...newConfig };
105
+ this.saveConfigToDisk(this.config);
106
+ }
107
+ /**
108
+ * Reset configuration to defaults
109
+ */
110
+ resetConfig() {
111
+ this.config = { ...DEFAULT_CONFIG };
112
+ this.saveConfigToDisk(this.config);
113
+ }
114
+ /**
115
+ * Get or generate a GUID for a function
116
+ */
117
+ getFunctionGuid(functionName) {
118
+ if (!this.config.functionGuids) {
119
+ this.config.functionGuids = {};
120
+ }
121
+ if (!this.config.functionGuids[functionName]) {
122
+ this.config.functionGuids[functionName] = (0, crypto_1.randomUUID)();
123
+ this.saveConfigToDisk(this.config);
124
+ }
125
+ return this.config.functionGuids[functionName];
126
+ }
127
+ /**
128
+ * Get all function GUIDs
129
+ */
130
+ getAllFunctionGuids() {
131
+ return { ...(this.config.functionGuids || {}) };
132
+ }
133
+ /**
134
+ * Clear all function GUIDs (useful on uninstall)
135
+ */
136
+ clearFunctionGuids() {
137
+ this.config.functionGuids = {};
138
+ this.saveConfigToDisk(this.config);
139
+ }
140
+ /**
141
+ * Get or generate a GUID for a source
142
+ */
143
+ getSourceGuid(sourceId) {
144
+ if (!this.config.sourceGuids) {
145
+ this.config.sourceGuids = {};
146
+ }
147
+ if (!this.config.sourceGuids[sourceId]) {
148
+ this.config.sourceGuids[sourceId] = (0, crypto_1.randomUUID)();
149
+ this.saveConfigToDisk(this.config);
150
+ }
151
+ return this.config.sourceGuids[sourceId];
152
+ }
153
+ /**
154
+ * Set a GUID for a source
155
+ */
156
+ setSourceGuid(sourceId, guid) {
157
+ if (!this.config.sourceGuids) {
158
+ this.config.sourceGuids = {};
159
+ }
160
+ this.config.sourceGuids[sourceId] = guid;
161
+ this.saveConfigToDisk(this.config);
162
+ }
163
+ /**
164
+ * Get all source GUIDs
165
+ */
166
+ getAllSourceGuids() {
167
+ return { ...(this.config.sourceGuids || {}) };
168
+ }
169
+ /**
170
+ * Clear all source GUIDs (useful on uninstall)
171
+ */
172
+ clearSourceGuids() {
173
+ this.config.sourceGuids = {};
174
+ this.saveConfigToDisk(this.config);
175
+ }
176
+ }
177
+ exports.LocalConfigStore = LocalConfigStore;
178
+ //# sourceMappingURL=LocalConfigStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalConfigStore.js","sourceRoot":"","sources":["../../../../src/local_engine/storage/LocalConfigStore.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,mCAAoC;AACpC,yDAA8E;AAW9E;;GAEG;AACH,MAAM,cAAc,GAAmB;IACrC,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,EAAE;IACjB,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF;;GAEG;AACH,MAAa,gBAAgB;IAM3B,YAAY,UAAkB;QALtB,eAAU,GAAG,uBAAU,CAAC,WAAW,EAAE,CAAC;QAM5C,IAAI,CAAC,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IAED;;OAEG;IACK,UAAU;QAChB,IAAI,CAAC;YACH,yCAAyC;YACzC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;gBACvC,YAAE,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACxD,CAAC;YAED,sCAAsC;YACtC,IAAI,YAAE,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C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF;AAlLD,4CAkLC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Job execution status enum
3
+ */
4
+ export declare enum JobExecutionStatus {
5
+ PENDING = "pending",
6
+ RUNNING = "running",
7
+ COMPLETED = "completed",
8
+ FAILED = "failed",
9
+ INTERRUPTED = "interrupted"
10
+ }
11
+ /**
12
+ * Job execution record
13
+ */
14
+ export interface JobExecution {
15
+ id: string;
16
+ jobId: string;
17
+ status: JobExecutionStatus;
18
+ startedAt: Date;
19
+ completedAt?: Date;
20
+ parameters: Record<string, any>;
21
+ error?: {
22
+ message: string;
23
+ stack?: string;
24
+ };
25
+ executionTime?: number;
26
+ stateCount: number;
27
+ }
28
+ /**
29
+ * Job state snapshot
30
+ */
31
+ export interface JobStateSnapshot {
32
+ id: string;
33
+ executionId: string;
34
+ timestamp: Date;
35
+ state: Record<string, any>;
36
+ complete: boolean;
37
+ stateHash: string;
38
+ phase: 'prepare' | 'perform';
39
+ }
40
+ /**
41
+ * Local storage for job executions and state history
42
+ */
43
+ export declare class LocalJobStore {
44
+ private appDir;
45
+ private logManager;
46
+ private static instances;
47
+ private jobsDir;
48
+ private executionsDir;
49
+ private statesDir;
50
+ private constructor();
51
+ /**
52
+ * Get singleton instance for the given app directory
53
+ */
54
+ static getInstance(appDir: string): LocalJobStore;
55
+ /**
56
+ * Ensure required directories exist
57
+ */
58
+ private ensureDirectories;
59
+ /**
60
+ * Create a new job execution record
61
+ */
62
+ createExecution(jobId: string, parameters?: Record<string, any>): JobExecution;
63
+ /**
64
+ * Update job execution status
65
+ */
66
+ updateExecutionStatus(executionId: string, status: JobExecutionStatus, error?: {
67
+ message: string;
68
+ stack?: string;
69
+ }): void;
70
+ /**
71
+ * Save job state snapshot
72
+ */
73
+ saveState(executionId: string, state: Record<string, any>, complete: boolean, stateHash: string, phase: 'prepare' | 'perform'): JobStateSnapshot;
74
+ /**
75
+ * Get job execution by ID
76
+ */
77
+ getExecution(executionId: string): JobExecution | null;
78
+ /**
79
+ * Get all executions, optionally filtered by job ID
80
+ */
81
+ getExecutions(jobId?: string): JobExecution[];
82
+ /**
83
+ * Get state snapshots for an execution
84
+ */
85
+ getExecutionStates(executionId: string): JobStateSnapshot[];
86
+ /**
87
+ * Get latest state for an execution
88
+ */
89
+ getLatestState(executionId: string): JobStateSnapshot | null;
90
+ /**
91
+ * Save execution to disk
92
+ */
93
+ private saveExecution;
94
+ /**
95
+ * Clean up old executions (7 days retention)
96
+ */
97
+ cleanup(): void;
98
+ /**
99
+ * Delete execution and its states
100
+ */
101
+ private deleteExecution;
102
+ /**
103
+ * Get summary statistics
104
+ */
105
+ getStats(): {
106
+ totalExecutions: number;
107
+ runningExecutions: number;
108
+ completedExecutions: number;
109
+ failedExecutions: number;
110
+ };
111
+ }