Gathering detailed insights and metrics for @sap-ux/store
Gathering detailed insights and metrics for @sap-ux/store
Gathering detailed insights and metrics for @sap-ux/store
Gathering detailed insights and metrics for @sap-ux/store
Enable community collaboration to jointly promote and facilitate best in class tooling capabilities
npm install @sap-ux/store
Typescript
Module System
Min. Node Version
Node Version
NPM Version
@sap-ux/ui5-library-sub-generator@0.1.26
Updated on Jul 10, 2025
@sap-ux/ui-service-inquirer@0.1.43
Updated on Jul 10, 2025
@sap-ux/ui5-library-reference-sub-generator@0.1.24
Updated on Jul 10, 2025
@sap-ux/ui5-library-reference-inquirer@0.4.24
Updated on Jul 10, 2025
@sap-ux/ui5-library-inquirer@0.4.26
Updated on Jul 10, 2025
@sap-ux/ui5-application-inquirer@0.14.27
Updated on Jul 10, 2025
TypeScript (87.81%)
JavaScript (7.14%)
HTML (1.9%)
CSS (1.66%)
CAP CDS (0.8%)
SCSS (0.64%)
Less (0.03%)
EJS (0.03%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
95 Stars
3,377 Commits
44 Forks
12 Watchers
168 Branches
688 Contributors
Updated on Jul 10, 2025
Latest Version
1.1.2
Package Id
@sap-ux/store@1.1.2
Unpacked Size
95.52 kB
Size
22.87 kB
File Count
70
NPM Version
10.8.2
Node Version
20.19.2
Published on
Jul 04, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
7
1
This is a store for persistent data in Fiori tools.
Add @sap-ux/store
to your projects package.json
to include it in your module.
The main API to this module is getService()
. Given an optional logger and an entity name, this function will return an instance of a class with the following methods:
1interface Service<Entity, EntityKey> { 2 read(key: EntityKey): Promise<Entity | undefined>; 3 write(entity: Entity): Promise<Entity | undefined>; 4 delete(entity: Entity): Promise<boolean>; 5 getAll(): Promise<Entity[] | []>; 6}
Currently, 'system'
, 'telemetry'
and 'api-hub'
are the only supported entities. Support for 'user'
may be added in the future.
Unsupported entity names will result in an error being thrown.
The store supports storing values in operating system specific secure storage, like keychain on MacOS or secure storage on Windows. To disable access to secure storage, environment variable FIORI_TOOLS_DISABLE_SECURE_STORE
can be set.
(Please read the code for the system entity starting here for a concrete example: ./src/services/backend-system.ts)
This needs to needs to implement the Service<Entity, EntityKey>
interface shown above. This is what the external clients of the API will use.
Optionally, you may need to migrate data if the underlying schema changes. You may choose to do this as a single-shot one-off procedure or do it on the fly when any of the service methods are accessed. Code for an example migration service (no-op).
It is recommended that the DataProvider
interface be used to create a data provider for the new entity. This class' concern will purely be managing the persistence of the entity. The service interface may have other concerns like the data migration step in the system store.
Recommended interfaces to implement:
1interface DataProvider<E, K extends EntityKey<E>> { 2 read(key: K): Promise<E | undefined>; 3 write(entity: E): Promise<E | undefined>; 4 delete(entity: E): Promise<boolean>; 5 getAll(): Promise<E[] | []>; 6}
Implement the static side of the interface for the constructor:
1interface DataProviderConstructor<E, K extends EntityKey<K>> { 2 new (logger: Logger): DataProvider<E, K>; 3}
Data providers can delegate to data accessors.
The following data accessors are currently available:
This stores the entities on the filesystem inside the Fiori Tools directory (Uses: getFioriToolsDirectory()
from @sap-ux/common-utils
)
This stores information on the filesystem and the system's secure store.
Entity classes are simple. They don't do much other than list the properties that will be serialized. @serializable
and @sensitiveData
are two annotations that are understood by the hybrid store.
The system entity for example looks like this:
1class BackendSystem { 2 @serializable public readonly name: string; 3 @serializable public readonly url: string; 4 @serializable public readonly client?: string; 5 @sensitiveData public readonly serviceKeys?: unknown; 6 @sensitiveData public readonly username?: string; 7 @sensitiveData public readonly password?: string; 8 ... 9 ... 10}
Systems that are constructed using new BackendSystem({...})
will have the properties correctly persisted in the relevant medium by the hybrid data accessor.
Every entity needs an EntityKey
implementing this interface:
1interface EntityKey<T> { 2 getId: () => string; 3}
No vulnerabilities found.
No security vulnerabilities found.