@zeniai/client-epic-state 5.3.7-betaRD0 → 5.3.7

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/lib/init.js CHANGED
@@ -36,10 +36,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.injectFeatureEpics = exports.injectFeatureModules = exports.store = exports.pusher = exports.initializePusher = exports.disconnectPusher = exports.setSessionEndpointsLoader = exports.zeniAPI = void 0;
39
+ exports.injectFeatureEpics = exports.injectFeatureModules = exports.store = exports.pusher = exports.initializePusher = exports.disconnectPusher = exports.zeniAPI = void 0;
40
40
  exports.default = initialize;
41
41
  exports.updateZeniAPIClientConfig = updateZeniAPIClientConfig;
42
- exports.updateZeniAPIEndpoints = updateZeniAPIEndpoints;
43
42
  exports.zeniAPIClientConfig = zeniAPIClientConfig;
44
43
  exports.initializeWithNewStore = initializeWithNewStore;
45
44
  exports.initialize3rdPartyExtensions = initialize3rdPartyExtensions;
@@ -48,8 +47,6 @@ const zeniAPI_1 = require("./zeniAPI");
48
47
  const zeniAPIClientState_1 = require("./zeniAPIClientState");
49
48
  var zeniAPIClientState_2 = require("./zeniAPIClientState");
50
49
  Object.defineProperty(exports, "zeniAPI", { enumerable: true, get: function () { return zeniAPIClientState_2.zeniAPI; } });
51
- var sessionEndpointsLoader_1 = require("./sessionEndpointsLoader");
52
- Object.defineProperty(exports, "setSessionEndpointsLoader", { enumerable: true, get: function () { return sessionEndpointsLoader_1.setSessionEndpointsLoader; } });
53
50
  var pusherClient_1 = require("./pusherClient");
54
51
  Object.defineProperty(exports, "disconnectPusher", { enumerable: true, get: function () { return pusherClient_1.disconnectPusher; } });
55
52
  Object.defineProperty(exports, "initializePusher", { enumerable: true, get: function () { return pusherClient_1.initializePusher; } });
@@ -63,10 +60,11 @@ let initialized = false;
63
60
  */
64
61
  function initialize(restEndPoints, userId, sessionId, tenantId, isSandboxEnv, onSessionInvalidated) {
65
62
  if (initialized) {
66
- console.warn('client-epic-state is already initialized');
63
+ console.warn(`Already initialized with url ${JSON.stringify(zeniAPIClientState_1.zeniAPI.apiEndPoints)}`);
67
64
  return exports.store;
68
65
  }
69
66
  initialized = true;
67
+ console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
70
68
  initialize3rdPartyExtensions();
71
69
  (0, zeniAPIClientState_1.setZeniAPIClient)(new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId, onSessionInvalidated));
72
70
  exports.store = (0, configureStore_1.default)(zeniAPIClientState_1.zeniAPI, isSandboxEnv);
@@ -86,18 +84,6 @@ Object.defineProperty(exports, "injectFeatureEpics", { enumerable: true, get: fu
86
84
  function updateZeniAPIClientConfig(userId, sessionId, tenantId) {
87
85
  zeniAPIClientState_1.zeniAPI.update(userId, sessionId, tenantId);
88
86
  }
89
- /**
90
- * Replace the REST endpoints the API client calls. Epics read the endpoints
91
- * at request time, so every request made after this uses the new ones.
92
- * Note: This version SHOULD BE used only in the client side.
93
- * @param restEndPoints
94
- */
95
- function updateZeniAPIEndpoints(restEndPoints) {
96
- if (zeniAPIClientState_1.zeniAPI == null) {
97
- throw new Error('Call initialize() before updateZeniAPIEndpoints()');
98
- }
99
- zeniAPIClientState_1.zeniAPI.apiEndPoints = restEndPoints;
100
- }
101
87
  /**
102
88
  * Returns current Zeni REST API client config.
103
89
  * @returns
@@ -124,6 +110,7 @@ function zeniAPIClientConfig() {
124
110
  * @param tenantId tenant id
125
111
  */
126
112
  async function initializeWithNewStore(restEndPoints, userId, sessionId, tenantId) {
113
+ console.info(`initializeWithNewStore with ${JSON.stringify(restEndPoints)}`);
127
114
  initialize3rdPartyExtensions();
128
115
  const zeniHttpClient = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
129
116
  const store = (0, configureStore_1.default)(zeniHttpClient, false);
@@ -29,10 +29,9 @@ const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe
29
29
  }
30
30
  let fetchState;
31
31
  if (accountId != null) {
32
- // Period bucket can be unhydrated during app-shell load.
33
32
  fetchState =
34
33
  accountReconciliationRecords[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]
35
- ?.reconciliationByAccountID[accountId]?.transactionFetchState
34
+ .reconciliationByAccountID[accountId].transactionFetchState
36
35
  .fetchState;
37
36
  }
38
37
  else {
package/lib/zeniAPI.d.ts CHANGED
@@ -25,7 +25,7 @@ export interface RESTAPIEndpoints {
25
25
  readonly tenantMicroServiceBaseUrl: string;
26
26
  }
27
27
  export interface ZeniAPI<ResponseType = FetchResponse> {
28
- apiEndPoints: RESTAPIEndpoints;
28
+ readonly apiEndPoints: RESTAPIEndpoints;
29
29
  readonly sessionId?: string;
30
30
  readonly tenantId?: string;
31
31
  readonly userId?: string;
@@ -40,7 +40,7 @@ export interface ZeniAPI<ResponseType = FetchResponse> {
40
40
  update(userId?: string, sessionId?: string, tenantId?: string): void;
41
41
  }
42
42
  export declare class ZeniAPIClient implements ZeniAPI {
43
- apiEndPoints: RESTAPIEndpoints;
43
+ readonly apiEndPoints: RESTAPIEndpoints;
44
44
  userId?: string | undefined;
45
45
  sessionId?: string | undefined;
46
46
  tenantId?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.3.7-betaRD0",
3
+ "version": "5.3.7",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -53,31 +53,6 @@
53
53
  "url": "https://github.com/zeni-ai/client-epic-state/issues"
54
54
  },
55
55
  "homepage": "https://github.com/zeni-ai/client-epic-state#readme",
56
- "devDependencies": {
57
- "@eslint/js": "^9.24.0",
58
- "@liveblocks/client": "^2.23.0",
59
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
60
- "@types/big.js": "^6.2.2",
61
- "@types/lodash": "^4.17.23",
62
- "@types/node": "^20.19.0",
63
- "@types/url-parse": "^1.4.11",
64
- "@typescript-eslint/eslint-plugin": "^8.56.0",
65
- "@typescript-eslint/parser": "^8.56.0",
66
- "concurrently": "^9.1.2",
67
- "eslint": "^9.24.0",
68
- "eslint-config-prettier": "^10.0.2",
69
- "eslint-plugin-perfectionist": "^4.15.0",
70
- "eslint-plugin-unused-imports": "^4.1.4",
71
- "globals": "^16.0.0",
72
- "knip": "^6.21.0",
73
- "madge": "^8.0.0",
74
- "prettier": "^3.5.3",
75
- "rimraf": "^6.0.1",
76
- "semver": "^7.7.1",
77
- "typescript": "^5.7.3",
78
- "vite": "^7.3.5",
79
- "vitest": "^4.1.11"
80
- },
81
56
  "dependencies": {
82
57
  "@redux-devtools/extension": "^3.3.0",
83
58
  "@reduxjs/toolkit": "^1.6.2",
@@ -1,7 +0,0 @@
1
- let sessionEndpointsLoader;
2
- export function setSessionEndpointsLoader(loader) {
3
- sessionEndpointsLoader = loader;
4
- }
5
- export function getSessionEndpointsLoader() {
6
- return sessionEndpointsLoader;
7
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Called after sign-in, before the user's tenants are fetched. The app uses it
3
- * to fetch the endpoints that are only served to a signed-in session and to
4
- * hand them to `updateZeniAPIEndpoints`. Without a loader, tenants are fetched
5
- * straight away with the endpoints given to `initialize`.
6
- */
7
- export type SessionEndpointsLoader = (userId: string, sessionId?: string) => Promise<void>;
8
- export declare function setSessionEndpointsLoader(loader: SessionEndpointsLoader | undefined): void;
9
- export declare function getSessionEndpointsLoader(): SessionEndpointsLoader | undefined;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setSessionEndpointsLoader = setSessionEndpointsLoader;
4
- exports.getSessionEndpointsLoader = getSessionEndpointsLoader;
5
- let sessionEndpointsLoader;
6
- function setSessionEndpointsLoader(loader) {
7
- sessionEndpointsLoader = loader;
8
- }
9
- function getSessionEndpointsLoader() {
10
- return sessionEndpointsLoader;
11
- }