aq-fe-framework 0.1.920 → 0.1.921

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.
@@ -19,10 +19,6 @@ import {
19
19
  utils_date,
20
20
  utils_mantineReactTable
21
21
  } from "./chunk-ZDINCHBS.mjs";
22
- import {
23
- const_object_colors,
24
- const_object_documentTypes
25
- } from "./chunk-SPG47QW7.mjs";
26
22
  import {
27
23
  baseColumns
28
24
  } from "./chunk-O7YCQQO5.mjs";
@@ -30,6 +26,10 @@ import {
30
26
  utils_date_dateToDDMMYYYString,
31
27
  utils_date_formatToDateTimeString
32
28
  } from "./chunk-QSWIVDXC.mjs";
29
+ import {
30
+ const_object_colors,
31
+ const_object_documentTypes
32
+ } from "./chunk-SPG47QW7.mjs";
33
33
  import {
34
34
  enum_daysOfWeek
35
35
  } from "./chunk-K6S7R6LU.mjs";
@@ -42,7 +42,7 @@ import {
42
42
  useMyReactMutation,
43
43
  useMyReactQuery,
44
44
  useQ_AQ_GetAQModule
45
- } from "./chunk-ILQU66MR.mjs";
45
+ } from "./chunk-X36ROB3X.mjs";
46
46
  import {
47
47
  utils_notification_show
48
48
  } from "./chunk-7ZCOFATU.mjs";
@@ -154,104 +154,6 @@ function createBaseApi(baseUrl, axiosInstance) {
154
154
  };
155
155
  }
156
156
 
157
- // src/hooks/custom-hooks/createBaseUrl.ts
158
- function createBaseUrl(baseUrl) {
159
- return {
160
- get: `${baseUrl}/get`,
161
- getAll: `${baseUrl}/GetAll`,
162
- create: `${baseUrl}/create`,
163
- update: `${baseUrl}/update`,
164
- updateList: `${baseUrl}/updateList`,
165
- createOrUpdateList: `${baseUrl}/createOrUpdateList`,
166
- delete: `${baseUrl}/delete`,
167
- deleteList: `${baseUrl}/deleteList`
168
- };
169
- }
170
-
171
- // src/hooks/custom-hooks/createMapper.ts
172
- function createMapper(fieldMap) {
173
- const toUi = (raw) => {
174
- const result = {};
175
- Object.entries(fieldMap).forEach(
176
- ([uiKey, mapping]) => {
177
- if (typeof mapping === "string") {
178
- result[uiKey] = raw[mapping];
179
- } else {
180
- result[uiKey] = mapping.toUi(raw);
181
- }
182
- }
183
- );
184
- return result;
185
- };
186
- const toApi = (ui, base = {}) => {
187
- const result = __spreadValues({}, base);
188
- Object.entries(fieldMap).forEach(
189
- ([uiKey, mapping]) => {
190
- const value = ui[uiKey];
191
- if (value === void 0) return;
192
- if (typeof mapping === "string") {
193
- result[mapping] = value;
194
- } else {
195
- Object.assign(result, mapping.toApi(value, result));
196
- }
197
- }
198
- );
199
- return result;
200
- };
201
- return { toUi, toApi };
202
- }
203
-
204
- // src/api/config/baseAxios.ts
205
- import axios from "axios";
206
- var baseAxios = axios.create({
207
- baseURL: ""
208
- // server
209
- // baseURL: process.env.NEXT_PUBLIC_API_LOCAL, // local debug
210
- });
211
- baseAxios.interceptors.request.use(
212
- (config) => {
213
- var _a, _b;
214
- const tokenData = localStorage.getItem("useStore_Authenticate");
215
- const state = JSON.parse(tokenData);
216
- const token = (_b = (_a = state == null ? void 0 : state.state) == null ? void 0 : _a.state) == null ? void 0 : _b.token;
217
- if (token) {
218
- config.headers.Authorization = `Bearer ${token}`;
219
- }
220
- return config;
221
- },
222
- (error) => {
223
- return Promise.reject(error);
224
- }
225
- );
226
- var baseAxios_default = baseAxios;
227
-
228
- // src/hooks/custom-hooks/createRepository.ts
229
- function createRepository(baseUrl, mapper, extra) {
230
- const base = {
231
- async getAll() {
232
- const { data } = await baseAxios_default.get(baseUrl);
233
- return data.map(mapper.toUi);
234
- },
235
- async getById(id) {
236
- const { data } = await baseAxios_default.get(`${baseUrl}/${id}`);
237
- return mapper.toUi(data);
238
- },
239
- async create(item) {
240
- const { data } = await baseAxios_default.post(baseUrl, mapper.toApi(item));
241
- return mapper.toUi(data);
242
- },
243
- async update(id, item) {
244
- const { data } = await baseAxios_default.put(`${baseUrl}/${id}`, mapper.toApi(item));
245
- return mapper.toUi(data);
246
- },
247
- async delete(id) {
248
- await baseAxios_default.delete(`${baseUrl}/${id}`);
249
- }
250
- };
251
- const custom = extra ? extra(baseAxios_default) : {};
252
- return __spreadValues(__spreadValues({}, base), custom);
253
- }
254
-
255
157
  // src/hooks/custom-hooks/useConfig.ts
256
158
  import { useQuery } from "@tanstack/react-query";
257
159
  async function fetchConfig(configPath) {
@@ -412,6 +314,30 @@ function useCrudService(service, queryKey) {
412
314
  };
413
315
  }
414
316
 
317
+ // src/api/config/baseAxios.ts
318
+ import axios from "axios";
319
+ var baseAxios = axios.create({
320
+ baseURL: ""
321
+ // server
322
+ // baseURL: process.env.NEXT_PUBLIC_API_LOCAL, // local debug
323
+ });
324
+ baseAxios.interceptors.request.use(
325
+ (config) => {
326
+ var _a, _b;
327
+ const tokenData = localStorage.getItem("useStore_Authenticate");
328
+ const state = JSON.parse(tokenData);
329
+ const token = (_b = (_a = state == null ? void 0 : state.state) == null ? void 0 : _a.state) == null ? void 0 : _b.token;
330
+ if (token) {
331
+ config.headers.Authorization = `Bearer ${token}`;
332
+ }
333
+ return config;
334
+ },
335
+ (error) => {
336
+ return Promise.reject(error);
337
+ }
338
+ );
339
+ var baseAxios_default = baseAxios;
340
+
415
341
  // src/hooks/custom-hooks/useLoadAxiosConfig.ts
416
342
  import { useEffect as useEffect2, useState as useState3 } from "react";
417
343
  var useLoadAxiosConfig = ({
@@ -468,14 +394,11 @@ export {
468
394
  useMyDevice,
469
395
  useMyRouter,
470
396
  createBaseApi,
471
- createBaseUrl,
472
- createMapper,
473
- baseAxios_default,
474
- createRepository,
475
397
  useConfig,
476
398
  useMyReactMutation,
477
399
  useMyReactQuery,
478
400
  useCrudService,
401
+ baseAxios_default,
479
402
  useLoadAxiosConfig,
480
403
  useQ_AQ_GetAQModule
481
404
  };
@@ -70,15 +70,15 @@ import {
70
70
  useHeaderMegaMenuStore,
71
71
  useS_ButtonImport,
72
72
  useStore_BasicAppShell
73
- } from "../chunk-STP3LXWU.mjs";
73
+ } from "../chunk-BOPXGBME.mjs";
74
74
  import "../chunk-QWHUDAPC.mjs";
75
75
  import "../chunk-E4JVWPXS.mjs";
76
76
  import "../chunk-ZDINCHBS.mjs";
77
- import "../chunk-SPG47QW7.mjs";
78
77
  import "../chunk-O7YCQQO5.mjs";
79
78
  import "../chunk-QSWIVDXC.mjs";
79
+ import "../chunk-SPG47QW7.mjs";
80
80
  import "../chunk-K6S7R6LU.mjs";
81
- import "../chunk-ILQU66MR.mjs";
81
+ import "../chunk-X36ROB3X.mjs";
82
82
  import "../chunk-WZ6PXGGC.mjs";
83
83
  import "../chunk-7ZCOFATU.mjs";
84
84
  import "../chunk-JD6AELXS.mjs";
@@ -31,15 +31,15 @@ import {
31
31
  MyStatsCard,
32
32
  MyTextInput2 as MyTextInput,
33
33
  MyWeeklySessionSchedulerPicker
34
- } from "../chunk-STP3LXWU.mjs";
34
+ } from "../chunk-BOPXGBME.mjs";
35
35
  import "../chunk-QWHUDAPC.mjs";
36
36
  import "../chunk-E4JVWPXS.mjs";
37
37
  import "../chunk-ZDINCHBS.mjs";
38
- import "../chunk-SPG47QW7.mjs";
39
38
  import "../chunk-O7YCQQO5.mjs";
40
39
  import "../chunk-QSWIVDXC.mjs";
40
+ import "../chunk-SPG47QW7.mjs";
41
41
  import "../chunk-K6S7R6LU.mjs";
42
- import "../chunk-ILQU66MR.mjs";
42
+ import "../chunk-X36ROB3X.mjs";
43
43
  import "../chunk-WZ6PXGGC.mjs";
44
44
  import "../chunk-7ZCOFATU.mjs";
45
45
  import "../chunk-JD6AELXS.mjs";
@@ -3,7 +3,6 @@ import { QueryKey, UseQueryOptions, UseQueryResult } from '@tanstack/react-query
3
3
  import * as _mantine_hooks from '@mantine/hooks';
4
4
  import * as _mantine_form from '@mantine/form';
5
5
  import { FormValidateInput } from '@mantine/form';
6
- import * as axios from 'axios';
7
6
  import { AxiosResponse, AxiosInstance } from 'axios';
8
7
  import { M as MyApiResponse, B as BaseApiType } from '../useMyReactMutation-BaxKHWOS.mjs';
9
8
  export { I as IPagingParams, a as MyReactMutationProps, c as createBaseApi, u as useMyReactMutation } from '../useMyReactMutation-BaxKHWOS.mjs';
@@ -52,40 +51,6 @@ declare function useMyRouter(): {
52
51
  prefetch(href: string, options?: next_dist_shared_lib_app_router_context_shared_runtime.PrefetchOptions): void;
53
52
  };
54
53
 
55
- declare function createBaseUrl(baseUrl: string): {
56
- get: string;
57
- getAll: string;
58
- create: string;
59
- update: string;
60
- updateList: string;
61
- createOrUpdateList: string;
62
- delete: string;
63
- deleteList: string;
64
- };
65
-
66
- interface Mapper<UI, API> {
67
- toUi: (raw: API) => UI;
68
- toApi: (item: Partial<UI>, currentApi?: Partial<API>) => Partial<API>;
69
- }
70
- type FieldMapping<UIField, API> = (keyof API & string) | {
71
- toUi: (raw: API) => UIField;
72
- toApi: (val: UIField, currentApi: Partial<API>) => Partial<API>;
73
- };
74
- declare function createMapper<UI, API>(fieldMap: {
75
- [K in keyof UI]: FieldMapping<UI[K], API>;
76
- }): Mapper<UI, API>;
77
-
78
- declare const baseAxios: axios.AxiosInstance;
79
-
80
- type CrudApi<UI, API> = {
81
- getAll: () => Promise<UI[]>;
82
- getById: (id: string) => Promise<UI>;
83
- create: (item: Partial<UI>) => Promise<UI>;
84
- update: (id: string, item: Partial<UI>) => Promise<UI>;
85
- delete: (id: string) => Promise<void>;
86
- };
87
- declare function createRepository<UI, API, Extra extends Record<string, any> = {}>(baseUrl: string, mapper: Mapper<UI, API>, extra?: (axios: typeof baseAxios) => Extra): CrudApi<UI, API> & Extra;
88
-
89
54
  declare function useConfig<T>({ configPath, key }: {
90
55
  configPath?: string;
91
56
  key: keyof T;
@@ -125,4 +90,4 @@ declare function useMyReactQuery<IRes, IBody, TData = IRes>({ queryKey, axiosFn,
125
90
 
126
91
  declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
127
92
 
128
- export { BaseApiType, type Mapper, MyApiResponse, type MyReactQueryProps, createBaseUrl, createMapper, createRepository, useConfig, useCreateUpdate, useCrudService, useEditableRows, useLoadAxiosConfig, useMyDevice, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
93
+ export { BaseApiType, MyApiResponse, type MyReactQueryProps, useConfig, useCreateUpdate, useCrudService, useEditableRows, useLoadAxiosConfig, useMyDevice, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
@@ -1,8 +1,5 @@
1
1
  import {
2
2
  createBaseApi,
3
- createBaseUrl,
4
- createMapper,
5
- createRepository,
6
3
  useConfig,
7
4
  useCreateUpdate,
8
5
  useCrudService,
@@ -13,15 +10,12 @@ import {
13
10
  useMyReactQuery,
14
11
  useMyRouter,
15
12
  useQ_AQ_GetAQModule
16
- } from "../chunk-ILQU66MR.mjs";
13
+ } from "../chunk-X36ROB3X.mjs";
17
14
  import "../chunk-WZ6PXGGC.mjs";
18
15
  import "../chunk-7ZCOFATU.mjs";
19
16
  import "../chunk-JD6AELXS.mjs";
20
17
  export {
21
18
  createBaseApi,
22
- createBaseUrl,
23
- createMapper,
24
- createRepository,
25
19
  useConfig,
26
20
  useCreateUpdate,
27
21
  useCrudService,
@@ -113,15 +113,15 @@ import {
113
113
  MailTemplateDeleteButton,
114
114
  useS_moduleConfig,
115
115
  useStore_Authenticate
116
- } from "../chunk-STP3LXWU.mjs";
116
+ } from "../chunk-BOPXGBME.mjs";
117
117
  import "../chunk-QWHUDAPC.mjs";
118
118
  import "../chunk-E4JVWPXS.mjs";
119
119
  import "../chunk-ZDINCHBS.mjs";
120
- import "../chunk-SPG47QW7.mjs";
121
120
  import "../chunk-O7YCQQO5.mjs";
122
121
  import "../chunk-QSWIVDXC.mjs";
122
+ import "../chunk-SPG47QW7.mjs";
123
123
  import "../chunk-K6S7R6LU.mjs";
124
- import "../chunk-ILQU66MR.mjs";
124
+ import "../chunk-X36ROB3X.mjs";
125
125
  import "../chunk-WZ6PXGGC.mjs";
126
126
  import "../chunk-7ZCOFATU.mjs";
127
127
  import "../chunk-JD6AELXS.mjs";
@@ -4,17 +4,17 @@ import {
4
4
  } from "../chunk-RGUQWALX.mjs";
5
5
  import {
6
6
  MySelect
7
- } from "../chunk-STP3LXWU.mjs";
7
+ } from "../chunk-BOPXGBME.mjs";
8
8
  import "../chunk-QWHUDAPC.mjs";
9
9
  import "../chunk-E4JVWPXS.mjs";
10
10
  import {
11
11
  utils_converter
12
12
  } from "../chunk-ZDINCHBS.mjs";
13
- import "../chunk-SPG47QW7.mjs";
14
13
  import "../chunk-O7YCQQO5.mjs";
15
14
  import "../chunk-QSWIVDXC.mjs";
15
+ import "../chunk-SPG47QW7.mjs";
16
16
  import "../chunk-K6S7R6LU.mjs";
17
- import "../chunk-ILQU66MR.mjs";
17
+ import "../chunk-X36ROB3X.mjs";
18
18
  import "../chunk-WZ6PXGGC.mjs";
19
19
  import "../chunk-7ZCOFATU.mjs";
20
20
  import {
package/package.json CHANGED
@@ -58,7 +58,7 @@
58
58
  "types": "./dist/types/index.d.mts"
59
59
  }
60
60
  },
61
- "version": "0.1.920",
61
+ "version": "0.1.921",
62
62
  "private": false,
63
63
  "files": [
64
64
  "dist"
@@ -128,6 +128,7 @@
128
128
  "glob": "^11.0.2",
129
129
  "json-server": "^1.0.0-beta.3",
130
130
  "ldrs": "^1.0.2",
131
+ "lodash": "^4.17.21",
131
132
  "lodash.debounce": "^4.0.8",
132
133
  "lucide-react": "^0.534.0",
133
134
  "mantine-react-table": "^2.0.0-beta.7",
@@ -146,6 +147,7 @@
146
147
  },
147
148
  "devDependencies": {
148
149
  "@types/file-saver": "^2.0.7",
150
+ "@types/lodash": "^4.17.20",
149
151
  "@types/node": "^20.17.30",
150
152
  "@types/pako": "^2.0.3",
151
153
  "@types/react": "^18.3.23",