septor-store 1.3.5 → 1.3.6

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/dist/index.cjs CHANGED
@@ -224,7 +224,9 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
224
224
  var _a, _b, _c, _d, _e, _f, _g, _h;
225
225
  if (!this.CheckQueriesInQue[callApi]) {
226
226
  this.CheckQueriesInQue[callApi] = callApi;
227
- let [res] = await Promise.all([useFetch({ ...dataParams, config, axiosInstance })]);
227
+ let [res] = await Promise.all([
228
+ useFetch({ ...dataParams, config, axiosInstance })
229
+ ]);
228
230
  if (res == null ? void 0 : res.error) {
229
231
  const msg = { msg: "", error: true };
230
232
  if ((_b = (_a = res.error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error) {
@@ -238,6 +240,8 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
238
240
  if ((_h = (_g = (_f = (_e = res == null ? void 0 : res.error) == null ? void 0 : _e.response) == null ? void 0 : _f.data) == null ? void 0 : _g.payload) == null ? void 0 : _h.message) {
239
241
  msg.msg = res.error.response.data.payload.message;
240
242
  }
243
+ delete this.CheckQueriesInQue[callApi];
244
+ console.error(msg);
241
245
  return res;
242
246
  }
243
247
  if (res) {
@@ -291,7 +295,16 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
291
295
  axiosInstance: null
292
296
  }, fasterDataCollection = null) {
293
297
  this.Loading = true;
294
- const { reload, StateStore, reqs, time, pagnated, mStore, config, axiosInstance } = dd;
298
+ const {
299
+ reload,
300
+ StateStore,
301
+ reqs,
302
+ time,
303
+ pagnated,
304
+ mStore,
305
+ config,
306
+ axiosInstance
307
+ } = dd;
295
308
  const callApi = JSON.stringify(reqs);
296
309
  const StateVariable = await this.parseData(StateStore, mStore);
297
310
  this[StateStore] = StateVariable ?? [];
@@ -311,7 +324,7 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
311
324
  }
312
325
  if (this.CheckQueriesInQue[callApi]) {
313
326
  console.warn(
314
- `************************************* dont call this api again ${reqs["url"]} \u{1F6E9}\uFE0F *************************************`,
327
+ `************************************* dont call this api again ${reqs["url"]} \u{1F6E9}\uFE0F *************************************`,
315
328
  reqs
316
329
  );
317
330
  return;
package/dist/index.d.cts CHANGED
@@ -216,30 +216,34 @@ function createPomStore(
216
216
  ) {
217
217
  if (!this.CheckQueriesInQue[callApi]) {
218
218
  this.CheckQueriesInQue[callApi] = callApi;
219
- let [res] = await Promise.all([useFetch({ ...dataParams, config,axiosInstance })]);
219
+ let [res] = await Promise.all([
220
+ useFetch({ ...dataParams, config, axiosInstance }),
221
+ ]);
220
222
  // const collection=;
221
- if (res?.error) {
222
- const msg = { msg: ""};
223
- if (res.error.response?.data?.error) {
224
- msg.msg = res.error.response.data.error;
225
- } else if (res.error.message) {
226
- msg.msg = res.error.message;
227
- } else if (res.error.response?.data?.errors) {
228
- const errors = res.error.response.data.errors;
229
- msg.msg = Object.values(errors)[0][0] || msg.msg;
230
- }
231
- if (res?.error?.response?.data?.payload?.message) {
232
- msg.msg = res.error.response.data.payload.message;
233
- }
234
- return res
235
- }
236
-
223
+ if (res?.error) {
224
+ const msg = { msg: "", error: true };
225
+ if (res.error.response?.data?.error) {
226
+ msg.msg = res.error.response.data.error;
227
+ } else if (res.error.message) {
228
+ msg.msg = res.error.message;
229
+ } else if (res.error.response?.data?.errors) {
230
+ const errors = res.error.response.data.errors;
231
+ msg.msg = Object.values(errors)[0][0] || msg.msg;
232
+ }
233
+ if (res?.error?.response?.data?.payload?.message) {
234
+ msg.msg = res.error.response.data.payload.message;
235
+ }
236
+ delete this.CheckQueriesInQue[callApi];
237
+ console.error(msg);
237
238
 
239
+ return res;
240
+ }
238
241
 
239
242
  if (res) {
240
243
  this[StateStore] = res;
241
244
  if (mStore?.mUse) {
242
- const checkType =typeof res === "object" ? JSON.stringify(res) : res;
245
+ const checkType =
246
+ typeof res === "object" ? JSON.stringify(res) : res;
243
247
  sessionStorage.setItem(StateStore, JSON.stringify(checkType));
244
248
  }
245
249
  delete this.CheckQueriesInQue[callApi];
@@ -291,12 +295,21 @@ function createPomStore(
291
295
  time: 0,
292
296
  pagnated: false,
293
297
  mStore: { mUse: 0, reset: 0 },
294
- axiosInstance : null,
298
+ axiosInstance: null,
295
299
  },
296
300
  fasterDataCollection = null,
297
301
  ) {
298
302
  this.Loading = true;
299
- const { reload, StateStore, reqs, time, pagnated, mStore, config,axiosInstance } = dd;
303
+ const {
304
+ reload,
305
+ StateStore,
306
+ reqs,
307
+ time,
308
+ pagnated,
309
+ mStore,
310
+ config,
311
+ axiosInstance,
312
+ } = dd;
300
313
  const callApi = JSON.stringify(reqs);
301
314
  const StateVariable = await this.parseData(StateStore, mStore);
302
315
  this[StateStore] = StateVariable ?? [];
@@ -323,7 +336,7 @@ function createPomStore(
323
336
 
324
337
  if (this.CheckQueriesInQue[callApi]) {
325
338
  console.warn(
326
- `************************************* dont call this api again ${reqs["url"]} 🛩️ *************************************`,
339
+ `************************************* dont call this api again ${reqs["url"]} 🛩️ *************************************`,
327
340
  reqs,
328
341
  );
329
342
  return;
@@ -334,9 +347,8 @@ function createPomStore(
334
347
  if (typeof fasterDataCollection == "function")
335
348
  fasterDataCollection?.(StateVariable);
336
349
 
337
- console.log({counters,reload,StateStore});
350
+ console.log({ counters, reload, StateStore });
338
351
  if (counters > 0) {
339
-
340
352
  if (reload) {
341
353
  await this.sleep(1000 * time);
342
354
  return await this.CallApiData(
@@ -363,7 +375,7 @@ function createPomStore(
363
375
  pagnated,
364
376
  mStore,
365
377
  config,
366
- axiosInstance
378
+ axiosInstance,
367
379
  );
368
380
  } catch (error) {
369
381
  console.error(error);
package/dist/index.d.ts CHANGED
@@ -216,30 +216,34 @@ function createPomStore(
216
216
  ) {
217
217
  if (!this.CheckQueriesInQue[callApi]) {
218
218
  this.CheckQueriesInQue[callApi] = callApi;
219
- let [res] = await Promise.all([useFetch({ ...dataParams, config,axiosInstance })]);
219
+ let [res] = await Promise.all([
220
+ useFetch({ ...dataParams, config, axiosInstance }),
221
+ ]);
220
222
  // const collection=;
221
- if (res?.error) {
222
- const msg = { msg: ""};
223
- if (res.error.response?.data?.error) {
224
- msg.msg = res.error.response.data.error;
225
- } else if (res.error.message) {
226
- msg.msg = res.error.message;
227
- } else if (res.error.response?.data?.errors) {
228
- const errors = res.error.response.data.errors;
229
- msg.msg = Object.values(errors)[0][0] || msg.msg;
230
- }
231
- if (res?.error?.response?.data?.payload?.message) {
232
- msg.msg = res.error.response.data.payload.message;
233
- }
234
- return res
235
- }
236
-
223
+ if (res?.error) {
224
+ const msg = { msg: "", error: true };
225
+ if (res.error.response?.data?.error) {
226
+ msg.msg = res.error.response.data.error;
227
+ } else if (res.error.message) {
228
+ msg.msg = res.error.message;
229
+ } else if (res.error.response?.data?.errors) {
230
+ const errors = res.error.response.data.errors;
231
+ msg.msg = Object.values(errors)[0][0] || msg.msg;
232
+ }
233
+ if (res?.error?.response?.data?.payload?.message) {
234
+ msg.msg = res.error.response.data.payload.message;
235
+ }
236
+ delete this.CheckQueriesInQue[callApi];
237
+ console.error(msg);
237
238
 
239
+ return res;
240
+ }
238
241
 
239
242
  if (res) {
240
243
  this[StateStore] = res;
241
244
  if (mStore?.mUse) {
242
- const checkType =typeof res === "object" ? JSON.stringify(res) : res;
245
+ const checkType =
246
+ typeof res === "object" ? JSON.stringify(res) : res;
243
247
  sessionStorage.setItem(StateStore, JSON.stringify(checkType));
244
248
  }
245
249
  delete this.CheckQueriesInQue[callApi];
@@ -291,12 +295,21 @@ function createPomStore(
291
295
  time: 0,
292
296
  pagnated: false,
293
297
  mStore: { mUse: 0, reset: 0 },
294
- axiosInstance : null,
298
+ axiosInstance: null,
295
299
  },
296
300
  fasterDataCollection = null,
297
301
  ) {
298
302
  this.Loading = true;
299
- const { reload, StateStore, reqs, time, pagnated, mStore, config,axiosInstance } = dd;
303
+ const {
304
+ reload,
305
+ StateStore,
306
+ reqs,
307
+ time,
308
+ pagnated,
309
+ mStore,
310
+ config,
311
+ axiosInstance,
312
+ } = dd;
300
313
  const callApi = JSON.stringify(reqs);
301
314
  const StateVariable = await this.parseData(StateStore, mStore);
302
315
  this[StateStore] = StateVariable ?? [];
@@ -323,7 +336,7 @@ function createPomStore(
323
336
 
324
337
  if (this.CheckQueriesInQue[callApi]) {
325
338
  console.warn(
326
- `************************************* dont call this api again ${reqs["url"]} 🛩️ *************************************`,
339
+ `************************************* dont call this api again ${reqs["url"]} 🛩️ *************************************`,
327
340
  reqs,
328
341
  );
329
342
  return;
@@ -334,9 +347,8 @@ function createPomStore(
334
347
  if (typeof fasterDataCollection == "function")
335
348
  fasterDataCollection?.(StateVariable);
336
349
 
337
- console.log({counters,reload,StateStore});
350
+ console.log({ counters, reload, StateStore });
338
351
  if (counters > 0) {
339
-
340
352
  if (reload) {
341
353
  await this.sleep(1000 * time);
342
354
  return await this.CallApiData(
@@ -363,7 +375,7 @@ function createPomStore(
363
375
  pagnated,
364
376
  mStore,
365
377
  config,
366
- axiosInstance
378
+ axiosInstance,
367
379
  );
368
380
  } catch (error) {
369
381
  console.error(error);
package/dist/index.js CHANGED
@@ -183,7 +183,9 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
183
183
  var _a, _b, _c, _d, _e, _f, _g, _h;
184
184
  if (!this.CheckQueriesInQue[callApi]) {
185
185
  this.CheckQueriesInQue[callApi] = callApi;
186
- let [res] = await Promise.all([useFetch({ ...dataParams, config, axiosInstance })]);
186
+ let [res] = await Promise.all([
187
+ useFetch({ ...dataParams, config, axiosInstance })
188
+ ]);
187
189
  if (res == null ? void 0 : res.error) {
188
190
  const msg = { msg: "", error: true };
189
191
  if ((_b = (_a = res.error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error) {
@@ -197,6 +199,8 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
197
199
  if ((_h = (_g = (_f = (_e = res == null ? void 0 : res.error) == null ? void 0 : _e.response) == null ? void 0 : _f.data) == null ? void 0 : _g.payload) == null ? void 0 : _h.message) {
198
200
  msg.msg = res.error.response.data.payload.message;
199
201
  }
202
+ delete this.CheckQueriesInQue[callApi];
203
+ console.error(msg);
200
204
  return res;
201
205
  }
202
206
  if (res) {
@@ -250,7 +254,16 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
250
254
  axiosInstance: null
251
255
  }, fasterDataCollection = null) {
252
256
  this.Loading = true;
253
- const { reload, StateStore, reqs, time, pagnated, mStore, config, axiosInstance } = dd;
257
+ const {
258
+ reload,
259
+ StateStore,
260
+ reqs,
261
+ time,
262
+ pagnated,
263
+ mStore,
264
+ config,
265
+ axiosInstance
266
+ } = dd;
254
267
  const callApi = JSON.stringify(reqs);
255
268
  const StateVariable = await this.parseData(StateStore, mStore);
256
269
  this[StateStore] = StateVariable ?? [];
@@ -270,7 +283,7 @@ function createPomStore(piniaStore = "7286204094", callBack = null, ds = { State
270
283
  }
271
284
  if (this.CheckQueriesInQue[callApi]) {
272
285
  console.warn(
273
- `************************************* dont call this api again ${reqs["url"]} \u{1F6E9}\uFE0F *************************************`,
286
+ `************************************* dont call this api again ${reqs["url"]} \u{1F6E9}\uFE0F *************************************`,
274
287
  reqs
275
288
  );
276
289
  return;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A powerful, modular state management solution for Vue 3 applications, built on top of Pinia. Septor Store leverages the Plain Old Module (POM) pattern to provide dynamic store generation, intelligent API request handling, smart caching, and clean separation of concerns—making it ideal for scalable, maintainable, and high-performance frontend development.",
4
4
  "private": false,
5
5
  "license": "MIT",
6
- "version": "1.3.5",
6
+ "version": "1.3.6",
7
7
  "type": "module",
8
8
  "main": "dist/index.cjs",
9
9
  "module": "dist/index.js",