@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,23 @@
|
|
|
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
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const client_1 = require("react-dom/client");
|
|
9
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
10
|
+
const react_redux_1 = require("react-redux");
|
|
11
|
+
const store_1 = require("./store");
|
|
12
|
+
const App_1 = __importDefault(require("./components/App"));
|
|
13
|
+
require("./styles.css");
|
|
14
|
+
// Find the root element
|
|
15
|
+
const rootElement = document.getElementById('root');
|
|
16
|
+
if (!rootElement) {
|
|
17
|
+
throw new Error('Could not find root element');
|
|
18
|
+
}
|
|
19
|
+
// Create a React root
|
|
20
|
+
const root = (0, client_1.createRoot)(rootElement);
|
|
21
|
+
// Render the app with Redux Provider and BrowserRouter
|
|
22
|
+
root.render((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(react_redux_1.Provider, { store: store_1.store, children: (0, jsx_runtime_1.jsx)(react_router_dom_1.BrowserRouter, { children: (0, jsx_runtime_1.jsx)(App_1.default, {}) }) }) }));
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6CAA8C;AAC9C,uDAAiD;AACjD,6CAAuC;AACvC,mCAAgC;AAChC,2DAAmC;AACnC,wBAAsB;AAEtB,wBAAwB;AACxB,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAEpD,IAAI,CAAC,WAAW,EAAE,CAAC;IACjB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;AACjD,CAAC;AAED,sBAAsB;AACtB,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;AAErC,uDAAuD;AACvD,IAAI,CAAC,MAAM,CACT,uBAAC,eAAK,CAAC,UAAU,cACf,uBAAC,sBAAQ,IAAC,KAAK,EAAE,aAAK,YACpB,uBAAC,gCAAa,cACZ,uBAAC,aAAG,KAAG,GACO,GACP,GACM,CACpB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface KeyValuePair {
|
|
2
|
+
key: string;
|
|
3
|
+
value: string;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface FunctionFormState {
|
|
7
|
+
httpMethod: string;
|
|
8
|
+
requestUrl: string;
|
|
9
|
+
params: KeyValuePair[];
|
|
10
|
+
headers: KeyValuePair[];
|
|
11
|
+
requestBody: string;
|
|
12
|
+
}
|
|
13
|
+
export interface JobFormState {
|
|
14
|
+
params: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DestinationFormState {
|
|
17
|
+
batchJson: string;
|
|
18
|
+
attempt: string;
|
|
19
|
+
syncId: string;
|
|
20
|
+
syncName: string;
|
|
21
|
+
}
|
|
22
|
+
export interface SourceFormState {
|
|
23
|
+
webhookHttpMethod: string;
|
|
24
|
+
webhookUrl: string;
|
|
25
|
+
webhookBody: string;
|
|
26
|
+
webhookParams: KeyValuePair[];
|
|
27
|
+
webhookHeaders: KeyValuePair[];
|
|
28
|
+
}
|
|
29
|
+
export interface FormState {
|
|
30
|
+
appName: string;
|
|
31
|
+
functions: Record<string, FunctionFormState>;
|
|
32
|
+
jobs: Record<string, JobFormState>;
|
|
33
|
+
destinations: Record<string, DestinationFormState>;
|
|
34
|
+
sources: Record<string, SourceFormState>;
|
|
35
|
+
}
|
|
36
|
+
export declare const getDefaultFunctionFormState: () => FunctionFormState;
|
|
37
|
+
export declare const getDefaultJobFormState: () => JobFormState;
|
|
38
|
+
export declare const getDefaultDestinationFormState: () => DestinationFormState;
|
|
39
|
+
export declare const getDefaultSourceFormState: () => SourceFormState;
|
|
40
|
+
export declare const setAppName: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "formState/setAppName">, updateFunctionState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
41
|
+
id: string;
|
|
42
|
+
data: Partial<FunctionFormState>;
|
|
43
|
+
}, "formState/updateFunctionState">, updateJobState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
44
|
+
id: string;
|
|
45
|
+
data: Partial<JobFormState>;
|
|
46
|
+
}, "formState/updateJobState">, updateDestinationState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
|
+
id: string;
|
|
48
|
+
data: Partial<DestinationFormState>;
|
|
49
|
+
}, "formState/updateDestinationState">, updateSourceState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
50
|
+
id: string;
|
|
51
|
+
data: Partial<SourceFormState>;
|
|
52
|
+
}, "formState/updateSourceState">, clearAllState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"formState/clearAllState">, hydrateFromStorage: import("@reduxjs/toolkit").ActionCreatorWithPayload<FormState, "formState/hydrateFromStorage">;
|
|
53
|
+
declare const _default: import("redux").Reducer<FormState>;
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.hydrateFromStorage = exports.clearAllState = exports.updateSourceState = exports.updateDestinationState = exports.updateJobState = exports.updateFunctionState = exports.setAppName = exports.getDefaultSourceFormState = exports.getDefaultDestinationFormState = exports.getDefaultJobFormState = exports.getDefaultFunctionFormState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
// Default state factories
|
|
7
|
+
const getDefaultFunctionFormState = () => ({
|
|
8
|
+
httpMethod: 'POST',
|
|
9
|
+
requestUrl: '',
|
|
10
|
+
params: [{ key: '', value: '', enabled: true }],
|
|
11
|
+
headers: [{ key: 'Content-Type', value: 'application/json', enabled: true }],
|
|
12
|
+
requestBody: '{\n \n}',
|
|
13
|
+
});
|
|
14
|
+
exports.getDefaultFunctionFormState = getDefaultFunctionFormState;
|
|
15
|
+
const getDefaultJobFormState = () => ({
|
|
16
|
+
params: '{}',
|
|
17
|
+
});
|
|
18
|
+
exports.getDefaultJobFormState = getDefaultJobFormState;
|
|
19
|
+
const getDefaultDestinationFormState = () => ({
|
|
20
|
+
batchJson: '',
|
|
21
|
+
attempt: '1',
|
|
22
|
+
syncId: 'mock-sync-id',
|
|
23
|
+
syncName: 'Mock Data Sync',
|
|
24
|
+
});
|
|
25
|
+
exports.getDefaultDestinationFormState = getDefaultDestinationFormState;
|
|
26
|
+
const getDefaultSourceFormState = () => ({
|
|
27
|
+
webhookHttpMethod: 'POST',
|
|
28
|
+
webhookUrl: '',
|
|
29
|
+
webhookBody: '{\n \n}',
|
|
30
|
+
webhookParams: [{ key: '', value: '', enabled: true }],
|
|
31
|
+
webhookHeaders: [{ key: 'Content-Type', value: 'application/json', enabled: true }],
|
|
32
|
+
});
|
|
33
|
+
exports.getDefaultSourceFormState = getDefaultSourceFormState;
|
|
34
|
+
const initialState = {
|
|
35
|
+
appName: '',
|
|
36
|
+
functions: {},
|
|
37
|
+
jobs: {},
|
|
38
|
+
destinations: {},
|
|
39
|
+
sources: {},
|
|
40
|
+
};
|
|
41
|
+
const formStateSlice = (0, toolkit_1.createSlice)({
|
|
42
|
+
name: 'formState',
|
|
43
|
+
initialState,
|
|
44
|
+
reducers: {
|
|
45
|
+
// Set app name (clears state if app changed)
|
|
46
|
+
setAppName(state, action) {
|
|
47
|
+
if (state.appName !== action.payload) {
|
|
48
|
+
state.appName = action.payload;
|
|
49
|
+
state.functions = {};
|
|
50
|
+
state.jobs = {};
|
|
51
|
+
state.destinations = {};
|
|
52
|
+
state.sources = {};
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
// Update function form state
|
|
56
|
+
updateFunctionState(state, action) {
|
|
57
|
+
const { id, data } = action.payload;
|
|
58
|
+
const existing = state.functions[id] || (0, exports.getDefaultFunctionFormState)();
|
|
59
|
+
state.functions[id] = { ...existing, ...data };
|
|
60
|
+
},
|
|
61
|
+
// Update job form state
|
|
62
|
+
updateJobState(state, action) {
|
|
63
|
+
const { id, data } = action.payload;
|
|
64
|
+
const existing = state.jobs[id] || (0, exports.getDefaultJobFormState)();
|
|
65
|
+
state.jobs[id] = { ...existing, ...data };
|
|
66
|
+
},
|
|
67
|
+
// Update destination form state
|
|
68
|
+
updateDestinationState(state, action) {
|
|
69
|
+
const { id, data } = action.payload;
|
|
70
|
+
const existing = state.destinations[id] || (0, exports.getDefaultDestinationFormState)();
|
|
71
|
+
state.destinations[id] = { ...existing, ...data };
|
|
72
|
+
},
|
|
73
|
+
// Update source form state
|
|
74
|
+
updateSourceState(state, action) {
|
|
75
|
+
const { id, data } = action.payload;
|
|
76
|
+
const existing = state.sources[id] || (0, exports.getDefaultSourceFormState)();
|
|
77
|
+
state.sources[id] = { ...existing, ...data };
|
|
78
|
+
},
|
|
79
|
+
// Clear all form state (manual reset)
|
|
80
|
+
clearAllState(state) {
|
|
81
|
+
state.functions = {};
|
|
82
|
+
state.jobs = {};
|
|
83
|
+
state.destinations = {};
|
|
84
|
+
state.sources = {};
|
|
85
|
+
},
|
|
86
|
+
// Hydrate from localStorage
|
|
87
|
+
hydrateFromStorage(_state, action) {
|
|
88
|
+
return action.payload;
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
_a = formStateSlice.actions, exports.setAppName = _a.setAppName, exports.updateFunctionState = _a.updateFunctionState, exports.updateJobState = _a.updateJobState, exports.updateDestinationState = _a.updateDestinationState, exports.updateSourceState = _a.updateSourceState, exports.clearAllState = _a.clearAllState, exports.hydrateFromStorage = _a.hydrateFromStorage;
|
|
93
|
+
exports.default = formStateSlice.reducer;
|
|
94
|
+
//# sourceMappingURL=formStateSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formStateSlice.js","sourceRoot":"","sources":["../../../../src/ui/store/formStateSlice.ts"],"names":[],"mappings":";;;;AAAA,8CAA8D;AA8C9D,0BAA0B;AACnB,M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AAE,GAAG,MAAM,CAAC,OAAO,CAAC;YACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,IAAA,sCAA8B,GAAE,CAAC;YAC5E,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;QACpD,CAAC;QAED,2BAA2B;QAC3B,iBAAiB,CACf,KAAK,EACL,MAAqE;YAErE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;YACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,IAAA,iCAAyB,GAAE,CAAC;YAClE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;QAC/C,CAAC;QAED,sCAAsC;QACtC,aAAa,CAAC,KAAK;YACjB,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;YAChB,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC;YACxB,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;QACrB,CAAC;QAED,4BAA4B;QAC5B,kBAAkB,CAAC,MAAM,EAAE,MAAgC;YACzD,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,CAAC;KACF;CACF,CAAC,CAAC;AAEU,KAQT,cAAc,CAAC,OAAO,EAPxB,kBAAU,kBACV,2BAAmB,2BACnB,sBAAc,sBACd,8BAAsB,8BACtB,yBAAiB,yBACjB,qBAAa,qBACb,0BAAkB,yBACO;AAE3B,kBAAe,cAAc,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TypedUseSelectorHook } from 'react-redux';
|
|
2
|
+
import type { RootState } from './index';
|
|
3
|
+
export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
|
|
4
|
+
formState: import("./formStateSlice").FormState;
|
|
5
|
+
}, undefined, import("redux").UnknownAction> & import("redux").Dispatch<import("redux").UnknownAction>;
|
|
6
|
+
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAppSelector = exports.useAppDispatch = void 0;
|
|
4
|
+
const react_redux_1 = require("react-redux");
|
|
5
|
+
const useAppDispatch = () => (0, react_redux_1.useDispatch)();
|
|
6
|
+
exports.useAppDispatch = useAppDispatch;
|
|
7
|
+
exports.useAppSelector = react_redux_1.useSelector;
|
|
8
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../src/ui/store/hooks.ts"],"names":[],"mappings":";;;AAAA,6CAA6E;AAGtE,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,IAAA,yBAAW,GAAe,CAAC;AAAlD,QAAA,cAAc,kBAAoC;AAClD,QAAA,cAAc,GAAoC,yBAAW,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormState } from './formStateSlice';
|
|
2
|
+
export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
3
|
+
formState: FormState;
|
|
4
|
+
}, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
5
|
+
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
6
|
+
formState: FormState;
|
|
7
|
+
}, undefined, import("redux").UnknownAction>;
|
|
8
|
+
}>, import("redux").StoreEnhancer]>>;
|
|
9
|
+
export declare function initializeStore(appName: string): void;
|
|
10
|
+
export type RootState = ReturnType<typeof store.getState>;
|
|
11
|
+
export type AppDispatch = typeof store.dispatch;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.store = void 0;
|
|
37
|
+
exports.initializeStore = initializeStore;
|
|
38
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
39
|
+
const formStateSlice_1 = __importStar(require("./formStateSlice"));
|
|
40
|
+
const STORAGE_KEY_PREFIX = 'ocp-local-tool-state';
|
|
41
|
+
// Debounce helper
|
|
42
|
+
function debounce(fn, ms) {
|
|
43
|
+
let timeoutId = null;
|
|
44
|
+
return (...args) => {
|
|
45
|
+
if (timeoutId)
|
|
46
|
+
clearTimeout(timeoutId);
|
|
47
|
+
timeoutId = setTimeout(() => fn(...args), ms);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// Load state from localStorage
|
|
51
|
+
function loadState(appName) {
|
|
52
|
+
try {
|
|
53
|
+
const key = `${STORAGE_KEY_PREFIX}-${appName}`;
|
|
54
|
+
const serialized = localStorage.getItem(key);
|
|
55
|
+
if (serialized === null) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const parsed = JSON.parse(serialized);
|
|
59
|
+
// Verify appName matches
|
|
60
|
+
if (parsed.appName !== appName) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return parsed;
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
console.warn('Failed to load form state from localStorage:', err);
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Save state to localStorage
|
|
71
|
+
function saveState(state) {
|
|
72
|
+
try {
|
|
73
|
+
if (!state.appName)
|
|
74
|
+
return; // Don't save if no app name set
|
|
75
|
+
const key = `${STORAGE_KEY_PREFIX}-${state.appName}`;
|
|
76
|
+
const serialized = JSON.stringify(state);
|
|
77
|
+
localStorage.setItem(key, serialized);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
console.warn('Failed to save form state to localStorage:', err);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Create the store
|
|
84
|
+
exports.store = (0, toolkit_1.configureStore)({
|
|
85
|
+
reducer: {
|
|
86
|
+
formState: formStateSlice_1.default,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
// Set up debounced persistence subscription
|
|
90
|
+
const debouncedSave = debounce((state) => {
|
|
91
|
+
saveState(state);
|
|
92
|
+
}, 500);
|
|
93
|
+
exports.store.subscribe(() => {
|
|
94
|
+
const state = exports.store.getState().formState;
|
|
95
|
+
debouncedSave(state);
|
|
96
|
+
});
|
|
97
|
+
// Initialize store with app name (call this when app loads)
|
|
98
|
+
function initializeStore(appName) {
|
|
99
|
+
const savedState = loadState(appName);
|
|
100
|
+
if (savedState) {
|
|
101
|
+
exports.store.dispatch((0, formStateSlice_1.hydrateFromStorage)(savedState));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
exports.store.dispatch((0, formStateSlice_1.setAppName)(appName));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,0CAOC;AA1ED,8CAAkD;AAClD,mEAA+F;AAE/F,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAElD,kBAAkB;AAClB,SAAS,QAAQ,CACf,EAA2B,EAC3B,EAAU;IAEV,IAAI,SAAS,GAAyC,IAAI,CAAC;IAC3D,OAAO,CAAC,GAAG,IAAU,EAAE,EAAE;QACvB,IAAI,SAAS;YAAE,YAAY,CAAC,SAAS,CAAC,CAAC;QACvC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC;AAED,+BAA+B;AAC/B,SAAS,SAAS,CAAC,OAAe;IAChC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,GAAG,kBAAkB,IAAI,OAAO,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,UAA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AS,CAAC;IACzC,aAAa,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC;AAEH,4DAA4D;AAC5D,SAAgB,eAAe,CAAC,OAAe;IAC7C,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,UAAU,EAAE,CAAC;QACf,aAAK,CAAC,QAAQ,CAAC,IAAA,mCAAkB,EAAC,UAAU,CAAC,CAAC,CAAC;IACjD,CAAC;SAAM,CAAC;QACN,aAAK,CAAC,QAAQ,CAAC,IAAA,2BAAU,EAAC,OAAO,CAAC,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for building function endpoint URLs
|
|
3
|
+
*/
|
|
4
|
+
export interface FunctionEndpointsOptions {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
appId: string;
|
|
7
|
+
functions: Record<string, {
|
|
8
|
+
global?: boolean;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>;
|
|
11
|
+
getGuid: (functionId: string) => string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build endpoint URLs for all functions (both global and non-global)
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildAllFunctionEndpoints(options: FunctionEndpointsOptions): Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Build endpoint URLs for global functions only (no GUID)
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildGlobalFunctionEndpoints(options: FunctionEndpointsOptions): Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Build endpoint URLs for non-global functions only (with GUID)
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildNonGlobalFunctionEndpoints(options: FunctionEndpointsOptions): Record<string, string>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared utilities for building function endpoint URLs
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildAllFunctionEndpoints = buildAllFunctionEndpoints;
|
|
7
|
+
exports.buildGlobalFunctionEndpoints = buildGlobalFunctionEndpoints;
|
|
8
|
+
exports.buildNonGlobalFunctionEndpoints = buildNonGlobalFunctionEndpoints;
|
|
9
|
+
/**
|
|
10
|
+
* Build endpoint URLs for all functions (both global and non-global)
|
|
11
|
+
*/
|
|
12
|
+
function buildAllFunctionEndpoints(options) {
|
|
13
|
+
return {
|
|
14
|
+
...buildGlobalFunctionEndpoints(options),
|
|
15
|
+
...buildNonGlobalFunctionEndpoints(options),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build endpoint URLs for global functions only (no GUID)
|
|
20
|
+
*/
|
|
21
|
+
function buildGlobalFunctionEndpoints(options) {
|
|
22
|
+
const { baseUrl, appId, functions } = options;
|
|
23
|
+
const endpoints = {};
|
|
24
|
+
Object.entries(functions).forEach(([functionId, func]) => {
|
|
25
|
+
if (func.global) {
|
|
26
|
+
endpoints[functionId] = `${baseUrl}/functions/${appId}/${functionId}`;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return endpoints;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build endpoint URLs for non-global functions only (with GUID)
|
|
33
|
+
*/
|
|
34
|
+
function buildNonGlobalFunctionEndpoints(options) {
|
|
35
|
+
const { baseUrl, appId, functions, getGuid } = options;
|
|
36
|
+
const endpoints = {};
|
|
37
|
+
Object.entries(functions).forEach(([functionId, func]) => {
|
|
38
|
+
if (!func.global) {
|
|
39
|
+
const guid = getGuid(functionId);
|
|
40
|
+
endpoints[functionId] = `${baseUrl}/functions/${appId}/${functionId}/${guid}`;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return endpoints;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=functionEndpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@optimizely/ocp-local-env",
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
|
+
"description": "Local testing environment for Optimizely Connect Platform (OCP) applications",
|
|
5
|
+
"main": "dist/src/index.js",
|
|
6
|
+
"types": "dist/src/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ocp-local-env": "dist/src/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc && webpack --mode production",
|
|
15
|
+
"dev": "concurrently \"tsc --watch\" \"webpack --mode development --watch\" \"nodemon dist/src/server.js\"",
|
|
16
|
+
"dev:server": "tsc --watch && nodemon dist/src/server.js",
|
|
17
|
+
"dev:ui": "webpack --mode development --watch",
|
|
18
|
+
"start": "node dist/src/server.js",
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"lint": "npx eslint 'src/**'",
|
|
21
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
22
|
+
"prepare": "npm run build",
|
|
23
|
+
"release": "release-it"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git://github.com/ZaiusInc/ocp-local-env.git"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"optimizely",
|
|
31
|
+
"ocp",
|
|
32
|
+
"local",
|
|
33
|
+
"development",
|
|
34
|
+
"testing"
|
|
35
|
+
],
|
|
36
|
+
"author": "Optimizely",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/optimizelyZaiusInc/ocp-local-env/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/ZaiusInc/ocp-local-env#readme",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@faker-js/faker": "^9.9.0",
|
|
44
|
+
"@reduxjs/toolkit": "^2.11.0",
|
|
45
|
+
"chalk": "^4.1.2",
|
|
46
|
+
"chokidar": "^3.5.3",
|
|
47
|
+
"commander": "^9.4.1",
|
|
48
|
+
"dotenv": "^17.2.1",
|
|
49
|
+
"express": "^4.18.2",
|
|
50
|
+
"http-proxy-middleware": "^3.0.5",
|
|
51
|
+
"js-yaml": "^4.1.0",
|
|
52
|
+
"open": "^8.4.2",
|
|
53
|
+
"react": ">=17.0.0",
|
|
54
|
+
"react-dom": ">=17.0.0",
|
|
55
|
+
"react-redux": "^9.2.0",
|
|
56
|
+
"react-router-dom": "^6.28.0",
|
|
57
|
+
"uuid": "^9.0.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@testing-library/dom": "^10.4.1",
|
|
61
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
62
|
+
"@testing-library/react": "^16.3.0",
|
|
63
|
+
"@testing-library/user-event": "^14.6.1",
|
|
64
|
+
"@types/express": "^4.17.23",
|
|
65
|
+
"@types/jest": "^29.2.5",
|
|
66
|
+
"@types/js-yaml": "^4.0.9",
|
|
67
|
+
"@types/node": "^18.19.122",
|
|
68
|
+
"@types/react": "^18.3.23",
|
|
69
|
+
"@types/react-dom": "^18.3.7",
|
|
70
|
+
"@types/uuid": "^9.0.0",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
72
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
73
|
+
"concurrently": "^7.6.0",
|
|
74
|
+
"css-loader": "^6.7.3",
|
|
75
|
+
"eslint": "^8.31.0",
|
|
76
|
+
"eslint-config-prettier": "^8.6.0",
|
|
77
|
+
"eslint-plugin-react": "^7.31.11",
|
|
78
|
+
"html-webpack-plugin": "^5.5.0",
|
|
79
|
+
"husky": "^8.0.3",
|
|
80
|
+
"identity-obj-proxy": "^3.0.0",
|
|
81
|
+
"jest": "^29.3.1",
|
|
82
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
83
|
+
"lint-staged": "^15.2.0",
|
|
84
|
+
"nodemon": "^3.1.10",
|
|
85
|
+
"parse-path": "^7.0.0",
|
|
86
|
+
"prettier": "^2.8.1",
|
|
87
|
+
"release-it": "^17.10.0",
|
|
88
|
+
"style-loader": "^3.3.1",
|
|
89
|
+
"ts-jest": "^29.0.3",
|
|
90
|
+
"ts-loader": "^9.4.2",
|
|
91
|
+
"typescript": "^5.7.3",
|
|
92
|
+
"webpack": "^5.75.0",
|
|
93
|
+
"webpack-cli": "^5.0.1"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"react": ">=17.0.0",
|
|
97
|
+
"react-dom": ">=17.0.0"
|
|
98
|
+
},
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=18.0.0"
|
|
101
|
+
},
|
|
102
|
+
"lint-staged": {
|
|
103
|
+
"*.{ts,tsx}": [
|
|
104
|
+
"eslint --fix",
|
|
105
|
+
"prettier --write"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"publishConfig": {
|
|
109
|
+
"registry": "https://registry.npmjs.org",
|
|
110
|
+
"access": "public"
|
|
111
|
+
}
|
|
112
|
+
}
|