fluxie 1.2.0 → 1.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0](https://github.com/LesFabricants/Fluxie/compare/v1.2.1...v1.3.0) (2024-06-04)
4
+
5
+
6
+ ### Features
7
+
8
+ * **pkg:** update required angular version ([2a0d2f7](https://github.com/LesFabricants/Fluxie/commit/2a0d2f78f97f92ec4ece41da95cfbe7c9159cd1f))
9
+
10
+ ## [1.2.1](https://github.com/LesFabricants/Fluxie/compare/v1.2.0...v1.2.1) (2024-06-04)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **store:** do not initialize in the upgrade event ([8a9b42d](https://github.com/LesFabricants/Fluxie/commit/8a9b42dddbee9382bdb10e9601fce9b1e8bd5b42))
16
+
3
17
  ## [1.2.0](https://github.com/LesFabricants/Fluxie/compare/v1.1.0...v1.2.0) (2024-06-04)
4
18
 
5
19
 
package/README.md CHANGED
@@ -5,6 +5,14 @@ Super small helper class meant to greatly simplify the creation of a flux archit
5
5
  **Warning**
6
6
  **Requires 2Kb of available space, make sure you have the space before installing !**
7
7
 
8
+ ## Installation
9
+
10
+ The latest version supports signals, and thus requires a version of angular 16 minimum, other versions can use the lts release that removes signals support
11
+
12
+ `npm i fluxie` Angular 16+
13
+
14
+ `npm i fluxie@lts` Other Angular Versions
15
+
8
16
  ## Syntax
9
17
 
10
18
  > The `store.ts` files is a base class that can be extended by services to add the necessary methods and properties required to handle a centralized state
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{BehaviorSubject as p}from"rxjs";var r={},o=!1;function h(){o=!0}function l(i,t,s){if(!d())return!1;let e=window?.__REDUX_DEVTOOLS_EXTENSION__.connect({name:i});e.init(s),e.subscribe(n=>{n.type==="DISPATCH"&&n.payload.type==="JUMP_TO_ACTION"&&t.next(JSON.parse(n.state))}),r[i]=e}function c(i,t,s){if(!d())return!1;if(!o)throw new Error("Devtools not enabled, please call enableReduxDevtools() in app.module.ts");r[i].send(t,s)}function d(){return window?.__REDUX_DEVTOOLS_EXTENSION__!==void 0}import{toSignal as u}from"@angular/core/rxjs-interop";var a=class{options;state;select$;select;db;constructor(t,s){if(this.options={...s,storeName:s?.storeName??this.constructor.name},this.state=new p(t),this.select$=this.state.asObservable(),this.select=u(this.state),s?.cache){let e=globalThis.indexedDB.open("__FLUXIE_STORE",1);e.onerror=()=>{console.error(`IndexedDB error: ${e.error}`)},e.onsuccess=()=>{this.db=e.result,this.initializeFromIndexedDB()},e.onupgradeneeded=n=>{this.db=e.result,n.newVersion===1&&this.db.createObjectStore("cachedData"),this.initializeFromIndexedDB()}}o&&l(this.options.storeName,this.state,this.state.getValue())}setState(t,s){let e=s(this.state.getValue());this.state.next(e),this.options?.cache&&this.sendToIndexedDB(this.state.getValue()),o&&c(this.options.storeName,t,e)}async initializeFromIndexedDB(){let t=this.db.transaction("cachedData").objectStore("cachedData").get(this.options.storeName);t.onsuccess=()=>{let s=t.result;s?this.state.next(s):this.sendToIndexedDB(this.state.getValue())}}async sendToIndexedDB(t){this.db.transaction("cachedData","readwrite").objectStore("cachedData").put(t,this.options.storeName)}};export{a as Store,h as enableReduxDevtools,o as isDevtoolEnabled};
1
+ import{BehaviorSubject as p}from"rxjs";var r={},o=!1;function h(){o=!0}function l(i,t,s){if(!d())return!1;let e=window?.__REDUX_DEVTOOLS_EXTENSION__.connect({name:i});e.init(s),e.subscribe(n=>{n.type==="DISPATCH"&&n.payload.type==="JUMP_TO_ACTION"&&t.next(JSON.parse(n.state))}),r[i]=e}function c(i,t,s){if(!d())return!1;if(!o)throw new Error("Devtools not enabled, please call enableReduxDevtools() in app.module.ts");r[i].send(t,s)}function d(){return window?.__REDUX_DEVTOOLS_EXTENSION__!==void 0}import{toSignal as u}from"@angular/core/rxjs-interop";var a=class{options;state;select$;select;db;constructor(t,s){if(this.options={...s,storeName:s?.storeName??this.constructor.name},this.state=new p(t),this.select$=this.state.asObservable(),this.select=u(this.state),s?.cache){let e=globalThis.indexedDB.open("__FLUXIE_STORE",1);e.onerror=()=>{console.error(`IndexedDB error: ${e.error}`)},e.onsuccess=()=>{this.db=e.result,this.initializeFromIndexedDB()},e.onupgradeneeded=n=>{this.db=e.result,n.newVersion===1&&this.db.createObjectStore("cachedData")}}o&&l(this.options.storeName,this.state,this.state.getValue())}setState(t,s){let e=s(this.state.getValue());this.state.next(e),this.options?.cache&&this.sendToIndexedDB(this.state.getValue()),o&&c(this.options.storeName,t,e)}async initializeFromIndexedDB(){let t=this.db.transaction("cachedData").objectStore("cachedData").get(this.options.storeName);t.onsuccess=()=>{let s=t.result;s?this.state.next(s):this.sendToIndexedDB(this.state.getValue())}}async sendToIndexedDB(t){this.db.transaction("cachedData","readwrite").objectStore("cachedData").put(t,this.options.storeName)}};export{a as Store,h as enableReduxDevtools,o as isDevtoolEnabled};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "fluxie",
3
3
  "description": "Small helper class to easily implement Flux architecture using angular service, complete with redux devtool and caching support",
4
4
  "authors": "Anthony Lenglet",
5
- "version": "1.2.0",
5
+ "version": "1.3.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "author": {
@@ -13,7 +13,7 @@
13
13
  "homepage": "https://github.com/LesFabricants/Fluxie",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/LesFabricants/Fluxie"
16
+ "url": "git+https://github.com/LesFabricants/Fluxie.git"
17
17
  },
18
18
  "keywords": [
19
19
  "angular",
@@ -26,7 +26,7 @@
26
26
  "build": "node esbuild.config.js && ./node_modules/.bin/tsc -p tsconfig.json"
27
27
  },
28
28
  "peerDependencies": {
29
- "@angular/core": ">=17.0.0",
29
+ "@angular/core": ">=16.0.0",
30
30
  "rxjs": ">=5.0.0"
31
31
  },
32
32
  "devDependencies": {
@@ -1,19 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - main
5
-
6
- permissions:
7
- contents: write
8
- pull-requests: write
9
-
10
- name: cut-and-release
11
-
12
- jobs:
13
- release-please:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: googleapis/release-please-action@v4
17
- with:
18
- token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
19
- release-type: node
@@ -1,20 +0,0 @@
1
- on:
2
- release:
3
- types: [published]
4
-
5
- name: publish-npm
6
-
7
- jobs:
8
- deploy-npm:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v3
12
- - uses: actions/setup-node@v3
13
- with:
14
- node-version-file: ".nvmrc"
15
- registry-url: "https://registry.npmjs.org"
16
- - run: npm install
17
- - run: npm run build
18
- - run: npm publish
19
- env:
20
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}