Skip to content

Commit

Permalink
Merge pull request #947 from jetstreamapp/chore/migrate-features-to-l…
Browse files Browse the repository at this point in the history
…ibraries

Chore/migrate-features-to-libraries
  • Loading branch information
paustint authored Jun 26, 2024
2 parents 2b45dca + f5f8378 commit 46c2b0f
Show file tree
Hide file tree
Showing 415 changed files with 3,234 additions and 752 deletions.
106 changes: 68 additions & 38 deletions apps/jetstream/src/app/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,74 @@ import { APP_ROUTES } from './components/core/app-routes';
import { AppHome } from './components/home/AppHome';
import OrgSelectionRequired from './components/orgs/OrgSelectionRequired';

const LoadRecords = lazy(() => import('./components/load-records/LoadRecords'));
const LoadRecordsMultiObject = lazy(() => import('./components/load-records-multi-object/LoadRecordsMultiObject'));

const Query = lazy(() => import('./components/query/Query'));
const QueryBuilder = lazy(() => import('./components/query/QueryBuilder/QueryBuilder'));
const QueryResults = lazy(() => import('./components/query/QueryResults/QueryResults'));

const AutomationControl = lazy(() => import('./components/automation-control/AutomationControl'));
const AutomationControlSelection = lazy(() => import('./components/automation-control/AutomationControlSelection'));
const AutomationControlEditor = lazy(() => import('./components/automation-control/AutomationControlEditor'));

const ManagePermissions = lazy(() => import('./components/manage-permissions/ManagePermissions'));
const ManagePermissionsSelection = lazy(() => import('./components/manage-permissions/ManagePermissionsSelection'));
const ManagePermissionsEditor = lazy(() => import('./components/manage-permissions/ManagePermissionsEditor'));

const DeployMetadata = lazy(() => import('./components/deploy/DeployMetadata'));
const DeployMetadataSelection = lazy(() => import('./components/deploy/DeployMetadataSelection'));
const DeployMetadataDeployment = lazy(() => import('./components/deploy/DeployMetadataDeployment'));

const CreateObjectAndFields = lazy(() => import('./components/create-object-and-fields/CreateObjectAndFields'));
const CreateFieldsSelection = lazy(() => import('./components/create-object-and-fields/CreateFieldsSelection'));
const CreateFields = lazy(() => import('./components/create-object-and-fields/CreateFields'));

const FormulaEvaluator = lazy(() => import('./components/formula-evaluator/FormulaEvaluator'));

const MassUpdateRecords = lazy(() => import('./components/update-records/MassUpdateRecords'));
const MassUpdateRecordsSelection = lazy(() => import('./components/update-records/selection/MassUpdateRecordsSelection'));
const MassUpdateRecordsDeployment = lazy(() => import('./components/update-records/deployment/MassUpdateRecordsDeployment'));

const AnonymousApex = lazy(() => import('./components/anonymous-apex/AnonymousApex'));

const SalesforceApi = lazy(() => import('./components/salesforce-api/SalesforceApi'));

const DebugLogViewer = lazy(() => import('./components/debug-log-viewer/DebugLogViewer'));

const SObjectExport = lazy(() => import('./components/sobject-export/SObjectExport'));

const PlatformEventMonitor = lazy(() => import('./components/platform-event-monitor/PlatformEventMonitor'));
const LoadRecords = lazy(() => import('@jetstream/feature/load-records').then((module) => ({ default: module.LoadRecords })));
const LoadRecordsMultiObject = lazy(() =>
import('@jetstream/feature/load-records-multi-object').then((module) => ({ default: module.LoadRecordsMultiObject }))
);

const Query = lazy(() => import('@jetstream/feature/query').then((module) => ({ default: module.Query })));
const QueryBuilder = lazy(() => import('@jetstream/feature/query').then((module) => ({ default: module.QueryBuilder })));
const QueryResults = lazy(() => import('@jetstream/feature/query').then((module) => ({ default: module.QueryResults })));

const AutomationControl = lazy(() =>
import('@jetstream/feature/automation-control').then((module) => ({ default: module.AutomationControl }))
);
const AutomationControlEditor = lazy(() =>
import('@jetstream/feature/automation-control').then((module) => ({ default: module.AutomationControlEditor }))
);
const AutomationControlSelection = lazy(() =>
import('@jetstream/feature/automation-control').then((module) => ({ default: module.AutomationControlSelection }))
);

const ManagePermissions = lazy(() =>
import('@jetstream/feature/manage-permissions').then((module) => ({ default: module.ManagePermissions }))
);
const ManagePermissionsSelection = lazy(() =>
import('@jetstream/feature/manage-permissions').then((module) => ({ default: module.ManagePermissionsSelection }))
);
const ManagePermissionsEditor = lazy(() =>
import('@jetstream/feature/manage-permissions').then((module) => ({ default: module.ManagePermissionsEditor }))
);

const DeployMetadata = lazy(() => import('@jetstream/feature/deploy').then((module) => ({ default: module.DeployMetadata })));
const DeployMetadataSelection = lazy(() =>
import('@jetstream/feature/deploy').then((module) => ({ default: module.DeployMetadataSelection }))
);
const DeployMetadataDeployment = lazy(() =>
import('@jetstream/feature/deploy').then((module) => ({ default: module.DeployMetadataDeployment }))
);

const CreateObjectAndFields = lazy(() =>
import('@jetstream/feature/create-object-and-fields').then((module) => ({ default: module.CreateObjectAndFields }))
);
const CreateFieldsSelection = lazy(() =>
import('@jetstream/feature/create-object-and-fields').then((module) => ({ default: module.CreateFieldsSelection }))
);
const CreateFields = lazy(() => import('@jetstream/feature/create-object-and-fields').then((module) => ({ default: module.CreateFields })));

const FormulaEvaluator = lazy(() =>
import('@jetstream/feature/formula-evaluator').then((module) => ({ default: module.FormulaEvaluator }))
);

const MassUpdateRecords = lazy(() => import('@jetstream/feature/update-records').then((module) => ({ default: module.MassUpdateRecords })));
const MassUpdateRecordsSelection = lazy(() =>
import('@jetstream/feature/update-records').then((module) => ({ default: module.MassUpdateRecordsSelection }))
);
const MassUpdateRecordsDeployment = lazy(() =>
import('@jetstream/feature/update-records').then((module) => ({ default: module.MassUpdateRecordsDeployment }))
);

const AnonymousApex = lazy(() => import('@jetstream/feature/anon-apex').then((module) => ({ default: module.AnonymousApex })));

const SalesforceApi = lazy(() => import('@jetstream/feature/salesforce-api').then((module) => ({ default: module.SalesforceApi })));

const DebugLogViewer = lazy(() => import('@jetstream/feature/debug-log-viewer').then((module) => ({ default: module.DebugLogViewer })));

const SObjectExport = lazy(() => import('@jetstream/feature/sobject-export').then((module) => ({ default: module.SObjectExport })));

const PlatformEventMonitor = lazy(() =>
import('@jetstream/feature/platform-event-monitor').then((module) => ({ default: module.PlatformEventMonitor }))
);

const Feedback = lazy(() => import('./components/feedback/Feedback'));

Expand Down
22 changes: 12 additions & 10 deletions apps/jetstream/src/app/components/core/AppStateResetOnOrgChange.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { SalesforceOrgUi } from '@jetstream/types';
import { fromAppState } from '@jetstream/ui-core';
import {
fromAppState,
fromAutomationControlState,
fromDeployMetadataState,
fromFormulaState,
fromLoadRecordsState,
fromPermissionsState,
fromQueryState,
} from '@jetstream/ui-core';
import { FunctionComponent, useEffect, useState } from 'react';
import { Resetter, useRecoilValue, useResetRecoilState } from 'recoil';
import * as fromAutomationControlState from '../automation-control/automation-control.state';
import * as fromDeployMetadataState from '../deploy/deploy-metadata.state';
import * as fromFormulaState from '../formula-evaluator/formula-evaluator.state';
import * as fromLoadState from '../load-records/load-records.state';
import * as fromPermissionsState from '../manage-permissions/manage-permissions.state';
import * as fromQueryState from '../query/query.state';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AppStateResetOnOrgChangeProps {}
Expand All @@ -33,9 +35,9 @@ export const AppStateResetOnOrgChange: FunctionComponent<AppStateResetOnOrgChang
useResetRecoilState(fromQueryState.queryOrderByState),
useResetRecoilState(fromQueryState.querySoqlState),
// LOAD
useResetRecoilState(fromLoadState.sObjectsState),
useResetRecoilState(fromLoadState.selectedSObjectState),
useResetRecoilState(fromLoadState.fieldMappingState),
useResetRecoilState(fromLoadRecordsState.sObjectsState),
useResetRecoilState(fromLoadRecordsState.selectedSObjectState),
useResetRecoilState(fromLoadRecordsState.fieldMappingState),
// AUTOMATION-CONTROL
useResetRecoilState(fromAutomationControlState.sObjectsState),
// Manage Permissions
Expand Down
2 changes: 1 addition & 1 deletion apps/jetstream/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"**/*.ts",
"**/*.tsx",
"../../custom-typings/index.d.ts",
"../../libs/shared/ui-core/src/app-state/app-state.ts",
"../../libs/shared/ui-core/src/state-management/app-state.ts",
"../../libs/shared/ui-core/src/jetstream-events.ts",
"../../libs/shared/ui-core/src/analytics.tsx"
],
Expand Down
2 changes: 1 addition & 1 deletion apps/jetstream/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"files": [],
"include": [
"src",
"../../libs/shared/ui-core/src/app-state/app-state.ts",
"../../libs/shared/ui-core/src/state-management/app-state.ts",
"../../libs/shared/ui-core/src/jetstream-events.ts",
"../../libs/shared/ui-core/src/analytics.tsx"
],
Expand Down
12 changes: 12 additions & 0 deletions libs/features/anon-apex/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions libs/features/anon-apex/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/features/anon-apex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# features-anon-apex

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test features-anon-apex` to execute the unit tests via [Jest](https://jestjs.io).
10 changes: 10 additions & 0 deletions libs/features/anon-apex/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: 'features-anon-apex',
preset: '../../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
};
16 changes: 16 additions & 0 deletions libs/features/anon-apex/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "features-anon-apex",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/features/anon-apex/src",
"projectType": "library",
"tags": [],
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/features/anon-apex/jest.config.ts"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { logger } from '@jetstream/shared/client-logger';
import { ANALYTICS_KEYS, INDEXED_DB, LOG_LEVELS, TITLES } from '@jetstream/shared/constants';
import { anonymousApex } from '@jetstream/shared/data';
import { useBrowserNotifications, useDebounce, useNonInitialEffect, useRollbar, useTitle } from '@jetstream/shared/ui-utils';
import { getErrorMessage, getErrorMessageAndStackObj } from '@jetstream/shared/utils';
import { SplitWrapper as Split } from '@jetstream/splitjs';
import { ApexHistoryItem, ListItem, SalesforceOrgUi } from '@jetstream/types';
import {
Expand All @@ -21,8 +22,7 @@ import {
ViewDocsLink,
getModifierKey,
} from '@jetstream/ui';
import { STORAGE_KEYS, applicationCookieState, selectSkipFrontdoorAuth, selectedOrgState } from '@jetstream/ui-core';
import { useAmplitude } from '@jetstream/ui-core';
import { STORAGE_KEYS, applicationCookieState, selectSkipFrontdoorAuth, selectedOrgState, useAmplitude } from '@jetstream/ui-core';
import Editor, { OnMount, useMonaco } from '@monaco-editor/react';
import localforage from 'localforage';
import escapeRegExp from 'lodash/escapeRegExp';
Expand Down Expand Up @@ -174,12 +174,12 @@ export const AnonymousApex: FunctionComponent<AnonymousApexProps> = () => {
})
.catch((ex) => {
logger.warn('[ERROR] Could not save history', ex);
rollbar.error('Error saving apex history', { message: ex.message, stack: ex.stack });
rollbar.error('Error saving apex history', getErrorMessageAndStackObj(ex));
});
}
trackEvent(ANALYTICS_KEYS.apex_Submitted, { success: result.success });
} catch (ex) {
setResults(`There was a problem submitting the request\n${ex.message}`);
setResults(`There was a problem submitting the request\n${getErrorMessage(ex)}`);
trackEvent(ANALYTICS_KEYS.apex_Submitted, { success: false });
} finally {
setLoading(false);
Expand All @@ -188,8 +188,8 @@ export const AnonymousApex: FunctionComponent<AnonymousApexProps> = () => {
[historyItems, selectedOrg, logLevel, setHistoryItems, trackEvent]
);

function handleEditorChange(value, event) {
setApex(value);
function handleEditorChange(value?: string, event?: unknown) {
setApex(value || '');
}

const handleApexEditorMount: OnMount = (currEditor, monaco) => {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions libs/features/anon-apex/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './AnonymousApex';
22 changes: 22 additions & 0 deletions libs/features/anon-apex/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"allowJs": false,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"strict": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
24 changes: 24 additions & 0 deletions libs/features/anon-apex/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"types": ["node"]
},
"exclude": [
"jest.config.ts",
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.jsx",
"src/**/*.test.jsx"
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"],
"files": [
"../../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../../node_modules/@nx/react/typings/image.d.ts",
"../../../custom-typings/index.d.ts"
]
}
20 changes: 20 additions & 0 deletions libs/features/anon-apex/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
12 changes: 12 additions & 0 deletions libs/features/automation-control/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions libs/features/automation-control/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/features/automation-control/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# features-automation-control

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test features-automation-control` to execute the unit tests via [Jest](https://jestjs.io).
Loading

0 comments on commit 46c2b0f

Please sign in to comment.