diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..5d6d06b --- /dev/null +++ b/changelog.md @@ -0,0 +1,134 @@ +# Changelog + +## 2024-10-02 - 2.0.18 - fix(core) +Fix type errors and typos in Smartstate class + +- Updated type annotation in Smartstate class to ensure StatePartNameType extends string. +- Fixed a typo in the JSDoc comment: 'existing' instead of 'exiting'. +- Corrected improper type casting in the Smartstate class. + +## 2024-05-29 - 2.0.17 - Maintenance +General updates and improvements. + +- Updated project description +- Multiple updates to `tsconfig` +- Updated `npmextra.json` to include `githost` + +## 2023-10-07 - 2.0.16 - Maintenance +General updates and improvements. + +- Core update + +## 2023-10-04 - 2.0.15 - Maintenance +General updates and improvements. + +- Core update + +## 2023-10-03 - 2.0.14 to 2.0.10 - Maintenance +General updates and improvements. + +- Core updates + +## 2023-09-11 - 2.0.9 - Maintenance +General updates and improvements. + +- Core update + +## 2023-09-11 - 2.0.8 - Maintenance +General updates and improvements. + +- Core update + +## 2023-07-27 - 2.0.7 - Maintenance +General updates and improvements. + +- Core update + +## 2023-07-27 - 2.0.6 - Maintenance +General updates and improvements. + +- Core update + +## 2023-04-13 - 2.0.5 - Maintenance +General updates and improvements. + +- Core update + +## 2023-04-12 - 2.0.4 - Maintenance +General updates and improvements. + +- Core update + +## 2023-04-04 - 2.0.3 to 2.0.1 - Maintenance +General updates and improvements. + +- Core updates + +## 2023-03-15 - 2.0.0 - Major Update +Core update with significant changes. + +## 2022-03-25 - 1.0.23 - Major Update +Breaking changes and major updates. + +- SWITCH TO ESM + +## 2022-01-24 - 1.0.22 - Maintenance +General updates and improvements. + +- Core updates + +## 2020-11-30 - 1.0.21 to 1.0.20 - Maintenance +General updates and improvements. + +- Core updates + +## 2020-11-30 - 1.0.19 to 1.0.18 - Maintenance +General updates and improvements. + +- Core updates + +## 2020-07-27 - 1.0.17 to 1.0.16 - Maintenance +General updates and improvements. + +- Core updates + +## 2020-05-27 - 1.0.15 - Maintenance +General updates and improvements. + +- Core update + +## 2020-05-27 - 1.0.14 - Maintenance +General updates and improvements. + +- Core update + +## 2019-09-25 - 1.0.13 - Maintenance +General updates and improvements. + +- Core update + +## 2019-09-25 - 1.0.12 - Maintenance +General updates and improvements. + +- Core updates + +## 2019-04-30 - 1.0.11 to 1.0.10 - Maintenance +General updates and improvements. + +- Core updates + +## 2019-03-22 - 1.0.9 - Maintenance +General updates and improvements. + +- Core update + +## 2019-02-27 - 1.0.8 - Minor Update +Minor updates and improvements. + +- Updated action generation +- Core update + +## 2019-02-21 - 1.0.7 - Initial Release +Initial release of the project. + +- Initial core implementation diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 1e1675f..4c011f1 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -1,8 +1,8 @@ /** - * autocreated commitinfo by @pushrocks/commitinfo + * autocreated commitinfo by @push.rocks/commitinfo */ export const commitinfo = { name: '@push.rocks/smartstate', - version: '2.0.17', - description: 'a package that handles state in a good way' + version: '2.0.18', + description: 'A package for handling and managing state in applications.' } diff --git a/ts/smartstate.classes.smartstate.ts b/ts/smartstate.classes.smartstate.ts index ec536cb..6802735 100644 --- a/ts/smartstate.classes.smartstate.ts +++ b/ts/smartstate.classes.smartstate.ts @@ -6,26 +6,26 @@ export type TInitMode = 'soft' | 'mandatory' | 'force' | 'persistent'; /** * Smartstate takes care of providing state */ -export class Smartstate { - public statePartMap: { [key: string]: StatePart } = {}; +export class Smartstate { + public statePartMap: { [key in StatePartNameType]?: StatePart } = {}; constructor() {} /** * Allows getting and initializing a new statepart * initMode === 'soft' it will allow existing stateparts - * initMode === 'mandatory' will fail if there is an exiting statepart + * initMode === 'mandatory' will fail if there is an existing statepart * initMode === 'force' will overwrite any existing statepart * @param statePartNameArg * @param initialArg * @param initMode */ public async getStatePart( - statePartNameArg: string & StatePartNameType, + statePartNameArg: StatePartNameType, initialArg?: PayloadType, initMode?: TInitMode ): Promise> { - if (this.statePartMap[statePartNameArg as any]) { + if (this.statePartMap[statePartNameArg]) { if (initialArg && (!initMode || initMode !== 'soft')) { throw new Error( `${statePartNameArg} already exists, yet you try to set an initial state again` @@ -43,7 +43,7 @@ export class Smartstate { } /** - * creates a statepart + * Creates a statepart * @param statePartName * @param initialPayloadArg */ @@ -54,10 +54,12 @@ export class Smartstate { ): Promise> { const newState = new StatePart( statePartName, - initMode === 'persistent' ? { - dbName: 'smartstate', - storeName: statePartName as any, - } : null + initMode === 'persistent' + ? { + dbName: 'smartstate', + storeName: statePartName, + } + : null ); await newState.init(); const currentState = newState.getState(); @@ -65,7 +67,7 @@ export class Smartstate { ...initialPayloadArg, ...currentState, }); - this.statePartMap[statePartName as any] = newState; + this.statePartMap[statePartName] = newState; return newState; } -} +} \ No newline at end of file