🤖 Bip Bop - Fusion Framework Release #2168
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@equinor/[email protected]
Major Changes
#2155
97a79fb
Thanks @odinr! - TheLogger
module is a new package for handling logging in the Fusion frontend ecosystem.Logger
class extends theILogger
interface, ensuring that all logger implementations adhere to a consistent contract.ConsoleLogger
class is a concrete implementation of theLogger
class that logs messages to the console._createMessage
method in theLogger
class has been made abstract, allowing concrete implementations to define their own message formatting logic.version
property to theLogger
class, which exposes the current version of the logger module.resolveLogLevel
utility function that can resolve log levels from both string and numeric representations.FUSION_LOG_LEVEL
environment variable. If the environment variable is not set, it defaults toLogLevel.Error
.To use the new
Logger
module, import the necessary components and create a new logger instance:To resolve a log level from a string or numeric value, use the resolveLogLevel function:
The default log level can be controlled using the
FUSION_LOG_LEVEL
environment variable. If the variable is set to an invalid value, it will default toLogLevel.Debug
in development environments andLogLevel.Error
in production environments.Minor Changes
#2155
97a79fb
Thanks @odinr! - Added a new scripttest:coverage
to the package.json file. This script runs the test suite with code coverage reporting enabled, allowing developers to analyze the test coverage of the codebase.Example usage:
pnpm test pnpm test:coverage
This will run the test suite using Vitest and generate a code coverage report.
Added a new test suite for the ConsoleLogger class. The test suite covers various scenarios, including:
Added a new configuration file vitest.config.ts for Vitest, the test runner used in this package. This file sets up the project-specific configuration for Vitest, such as the test file pattern and environment variables.
@equinor/[email protected]
Minor Changes
#2180
060a1aa
Thanks @odinr! - ## @equinor/fusion-reactWhat changed?
The
useAppEnvironmentVariables
hook has been added to the@equinor/fusion-react
package.This hook provides access to the application's environment variables, which are retrieved from the app module provided by the framework.
Why the change?
Previously, there was no built-in way to access the application's environment variables from the React components.
This new hook fills that gap, making it easier for developers to retrieve and use the environment configuration in their applications.
How to use the new feature
To use the
useAppEnvironmentVariables
hook, simply import it and call it in your React component:The hook returns an observable state object that represents the current environment configuration.
The
value
property of this object contains the environment variables, which can be typed using a generic type parameter.If the environment configuration is not yet available (e.g., during the initial load), the
complete
property will befalse
.If there was an error retrieving the configuration, the
error
property will be set.Migration guide
There are no breaking changes introduced with this feature. Developers can start using the
useAppEnvironmentVariables
hook immediately to access their application's environment variables.Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,9a91bb7
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
@equinor/[email protected]
Patch Changes
fb424be
,9a91bb7
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
,6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
,6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
#2171
9a91bb7
Thanks @odinr! - ## @equinor/fusion-eventImproved Type Resolution for
FrameworkEventInitType
The
FrameworkEventInitType
type has been enhanced to better resolve types for bothIFrameworkEvent
andFrameworkEvent
.When defining events
FrameworkEventMap
, the dispatch type can now be inferred from the event type.Changes
The type definition for
FrameworkEventInitType
has been updated as follows:This change ensures that
FrameworkEventInitType
can now correctly infer the type for bothIFrameworkEvent
andFrameworkEvent
.Updated dependencies [
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
#2177
fb424be
Thanks @odinr! - ## @equinor/fusion-framework-moduleChanges to
BaseConfigBuilder
The
_createConfig
method inBaseConfigBuilder
has been updated to return anObservableInput<TConfig>
instead of anObservable<TConfig>
.This allows for more flexibility in how the config is created, as the method can now return a Promise or other observable-like type.
Additionally, the
_createConfig
method now usesfrom()
to convert the result of_buildConfig
to an observable stream.Here's an example of how the updated
_createConfig
method can be used:This change allows for asynchronous operations to be performed within the
_buildConfig
method, which can then be processed in the_processConfig
method.Consumers of the
BaseConfigBuilder
class should not need to update their code, as the public API remains the same.#2177
fb424be
Thanks @odinr! - ## @equinor/fusion-framework-moduleImproved documentation for
BaseConfigBuilder
The
BaseConfigBuilder
class has been updated with improved documentation to better explain its usage and capabilities.What changed?
The
BaseConfigBuilder
class is an abstract class that provides a flexible and extensible way to build and configure modules. It allows you to define configuration callbacks for different parts of your module's configuration, and then combine and process these callbacks to generate the final configuration object.The documentation has been expanded to include:
BaseConfigBuilder
class is designed to be used, including an example of creating a configuration builder for a hypotheticalMyModule
module.BaseConfigBuilder
class, such ascreateConfig
,createConfigAsync
,_set
,_buildConfig
, and_processConfig
._processConfig
method to add additional logic or validation to the configuration object before it is returned.BaseConfigBuilder
class to handle common configuration scenarios, such as setting default values or validating configuration properties.#2177
fb424be
Thanks @odinr! - ## @equinor/fusion-framework-moduleChanges to
BaseConfigBuilder
The
BaseConfigBuilder
class has been updated to improve its extendability and provide better access to the internal configuration callbacks.Added
_get
and_has
methodsTwo new protected methods have been added to the
BaseConfigBuilder
class:_get<TTarget extends DotPath<TConfig>>(target: TTarget)
: This method retrieves the configuration callback for the specified target path in the configuration. It returns the callback orundefined
if no callback is registered for the given target._has<TTarget extends DotPath<TConfig>>(target: TTarget)
: This method checks if the given target path exists in the configuration callbacks. It returnstrue
if the target path exists,false
otherwise.These methods allow subclasses of
BaseConfigBuilder
to easily access and check the existence of configuration callbacks for specific targets.Example usage
Suppose you have a subclass of
BaseConfigBuilder
calledMyConfigBuilder
. You can use the new_get
and_has
methods like this:This change allows for more flexibility and easier extensibility of the
BaseConfigBuilder
class.@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
,6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
fb424be
,9a91bb7
,fb424be
,fb424be
,6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
@equinor/[email protected]
Patch Changes
6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
060a1aa
]:@equinor/[email protected]
Patch Changes
6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
6a81125
,cd737c2
]:@equinor/[email protected]
Patch Changes
9a91bb7
]:@equinor/[email protected]
Patch Changes
@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
@equinor/[email protected]
Patch Changes
fb424be
,fb424be
,fb424be
]:@equinor/[email protected]
Patch Changes
#2170
6a81125
Thanks @odinr! - ## @equinor/fusion-queryImproved Action Suffix Resolution
We have improved the way action suffixes are resolved in the observable package. This change includes the following updates:
actionBaseType
function: Now supports extracting the base action type from both action objects and action type strings.isActionWithSuffix
function: A utility function to check if an action has a specific suffix.isRequestAction
,isSuccessAction
,isFailureAction
, andisCompleteAction
functions: These functions now utilizeisActionWithSuffix
for better type safety and readability.Example Usage
Extracting Base Action Type
Checking Action Suffix
#2169
cd737c2
Thanks @odinr! - ## @equinor/fusion-queryUpdated Logger Dependency
Replaced the internal logger implementation with the
@equinor/fusion-log
package. This change affects the following files:package.json
: Removedchalk
dependency and added@equinor/fusion-log
.src/Query.ts
: Updated import statements to use@equinor/fusion-log
.src/QueryTask.ts
: Updated import statements to use@equinor/fusion-log
.src/client/QueryClient.ts
: Updated import statements to use@equinor/fusion-log
.src/logger.ts
as it is no longer needed.Updated dependencies [
97a79fb
,97a79fb
]:@equinor/[email protected]
Patch Changes
fb424be
,9a91bb7
,fb424be
,fb424be
]:@equinor/[email protected]
Major Changes
#2180
060a1aa
Thanks @odinr! - ## @equinor/fusion-framework-cookbook-app-react-environment-variablesThis new cookbook demonstrates how to use the
useAppEnvironmentVariables
hook to access environment variables in a Fusion Framework React application.The cookbook uses the newly created hook
useAppEnvironmentVariables
from@equinor/fusion-framework-react-app
which retrieve environment variables from the application's configuration.@equinor/[email protected]
Patch Changes
#2182
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.Updated dependencies []:
@equinor/[email protected]
Patch Changes
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.@equinor/[email protected]
Patch Changes
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.@equinor/[email protected]
Patch Changes
060a1aa
]:@equinor/[email protected]
Patch Changes
#2182
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.Updated dependencies [
060a1aa
]:@equinor/[email protected]
Patch Changes
060a1aa
]:@equinor/[email protected]
Patch Changes
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.@equinor/[email protected]
Patch Changes
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.@equinor/[email protected]
Patch Changes
#2182
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.Updated dependencies []:
@equinor/[email protected]
Patch Changes
13d1ae4
Thanks @odinr! - updated all cookbooks to useworkspace:^
as a dependency version.@equinor/[email protected]
Patch Changes
#2180
060a1aa
Thanks @odinr! - ## @equinor/fusion-framework-docsUpdated the "Getting started" guide with a new section about using environment variables.