@fctc/interface-logic 1.7.4 → 1.7.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/configs.d.mts +4 -1
- package/dist/configs.d.ts +4 -1
- package/dist/configs.js +12 -9
- package/dist/configs.mjs +12 -9
- package/dist/environment.d.mts +55 -35
- package/dist/environment.d.ts +55 -35
- package/dist/environment.js +1311 -1232
- package/dist/environment.mjs +1309 -1231
- package/dist/hooks.d.mts +2 -7
- package/dist/hooks.d.ts +2 -7
- package/dist/hooks.js +2175 -1896
- package/dist/hooks.mjs +2960 -2680
- package/dist/provider.js +329 -19
- package/dist/provider.mjs +329 -19
- package/dist/services.d.mts +1 -2
- package/dist/services.d.ts +1 -2
- package/dist/services.js +2001 -1706
- package/dist/services.mjs +2001 -1706
- package/dist/store.d.mts +28 -224
- package/dist/store.d.ts +28 -224
- package/dist/store.js +6 -20
- package/dist/store.mjs +6 -20
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{view-type-D8ukwj_2.d.mts → view-type-BGJfDe73.d.mts} +1 -1
- package/dist/{view-type-D8ukwj_2.d.ts → view-type-BGJfDe73.d.ts} +1 -1
- package/package.json +81 -81
package/dist/services.js
CHANGED
|
@@ -72,634 +72,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
72
72
|
return UriConstants2;
|
|
73
73
|
})(UriConstants || {});
|
|
74
74
|
|
|
75
|
-
// src/store/index.ts
|
|
76
|
-
var import_react_redux = require("react-redux");
|
|
77
|
-
|
|
78
|
-
// src/store/reducers/breadcrums-slice/index.ts
|
|
79
|
-
var import_toolkit = require("@reduxjs/toolkit");
|
|
80
|
-
var initialState = {
|
|
81
|
-
breadCrumbs: []
|
|
82
|
-
};
|
|
83
|
-
var breadcrumbsSlice = (0, import_toolkit.createSlice)({
|
|
84
|
-
name: "breadcrumbs",
|
|
85
|
-
initialState,
|
|
86
|
-
reducers: {
|
|
87
|
-
setBreadCrumbs: (state, action) => {
|
|
88
|
-
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
93
|
-
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
94
|
-
|
|
95
|
-
// src/store/reducers/env-slice/index.ts
|
|
96
|
-
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
97
|
-
var initialState2 = {
|
|
98
|
-
baseUrl: "",
|
|
99
|
-
companies: [],
|
|
100
|
-
user: {},
|
|
101
|
-
db: "",
|
|
102
|
-
refreshTokenEndpoint: "",
|
|
103
|
-
config: {
|
|
104
|
-
grantType: "",
|
|
105
|
-
clientId: "",
|
|
106
|
-
clientSecret: "",
|
|
107
|
-
redirectUri: ""
|
|
108
|
-
},
|
|
109
|
-
envFile: null,
|
|
110
|
-
requests: {
|
|
111
|
-
get: async (url, headers) => ({}),
|
|
112
|
-
post: async (url, body, headers) => ({}),
|
|
113
|
-
post_excel: async (url, body, headers) => ({}),
|
|
114
|
-
put: async (url, body, headers) => ({}),
|
|
115
|
-
patch: async (url, body) => ({}),
|
|
116
|
-
delete: async (url, body) => ({})
|
|
117
|
-
},
|
|
118
|
-
defaultCompany: {
|
|
119
|
-
id: null,
|
|
120
|
-
logo: "",
|
|
121
|
-
secondary_color: "",
|
|
122
|
-
primary_color: ""
|
|
123
|
-
},
|
|
124
|
-
context: {
|
|
125
|
-
uid: null,
|
|
126
|
-
allowed_company_ids: [],
|
|
127
|
-
lang: "vi_VN",
|
|
128
|
-
tz: "Asia/Saigon"
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
var envSlice = (0, import_toolkit2.createSlice)({
|
|
132
|
-
name: "env",
|
|
133
|
-
initialState: initialState2,
|
|
134
|
-
reducers: {
|
|
135
|
-
setEnv: (state, action) => {
|
|
136
|
-
Object.assign(state, action.payload);
|
|
137
|
-
},
|
|
138
|
-
setUid: (state, action) => {
|
|
139
|
-
state.context.uid = action.payload;
|
|
140
|
-
},
|
|
141
|
-
setAllowCompanies: (state, action) => {
|
|
142
|
-
state.context.allowed_company_ids = action.payload;
|
|
143
|
-
},
|
|
144
|
-
setCompanies: (state, action) => {
|
|
145
|
-
state.companies = action.payload;
|
|
146
|
-
},
|
|
147
|
-
setDefaultCompany: (state, action) => {
|
|
148
|
-
state.defaultCompany = action.payload;
|
|
149
|
-
},
|
|
150
|
-
setLang: (state, action) => {
|
|
151
|
-
state.context.lang = action.payload;
|
|
152
|
-
},
|
|
153
|
-
setUser: (state, action) => {
|
|
154
|
-
state.user = action.payload;
|
|
155
|
-
},
|
|
156
|
-
setConfig: (state, action) => {
|
|
157
|
-
state.config = action.payload;
|
|
158
|
-
},
|
|
159
|
-
setEnvFile: (state, action) => {
|
|
160
|
-
state.envFile = action.payload;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
var {
|
|
165
|
-
setEnv,
|
|
166
|
-
setUid,
|
|
167
|
-
setLang,
|
|
168
|
-
setAllowCompanies,
|
|
169
|
-
setCompanies,
|
|
170
|
-
setDefaultCompany,
|
|
171
|
-
setUser,
|
|
172
|
-
setConfig,
|
|
173
|
-
setEnvFile
|
|
174
|
-
} = envSlice.actions;
|
|
175
|
-
var env_slice_default = envSlice.reducer;
|
|
176
|
-
|
|
177
|
-
// src/store/reducers/excel-slice/index.ts
|
|
178
|
-
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
179
|
-
var initialState3 = {
|
|
180
|
-
dataParse: null,
|
|
181
|
-
idFile: null,
|
|
182
|
-
isFileLoaded: false,
|
|
183
|
-
loadingImport: false,
|
|
184
|
-
selectedFile: null,
|
|
185
|
-
errorData: null
|
|
186
|
-
};
|
|
187
|
-
var excelSlice = (0, import_toolkit3.createSlice)({
|
|
188
|
-
name: "excel",
|
|
189
|
-
initialState: initialState3,
|
|
190
|
-
reducers: {
|
|
191
|
-
setDataParse: (state, action) => {
|
|
192
|
-
state.dataParse = action.payload;
|
|
193
|
-
},
|
|
194
|
-
setIdFile: (state, action) => {
|
|
195
|
-
state.idFile = action.payload;
|
|
196
|
-
},
|
|
197
|
-
setIsFileLoaded: (state, action) => {
|
|
198
|
-
state.isFileLoaded = action.payload;
|
|
199
|
-
},
|
|
200
|
-
setLoadingImport: (state, action) => {
|
|
201
|
-
state.loadingImport = action.payload;
|
|
202
|
-
},
|
|
203
|
-
setSelectedFile: (state, action) => {
|
|
204
|
-
state.selectedFile = action.payload;
|
|
205
|
-
},
|
|
206
|
-
setErrorData: (state, action) => {
|
|
207
|
-
state.errorData = action.payload;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
var {
|
|
212
|
-
setDataParse,
|
|
213
|
-
setIdFile,
|
|
214
|
-
setIsFileLoaded,
|
|
215
|
-
setLoadingImport,
|
|
216
|
-
setSelectedFile,
|
|
217
|
-
setErrorData
|
|
218
|
-
} = excelSlice.actions;
|
|
219
|
-
var excel_slice_default = excelSlice.reducer;
|
|
220
|
-
|
|
221
|
-
// src/store/reducers/form-slice/index.ts
|
|
222
|
-
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
223
|
-
var initialState4 = {
|
|
224
|
-
viewDataStore: {},
|
|
225
|
-
isShowingModalDetail: false,
|
|
226
|
-
isShowModalTranslate: false,
|
|
227
|
-
formSubmitComponent: {},
|
|
228
|
-
fieldTranslation: null,
|
|
229
|
-
listSubject: {},
|
|
230
|
-
dataUser: {}
|
|
231
|
-
};
|
|
232
|
-
var formSlice = (0, import_toolkit4.createSlice)({
|
|
233
|
-
name: "form",
|
|
234
|
-
initialState: initialState4,
|
|
235
|
-
reducers: {
|
|
236
|
-
setViewDataStore: (state, action) => {
|
|
237
|
-
state.viewDataStore = action.payload;
|
|
238
|
-
},
|
|
239
|
-
setIsShowingModalDetail: (state, action) => {
|
|
240
|
-
state.isShowingModalDetail = action.payload;
|
|
241
|
-
},
|
|
242
|
-
setIsShowModalTranslate: (state, action) => {
|
|
243
|
-
state.isShowModalTranslate = action.payload;
|
|
244
|
-
},
|
|
245
|
-
setFormSubmitComponent: (state, action) => {
|
|
246
|
-
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
247
|
-
},
|
|
248
|
-
setFieldTranslate: (state, action) => {
|
|
249
|
-
state.fieldTranslation = action.payload;
|
|
250
|
-
},
|
|
251
|
-
setListSubject: (state, action) => {
|
|
252
|
-
state.listSubject = action.payload;
|
|
253
|
-
},
|
|
254
|
-
setDataUser: (state, action) => {
|
|
255
|
-
state.dataUser = action.payload;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
var {
|
|
260
|
-
setViewDataStore,
|
|
261
|
-
setIsShowingModalDetail,
|
|
262
|
-
setIsShowModalTranslate,
|
|
263
|
-
setFormSubmitComponent,
|
|
264
|
-
setFieldTranslate,
|
|
265
|
-
setListSubject,
|
|
266
|
-
setDataUser
|
|
267
|
-
} = formSlice.actions;
|
|
268
|
-
var form_slice_default = formSlice.reducer;
|
|
269
|
-
|
|
270
|
-
// src/store/reducers/header-slice/index.ts
|
|
271
|
-
var import_toolkit5 = require("@reduxjs/toolkit");
|
|
272
|
-
var headerSlice = (0, import_toolkit5.createSlice)({
|
|
273
|
-
name: "header",
|
|
274
|
-
initialState: {
|
|
275
|
-
value: { allowedCompanyIds: [] }
|
|
276
|
-
},
|
|
277
|
-
reducers: {
|
|
278
|
-
setHeader: (state, action) => {
|
|
279
|
-
state.value = { ...state.value, ...action.payload };
|
|
280
|
-
},
|
|
281
|
-
setAllowedCompanyIds: (state, action) => {
|
|
282
|
-
state.value.allowedCompanyIds = action.payload;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
287
|
-
var header_slice_default = headerSlice.reducer;
|
|
288
|
-
|
|
289
|
-
// src/store/reducers/list-slice/index.ts
|
|
290
|
-
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
291
|
-
var initialState5 = {
|
|
292
|
-
pageLimit: 10,
|
|
293
|
-
fields: {},
|
|
294
|
-
order: "",
|
|
295
|
-
selectedRowKeys: [],
|
|
296
|
-
selectedRadioKey: 0,
|
|
297
|
-
indexRowTableModal: -2,
|
|
298
|
-
isUpdateTableModal: false,
|
|
299
|
-
footerGroupTable: {},
|
|
300
|
-
transferDetail: null,
|
|
301
|
-
page: 0,
|
|
302
|
-
domainTable: []
|
|
303
|
-
};
|
|
304
|
-
var listSlice = (0, import_toolkit6.createSlice)({
|
|
305
|
-
name: "list",
|
|
306
|
-
initialState: initialState5,
|
|
307
|
-
reducers: {
|
|
308
|
-
setPageLimit: (state, action) => {
|
|
309
|
-
state.pageLimit = action.payload;
|
|
310
|
-
},
|
|
311
|
-
setFields: (state, action) => {
|
|
312
|
-
state.fields = action.payload;
|
|
313
|
-
},
|
|
314
|
-
setOrder: (state, action) => {
|
|
315
|
-
state.order = action.payload;
|
|
316
|
-
},
|
|
317
|
-
setSelectedRowKeys: (state, action) => {
|
|
318
|
-
state.selectedRowKeys = action.payload;
|
|
319
|
-
},
|
|
320
|
-
setSelectedRadioKey: (state, action) => {
|
|
321
|
-
state.selectedRadioKey = action.payload;
|
|
322
|
-
},
|
|
323
|
-
setIndexRowTableModal: (state, action) => {
|
|
324
|
-
state.indexRowTableModal = action.payload;
|
|
325
|
-
},
|
|
326
|
-
setTransferDetail: (state, action) => {
|
|
327
|
-
state.transferDetail = action.payload;
|
|
328
|
-
},
|
|
329
|
-
setIsUpdateTableModal: (state, action) => {
|
|
330
|
-
state.isUpdateTableModal = action.payload;
|
|
331
|
-
},
|
|
332
|
-
setPage: (state, action) => {
|
|
333
|
-
state.page = action.payload;
|
|
334
|
-
},
|
|
335
|
-
setDomainTable: (state, action) => {
|
|
336
|
-
state.domainTable = action.payload;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
var {
|
|
341
|
-
setPageLimit,
|
|
342
|
-
setFields,
|
|
343
|
-
setOrder,
|
|
344
|
-
setSelectedRowKeys,
|
|
345
|
-
setIndexRowTableModal,
|
|
346
|
-
setIsUpdateTableModal,
|
|
347
|
-
setPage,
|
|
348
|
-
setSelectedRadioKey,
|
|
349
|
-
setTransferDetail,
|
|
350
|
-
setDomainTable
|
|
351
|
-
} = listSlice.actions;
|
|
352
|
-
var list_slice_default = listSlice.reducer;
|
|
353
|
-
|
|
354
|
-
// src/store/reducers/login-slice/index.ts
|
|
355
|
-
var import_toolkit7 = require("@reduxjs/toolkit");
|
|
356
|
-
var initialState6 = {
|
|
357
|
-
db: "",
|
|
358
|
-
redirectTo: "/",
|
|
359
|
-
forgotPasswordUrl: "/"
|
|
360
|
-
};
|
|
361
|
-
var loginSlice = (0, import_toolkit7.createSlice)({
|
|
362
|
-
name: "login",
|
|
363
|
-
initialState: initialState6,
|
|
364
|
-
reducers: {
|
|
365
|
-
setDb: (state, action) => {
|
|
366
|
-
state.db = action.payload;
|
|
367
|
-
},
|
|
368
|
-
setRedirectTo: (state, action) => {
|
|
369
|
-
state.redirectTo = action.payload;
|
|
370
|
-
},
|
|
371
|
-
setForgotPasswordUrl: (state, action) => {
|
|
372
|
-
state.forgotPasswordUrl = action.payload;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
377
|
-
var login_slice_default = loginSlice.reducer;
|
|
378
|
-
|
|
379
|
-
// src/store/reducers/navbar-slice/index.ts
|
|
380
|
-
var import_toolkit8 = require("@reduxjs/toolkit");
|
|
381
|
-
var initialState7 = {
|
|
382
|
-
menuFocus: {},
|
|
383
|
-
menuAction: {},
|
|
384
|
-
navbarWidth: 250,
|
|
385
|
-
menuList: []
|
|
386
|
-
};
|
|
387
|
-
var navbarSlice = (0, import_toolkit8.createSlice)({
|
|
388
|
-
name: "navbar",
|
|
389
|
-
initialState: initialState7,
|
|
390
|
-
reducers: {
|
|
391
|
-
setMenuFocus: (state, action) => {
|
|
392
|
-
state.menuFocus = action.payload;
|
|
393
|
-
},
|
|
394
|
-
setMenuFocusAction: (state, action) => {
|
|
395
|
-
state.menuAction = action.payload;
|
|
396
|
-
},
|
|
397
|
-
setNavbarWidth: (state, action) => {
|
|
398
|
-
state.navbarWidth = action.payload;
|
|
399
|
-
},
|
|
400
|
-
setMenuList: (state, action) => {
|
|
401
|
-
state.menuList = action.payload;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
406
|
-
var navbar_slice_default = navbarSlice.reducer;
|
|
407
|
-
|
|
408
|
-
// src/store/reducers/profile-slice/index.ts
|
|
409
|
-
var import_toolkit9 = require("@reduxjs/toolkit");
|
|
410
|
-
var initialState8 = {
|
|
411
|
-
profile: {}
|
|
412
|
-
};
|
|
413
|
-
var profileSlice = (0, import_toolkit9.createSlice)({
|
|
414
|
-
name: "profile",
|
|
415
|
-
initialState: initialState8,
|
|
416
|
-
reducers: {
|
|
417
|
-
setProfile: (state, action) => {
|
|
418
|
-
state.profile = action.payload;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
var { setProfile } = profileSlice.actions;
|
|
423
|
-
var profile_slice_default = profileSlice.reducer;
|
|
424
|
-
|
|
425
|
-
// src/store/reducers/search-slice/index.ts
|
|
426
|
-
var import_toolkit10 = require("@reduxjs/toolkit");
|
|
427
|
-
var initialState9 = {
|
|
428
|
-
groupByDomain: null,
|
|
429
|
-
searchBy: [],
|
|
430
|
-
searchString: "",
|
|
431
|
-
hoveredIndexSearchList: null,
|
|
432
|
-
selectedTags: [],
|
|
433
|
-
firstDomain: null,
|
|
434
|
-
searchMap: {},
|
|
435
|
-
filterBy: [],
|
|
436
|
-
groupBy: []
|
|
437
|
-
};
|
|
438
|
-
var searchSlice = (0, import_toolkit10.createSlice)({
|
|
439
|
-
name: "search",
|
|
440
|
-
initialState: initialState9,
|
|
441
|
-
reducers: {
|
|
442
|
-
setGroupByDomain: (state, action) => {
|
|
443
|
-
state.groupByDomain = action.payload;
|
|
444
|
-
},
|
|
445
|
-
setSearchBy: (state, action) => {
|
|
446
|
-
state.searchBy = action.payload;
|
|
447
|
-
},
|
|
448
|
-
setSearchString: (state, action) => {
|
|
449
|
-
state.searchString = action.payload;
|
|
450
|
-
},
|
|
451
|
-
setHoveredIndexSearchList: (state, action) => {
|
|
452
|
-
state.hoveredIndexSearchList = action.payload;
|
|
453
|
-
},
|
|
454
|
-
setSelectedTags: (state, action) => {
|
|
455
|
-
state.selectedTags = action.payload;
|
|
456
|
-
},
|
|
457
|
-
setFirstDomain: (state, action) => {
|
|
458
|
-
state.firstDomain = action.payload;
|
|
459
|
-
},
|
|
460
|
-
setFilterBy: (state, action) => {
|
|
461
|
-
state.filterBy = action.payload;
|
|
462
|
-
},
|
|
463
|
-
setGroupBy: (state, action) => {
|
|
464
|
-
state.groupBy = action.payload;
|
|
465
|
-
},
|
|
466
|
-
setSearchMap: (state, action) => {
|
|
467
|
-
state.searchMap = action.payload;
|
|
468
|
-
},
|
|
469
|
-
updateSearchMap: (state, action) => {
|
|
470
|
-
if (!state.searchMap[action.payload.key]) {
|
|
471
|
-
state.searchMap[action.payload.key] = [];
|
|
472
|
-
}
|
|
473
|
-
state.searchMap[action.payload.key].push(action.payload.value);
|
|
474
|
-
},
|
|
475
|
-
removeKeyFromSearchMap: (state, action) => {
|
|
476
|
-
const { key, item } = action.payload;
|
|
477
|
-
const values = state.searchMap[key];
|
|
478
|
-
if (!values) return;
|
|
479
|
-
if (item) {
|
|
480
|
-
const filtered = values.filter((value) => value.name !== item.name);
|
|
481
|
-
if (filtered.length > 0) {
|
|
482
|
-
state.searchMap[key] = filtered;
|
|
483
|
-
} else {
|
|
484
|
-
delete state.searchMap[key];
|
|
485
|
-
}
|
|
486
|
-
} else {
|
|
487
|
-
delete state.searchMap[key];
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
clearSearchMap: (state) => {
|
|
491
|
-
state.searchMap = {};
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
var {
|
|
496
|
-
setGroupByDomain,
|
|
497
|
-
setSelectedTags,
|
|
498
|
-
setSearchString,
|
|
499
|
-
setHoveredIndexSearchList,
|
|
500
|
-
setFirstDomain,
|
|
501
|
-
setSearchBy,
|
|
502
|
-
setFilterBy,
|
|
503
|
-
setSearchMap,
|
|
504
|
-
updateSearchMap,
|
|
505
|
-
removeKeyFromSearchMap,
|
|
506
|
-
setGroupBy,
|
|
507
|
-
clearSearchMap
|
|
508
|
-
} = searchSlice.actions;
|
|
509
|
-
var search_slice_default = searchSlice.reducer;
|
|
510
|
-
|
|
511
|
-
// src/store/store.ts
|
|
512
|
-
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
513
|
-
|
|
514
|
-
// node_modules/redux/dist/redux.mjs
|
|
515
|
-
function formatProdErrorMessage(code) {
|
|
516
|
-
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
517
|
-
}
|
|
518
|
-
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
519
|
-
var ActionTypes = {
|
|
520
|
-
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
521
|
-
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
522
|
-
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
523
|
-
};
|
|
524
|
-
var actionTypes_default = ActionTypes;
|
|
525
|
-
function isPlainObject(obj) {
|
|
526
|
-
if (typeof obj !== "object" || obj === null)
|
|
527
|
-
return false;
|
|
528
|
-
let proto = obj;
|
|
529
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
530
|
-
proto = Object.getPrototypeOf(proto);
|
|
531
|
-
}
|
|
532
|
-
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
533
|
-
}
|
|
534
|
-
function miniKindOf(val) {
|
|
535
|
-
if (val === void 0)
|
|
536
|
-
return "undefined";
|
|
537
|
-
if (val === null)
|
|
538
|
-
return "null";
|
|
539
|
-
const type = typeof val;
|
|
540
|
-
switch (type) {
|
|
541
|
-
case "boolean":
|
|
542
|
-
case "string":
|
|
543
|
-
case "number":
|
|
544
|
-
case "symbol":
|
|
545
|
-
case "function": {
|
|
546
|
-
return type;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
if (Array.isArray(val))
|
|
550
|
-
return "array";
|
|
551
|
-
if (isDate(val))
|
|
552
|
-
return "date";
|
|
553
|
-
if (isError(val))
|
|
554
|
-
return "error";
|
|
555
|
-
const constructorName = ctorName(val);
|
|
556
|
-
switch (constructorName) {
|
|
557
|
-
case "Symbol":
|
|
558
|
-
case "Promise":
|
|
559
|
-
case "WeakMap":
|
|
560
|
-
case "WeakSet":
|
|
561
|
-
case "Map":
|
|
562
|
-
case "Set":
|
|
563
|
-
return constructorName;
|
|
564
|
-
}
|
|
565
|
-
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
566
|
-
}
|
|
567
|
-
function ctorName(val) {
|
|
568
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
569
|
-
}
|
|
570
|
-
function isError(val) {
|
|
571
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
572
|
-
}
|
|
573
|
-
function isDate(val) {
|
|
574
|
-
if (val instanceof Date)
|
|
575
|
-
return true;
|
|
576
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
577
|
-
}
|
|
578
|
-
function kindOf(val) {
|
|
579
|
-
let typeOfVal = typeof val;
|
|
580
|
-
if (process.env.NODE_ENV !== "production") {
|
|
581
|
-
typeOfVal = miniKindOf(val);
|
|
582
|
-
}
|
|
583
|
-
return typeOfVal;
|
|
584
|
-
}
|
|
585
|
-
function warning(message) {
|
|
586
|
-
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
587
|
-
console.error(message);
|
|
588
|
-
}
|
|
589
|
-
try {
|
|
590
|
-
throw new Error(message);
|
|
591
|
-
} catch (e) {
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
595
|
-
const reducerKeys = Object.keys(reducers);
|
|
596
|
-
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
597
|
-
if (reducerKeys.length === 0) {
|
|
598
|
-
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
599
|
-
}
|
|
600
|
-
if (!isPlainObject(inputState)) {
|
|
601
|
-
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
602
|
-
}
|
|
603
|
-
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
604
|
-
unexpectedKeys.forEach((key) => {
|
|
605
|
-
unexpectedKeyCache[key] = true;
|
|
606
|
-
});
|
|
607
|
-
if (action && action.type === actionTypes_default.REPLACE)
|
|
608
|
-
return;
|
|
609
|
-
if (unexpectedKeys.length > 0) {
|
|
610
|
-
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
function assertReducerShape(reducers) {
|
|
614
|
-
Object.keys(reducers).forEach((key) => {
|
|
615
|
-
const reducer = reducers[key];
|
|
616
|
-
const initialState10 = reducer(void 0, {
|
|
617
|
-
type: actionTypes_default.INIT
|
|
618
|
-
});
|
|
619
|
-
if (typeof initialState10 === "undefined") {
|
|
620
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
621
|
-
}
|
|
622
|
-
if (typeof reducer(void 0, {
|
|
623
|
-
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
624
|
-
}) === "undefined") {
|
|
625
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
function combineReducers(reducers) {
|
|
630
|
-
const reducerKeys = Object.keys(reducers);
|
|
631
|
-
const finalReducers = {};
|
|
632
|
-
for (let i = 0; i < reducerKeys.length; i++) {
|
|
633
|
-
const key = reducerKeys[i];
|
|
634
|
-
if (process.env.NODE_ENV !== "production") {
|
|
635
|
-
if (typeof reducers[key] === "undefined") {
|
|
636
|
-
warning(`No reducer provided for key "${key}"`);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
if (typeof reducers[key] === "function") {
|
|
640
|
-
finalReducers[key] = reducers[key];
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
const finalReducerKeys = Object.keys(finalReducers);
|
|
644
|
-
let unexpectedKeyCache;
|
|
645
|
-
if (process.env.NODE_ENV !== "production") {
|
|
646
|
-
unexpectedKeyCache = {};
|
|
647
|
-
}
|
|
648
|
-
let shapeAssertionError;
|
|
649
|
-
try {
|
|
650
|
-
assertReducerShape(finalReducers);
|
|
651
|
-
} catch (e) {
|
|
652
|
-
shapeAssertionError = e;
|
|
653
|
-
}
|
|
654
|
-
return function combination(state = {}, action) {
|
|
655
|
-
if (shapeAssertionError) {
|
|
656
|
-
throw shapeAssertionError;
|
|
657
|
-
}
|
|
658
|
-
if (process.env.NODE_ENV !== "production") {
|
|
659
|
-
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
660
|
-
if (warningMessage) {
|
|
661
|
-
warning(warningMessage);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
let hasChanged = false;
|
|
665
|
-
const nextState = {};
|
|
666
|
-
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
667
|
-
const key = finalReducerKeys[i];
|
|
668
|
-
const reducer = finalReducers[key];
|
|
669
|
-
const previousStateForKey = state[key];
|
|
670
|
-
const nextStateForKey = reducer(previousStateForKey, action);
|
|
671
|
-
if (typeof nextStateForKey === "undefined") {
|
|
672
|
-
const actionType = action && action.type;
|
|
673
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
674
|
-
}
|
|
675
|
-
nextState[key] = nextStateForKey;
|
|
676
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
677
|
-
}
|
|
678
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
679
|
-
return hasChanged ? nextState : state;
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
// src/store/store.ts
|
|
684
|
-
var rootReducer = combineReducers({
|
|
685
|
-
env: env_slice_default,
|
|
686
|
-
header: header_slice_default,
|
|
687
|
-
navbar: navbar_slice_default,
|
|
688
|
-
list: list_slice_default,
|
|
689
|
-
search: search_slice_default,
|
|
690
|
-
form: form_slice_default,
|
|
691
|
-
breadcrumbs: breadcrums_slice_default,
|
|
692
|
-
login: login_slice_default,
|
|
693
|
-
excel: excel_slice_default,
|
|
694
|
-
profile: profile_slice_default
|
|
695
|
-
});
|
|
696
|
-
var envStore = (0, import_toolkit11.configureStore)({
|
|
697
|
-
reducer: rootReducer,
|
|
698
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
699
|
-
serializableCheck: false
|
|
700
|
-
})
|
|
701
|
-
});
|
|
702
|
-
|
|
703
75
|
// src/configs/axios-client.ts
|
|
704
76
|
var import_axios = __toESM(require("axios"));
|
|
705
77
|
|
|
@@ -1642,1188 +1014,2124 @@ var PyTime = class _PyTime extends PyDate {
|
|
|
1642
1014
|
}
|
|
1643
1015
|
});
|
|
1644
1016
|
}
|
|
1645
|
-
toJSON() {
|
|
1646
|
-
return this.strftime("%H:%M:%S");
|
|
1017
|
+
toJSON() {
|
|
1018
|
+
return this.strftime("%H:%M:%S");
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
var DAYS_IN_YEAR = [
|
|
1022
|
+
31,
|
|
1023
|
+
59,
|
|
1024
|
+
90,
|
|
1025
|
+
120,
|
|
1026
|
+
151,
|
|
1027
|
+
181,
|
|
1028
|
+
212,
|
|
1029
|
+
243,
|
|
1030
|
+
273,
|
|
1031
|
+
304,
|
|
1032
|
+
334,
|
|
1033
|
+
366
|
|
1034
|
+
];
|
|
1035
|
+
var TIME_PERIODS = ["hour", "minute", "second"];
|
|
1036
|
+
var PERIODS = ["year", "month", "day", ...TIME_PERIODS];
|
|
1037
|
+
var RELATIVE_KEYS = "years months weeks days hours minutes seconds microseconds leapdays".split(
|
|
1038
|
+
" "
|
|
1039
|
+
);
|
|
1040
|
+
var ABSOLUTE_KEYS = "year month day hour minute second microsecond weekday nlyearday yearday".split(
|
|
1041
|
+
" "
|
|
1042
|
+
);
|
|
1043
|
+
var argsSpec = ["dt1", "dt2"];
|
|
1044
|
+
var PyRelativeDelta = class _PyRelativeDelta {
|
|
1045
|
+
static create(...args) {
|
|
1046
|
+
const params = parseArgs(args, argsSpec);
|
|
1047
|
+
if ("dt1" in params) {
|
|
1048
|
+
throw new Error("relativedelta(dt1, dt2) is not supported for now");
|
|
1049
|
+
}
|
|
1050
|
+
for (const period of PERIODS) {
|
|
1051
|
+
if (period in params) {
|
|
1052
|
+
const val = params[period];
|
|
1053
|
+
assert(val >= 0, `${period} ${val} is out of range`);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
for (const key of RELATIVE_KEYS) {
|
|
1057
|
+
params[key] = params[key] || 0;
|
|
1058
|
+
}
|
|
1059
|
+
for (const key of ABSOLUTE_KEYS) {
|
|
1060
|
+
params[key] = key in params ? params[key] : null;
|
|
1061
|
+
}
|
|
1062
|
+
params.days += 7 * params.weeks;
|
|
1063
|
+
let yearDay = 0;
|
|
1064
|
+
if (params.nlyearday) {
|
|
1065
|
+
yearDay = params.nlyearday;
|
|
1066
|
+
} else if (params.yearday) {
|
|
1067
|
+
yearDay = params.yearday;
|
|
1068
|
+
if (yearDay > 59) {
|
|
1069
|
+
params.leapDays = -1;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
if (yearDay) {
|
|
1073
|
+
for (let monthIndex = 0; monthIndex < DAYS_IN_YEAR.length; monthIndex++) {
|
|
1074
|
+
if (yearDay <= DAYS_IN_YEAR[monthIndex]) {
|
|
1075
|
+
params.month = monthIndex + 1;
|
|
1076
|
+
if (monthIndex === 0) {
|
|
1077
|
+
params.day = yearDay;
|
|
1078
|
+
} else {
|
|
1079
|
+
params.day = yearDay - DAYS_IN_YEAR[monthIndex - 1];
|
|
1080
|
+
}
|
|
1081
|
+
break;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return new _PyRelativeDelta(params);
|
|
1086
|
+
}
|
|
1087
|
+
static add(date, delta) {
|
|
1088
|
+
if (!(date instanceof PyDate || date instanceof PyDateTime)) {
|
|
1089
|
+
throw new NotSupportedError();
|
|
1090
|
+
}
|
|
1091
|
+
const s = tmxxx(
|
|
1092
|
+
(delta.year || date.year) + delta.years,
|
|
1093
|
+
(delta.month || date.month) + delta.months,
|
|
1094
|
+
delta.day || date.day,
|
|
1095
|
+
delta.hour || (date instanceof PyDateTime ? date.hour : 0),
|
|
1096
|
+
delta.minute || (date instanceof PyDateTime ? date.minute : 0),
|
|
1097
|
+
delta.second || (date instanceof PyDateTime ? date.second : 0),
|
|
1098
|
+
delta.microseconds || (date instanceof PyDateTime ? date.microsecond : 0)
|
|
1099
|
+
);
|
|
1100
|
+
const newDateTime = new PyDateTime(
|
|
1101
|
+
s.year,
|
|
1102
|
+
s.month,
|
|
1103
|
+
s.day,
|
|
1104
|
+
s.hour,
|
|
1105
|
+
s.minute,
|
|
1106
|
+
s.second,
|
|
1107
|
+
s.microsecond
|
|
1108
|
+
);
|
|
1109
|
+
let leapDays = 0;
|
|
1110
|
+
if (delta.leapDays && newDateTime.month > 2 && isLeap(newDateTime.year)) {
|
|
1111
|
+
leapDays = delta.leapDays;
|
|
1112
|
+
}
|
|
1113
|
+
const temp = newDateTime.add(
|
|
1114
|
+
PyTimeDelta.create({
|
|
1115
|
+
days: delta.days + leapDays,
|
|
1116
|
+
hours: delta.hours,
|
|
1117
|
+
minutes: delta.minutes,
|
|
1118
|
+
seconds: delta.seconds,
|
|
1119
|
+
microseconds: delta.microseconds
|
|
1120
|
+
})
|
|
1121
|
+
);
|
|
1122
|
+
const hasTime = Boolean(
|
|
1123
|
+
temp.hour || temp.minute || temp.second || temp.microsecond
|
|
1124
|
+
);
|
|
1125
|
+
const returnDate = !hasTime && date instanceof PyDate ? new PyDate(temp.year, temp.month, temp.day) : temp;
|
|
1126
|
+
if (delta.weekday !== null) {
|
|
1127
|
+
const wantedDow = delta.weekday + 1;
|
|
1128
|
+
const _date = new Date(
|
|
1129
|
+
returnDate.year,
|
|
1130
|
+
returnDate.month - 1,
|
|
1131
|
+
returnDate.day
|
|
1132
|
+
);
|
|
1133
|
+
const days = (7 - _date.getDay() + wantedDow) % 7;
|
|
1134
|
+
return returnDate.add(new PyTimeDelta(days, 0, 0));
|
|
1135
|
+
}
|
|
1136
|
+
return returnDate;
|
|
1137
|
+
}
|
|
1138
|
+
static substract(date, delta) {
|
|
1139
|
+
return _PyRelativeDelta.add(date, delta.negate());
|
|
1140
|
+
}
|
|
1141
|
+
constructor(params = {}, sign = 1) {
|
|
1142
|
+
this.years = sign * params.years;
|
|
1143
|
+
this.months = sign * params.months;
|
|
1144
|
+
this.days = sign * params.days;
|
|
1145
|
+
this.hours = sign * params.hours;
|
|
1146
|
+
this.minutes = sign * params.minutes;
|
|
1147
|
+
this.seconds = sign * params.seconds;
|
|
1148
|
+
this.microseconds = sign * params.microseconds;
|
|
1149
|
+
this.leapDays = params.leapDays;
|
|
1150
|
+
this.year = params.year;
|
|
1151
|
+
this.month = params.month;
|
|
1152
|
+
this.day = params.day;
|
|
1153
|
+
this.hour = params.hour;
|
|
1154
|
+
this.minute = params.minute;
|
|
1155
|
+
this.second = params.second;
|
|
1156
|
+
this.microsecond = params.microsecond;
|
|
1157
|
+
this.weekday = params.weekday;
|
|
1158
|
+
}
|
|
1159
|
+
years;
|
|
1160
|
+
months;
|
|
1161
|
+
days;
|
|
1162
|
+
hours;
|
|
1163
|
+
minutes;
|
|
1164
|
+
seconds;
|
|
1165
|
+
microseconds;
|
|
1166
|
+
leapDays;
|
|
1167
|
+
year;
|
|
1168
|
+
month;
|
|
1169
|
+
day;
|
|
1170
|
+
hour;
|
|
1171
|
+
minute;
|
|
1172
|
+
second;
|
|
1173
|
+
microsecond;
|
|
1174
|
+
weekday;
|
|
1175
|
+
negate() {
|
|
1176
|
+
return new _PyRelativeDelta(this, -1);
|
|
1177
|
+
}
|
|
1178
|
+
isEqual() {
|
|
1179
|
+
throw new NotSupportedError();
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
var TIME_DELTA_KEYS = "weeks days hours minutes seconds milliseconds microseconds".split(" ");
|
|
1183
|
+
function modf(x) {
|
|
1184
|
+
const mod = x % 1;
|
|
1185
|
+
return [mod < 0 ? mod + 1 : mod, Math.floor(x)];
|
|
1186
|
+
}
|
|
1187
|
+
var PyTimeDelta = class _PyTimeDelta {
|
|
1188
|
+
constructor(days, seconds, microseconds) {
|
|
1189
|
+
this.days = days;
|
|
1190
|
+
this.seconds = seconds;
|
|
1191
|
+
this.microseconds = microseconds;
|
|
1192
|
+
}
|
|
1193
|
+
static create(...args) {
|
|
1194
|
+
const namedArgs = parseArgs(args, ["days", "seconds", "microseconds"]);
|
|
1195
|
+
for (const key of TIME_DELTA_KEYS) {
|
|
1196
|
+
namedArgs[key] = namedArgs[key] || 0;
|
|
1197
|
+
}
|
|
1198
|
+
let d = 0;
|
|
1199
|
+
let s = 0;
|
|
1200
|
+
let us = 0;
|
|
1201
|
+
const days = namedArgs.days + namedArgs.weeks * 7;
|
|
1202
|
+
let seconds = namedArgs.seconds + 60 * namedArgs.minutes + 3600 * namedArgs.hours;
|
|
1203
|
+
let microseconds = namedArgs.microseconds + 1e3 * namedArgs.milliseconds;
|
|
1204
|
+
const [dFrac, dInt] = modf(days);
|
|
1205
|
+
d = dInt;
|
|
1206
|
+
let daysecondsfrac = 0;
|
|
1207
|
+
if (dFrac) {
|
|
1208
|
+
const [dsFrac, dsInt] = modf(dFrac * 24 * 3600);
|
|
1209
|
+
s = dsInt;
|
|
1210
|
+
daysecondsfrac = dsFrac;
|
|
1211
|
+
}
|
|
1212
|
+
const [sFrac, sInt] = modf(seconds);
|
|
1213
|
+
seconds = sInt;
|
|
1214
|
+
const secondsfrac = sFrac + daysecondsfrac;
|
|
1215
|
+
divmod(seconds, 24 * 3600, (days2, seconds2) => {
|
|
1216
|
+
d += days2;
|
|
1217
|
+
s += seconds2;
|
|
1218
|
+
});
|
|
1219
|
+
microseconds += secondsfrac * 1e6;
|
|
1220
|
+
divmod(microseconds, 1e6, (seconds2, microseconds2) => {
|
|
1221
|
+
divmod(seconds2, 24 * 3600, (days2, seconds3) => {
|
|
1222
|
+
d += days2;
|
|
1223
|
+
s += seconds3;
|
|
1224
|
+
us += Math.round(microseconds2);
|
|
1225
|
+
});
|
|
1226
|
+
});
|
|
1227
|
+
return new _PyTimeDelta(d, s, us);
|
|
1228
|
+
}
|
|
1229
|
+
add(other) {
|
|
1230
|
+
return _PyTimeDelta.create({
|
|
1231
|
+
days: this.days + other.days,
|
|
1232
|
+
seconds: this.seconds + other.seconds,
|
|
1233
|
+
microseconds: this.microseconds + other.microseconds
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
divide(n) {
|
|
1237
|
+
const us = (this.days * 24 * 3600 + this.seconds) * 1e6 + this.microseconds;
|
|
1238
|
+
return _PyTimeDelta.create({ microseconds: Math.floor(us / n) });
|
|
1239
|
+
}
|
|
1240
|
+
isEqual(other) {
|
|
1241
|
+
if (!(other instanceof _PyTimeDelta)) {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1244
|
+
return this.days === other.days && this.seconds === other.seconds && this.microseconds === other.microseconds;
|
|
1245
|
+
}
|
|
1246
|
+
isTrue() {
|
|
1247
|
+
return this.days !== 0 || this.seconds !== 0 || this.microseconds !== 0;
|
|
1248
|
+
}
|
|
1249
|
+
multiply(n) {
|
|
1250
|
+
return _PyTimeDelta.create({
|
|
1251
|
+
days: n * this.days,
|
|
1252
|
+
seconds: n * this.seconds,
|
|
1253
|
+
microseconds: n * this.microseconds
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
negate() {
|
|
1257
|
+
return _PyTimeDelta.create({
|
|
1258
|
+
days: -this.days,
|
|
1259
|
+
seconds: -this.seconds,
|
|
1260
|
+
microseconds: -this.microseconds
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
substract(other) {
|
|
1264
|
+
return _PyTimeDelta.create({
|
|
1265
|
+
days: this.days - other.days,
|
|
1266
|
+
seconds: this.seconds - other.seconds,
|
|
1267
|
+
microseconds: this.microseconds - other.microseconds
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
total_seconds() {
|
|
1271
|
+
return this.days * 86400 + this.seconds + this.microseconds / 1e6;
|
|
1647
1272
|
}
|
|
1648
1273
|
};
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
);
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1274
|
+
|
|
1275
|
+
// src/utils/domain/py_builtin.ts
|
|
1276
|
+
var EvaluationError = class extends Error {
|
|
1277
|
+
constructor(message) {
|
|
1278
|
+
super(message);
|
|
1279
|
+
this.name = "EvaluationError";
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
function execOnIterable(iterable, func) {
|
|
1283
|
+
if (iterable === null) {
|
|
1284
|
+
throw new EvaluationError("value not iterable");
|
|
1285
|
+
}
|
|
1286
|
+
if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
|
|
1287
|
+
iterable = Object.keys(iterable);
|
|
1288
|
+
}
|
|
1289
|
+
if (typeof iterable?.[Symbol.iterator] !== "function") {
|
|
1290
|
+
throw new EvaluationError("value not iterable");
|
|
1291
|
+
}
|
|
1292
|
+
return func(iterable);
|
|
1293
|
+
}
|
|
1294
|
+
var BUILTINS = {
|
|
1295
|
+
/**
|
|
1296
|
+
* @param {any} value
|
|
1297
|
+
* @returns {boolean}
|
|
1298
|
+
*/
|
|
1299
|
+
bool(value) {
|
|
1300
|
+
switch (typeof value) {
|
|
1301
|
+
case "number":
|
|
1302
|
+
return value !== 0;
|
|
1303
|
+
case "string":
|
|
1304
|
+
return value !== "";
|
|
1305
|
+
case "boolean":
|
|
1306
|
+
return value;
|
|
1307
|
+
case "object":
|
|
1308
|
+
if (value === null || value === void 0) {
|
|
1309
|
+
return false;
|
|
1310
|
+
}
|
|
1311
|
+
if ("isTrue" in value && typeof value.isTrue === "function") {
|
|
1312
|
+
return value.isTrue();
|
|
1313
|
+
}
|
|
1314
|
+
if (value instanceof Array) {
|
|
1315
|
+
return !!value.length;
|
|
1316
|
+
}
|
|
1317
|
+
if (value instanceof Set) {
|
|
1318
|
+
return !!value.size;
|
|
1319
|
+
}
|
|
1320
|
+
return Object.keys(value).length !== 0;
|
|
1321
|
+
default:
|
|
1322
|
+
return true;
|
|
1683
1323
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1324
|
+
},
|
|
1325
|
+
set(iterable) {
|
|
1326
|
+
if (arguments.length > 2) {
|
|
1327
|
+
throw new EvaluationError(
|
|
1328
|
+
`set expected at most 1 argument, got (${arguments.length - 1})`
|
|
1329
|
+
);
|
|
1686
1330
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1331
|
+
return execOnIterable(
|
|
1332
|
+
iterable,
|
|
1333
|
+
(iterable2) => new Set(iterable2)
|
|
1334
|
+
);
|
|
1335
|
+
},
|
|
1336
|
+
time: {
|
|
1337
|
+
strftime(format) {
|
|
1338
|
+
return PyDateTime.now().strftime(format);
|
|
1689
1339
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1340
|
+
},
|
|
1341
|
+
context_today() {
|
|
1342
|
+
return PyDate.today();
|
|
1343
|
+
},
|
|
1344
|
+
get current_date() {
|
|
1345
|
+
return this.today;
|
|
1346
|
+
},
|
|
1347
|
+
get today() {
|
|
1348
|
+
return PyDate.today().strftime("%Y-%m-%d");
|
|
1349
|
+
},
|
|
1350
|
+
get now() {
|
|
1351
|
+
return PyDateTime.now().strftime("%Y-%m-%d %H:%M:%S");
|
|
1352
|
+
},
|
|
1353
|
+
datetime: {
|
|
1354
|
+
time: PyTime,
|
|
1355
|
+
timedelta: PyTimeDelta,
|
|
1356
|
+
datetime: PyDateTime,
|
|
1357
|
+
date: PyDate
|
|
1358
|
+
},
|
|
1359
|
+
relativedelta: PyRelativeDelta,
|
|
1360
|
+
true: true,
|
|
1361
|
+
false: false
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
// src/utils/domain/py_utils.ts
|
|
1365
|
+
function toPyValue(value) {
|
|
1366
|
+
switch (typeof value) {
|
|
1367
|
+
case "string":
|
|
1368
|
+
return { type: 1, value };
|
|
1369
|
+
case "number":
|
|
1370
|
+
return { type: 0, value };
|
|
1371
|
+
case "boolean":
|
|
1372
|
+
return { type: 2, value };
|
|
1373
|
+
case "object":
|
|
1374
|
+
if (Array.isArray(value)) {
|
|
1375
|
+
return { type: 4, value: value.map(toPyValue) };
|
|
1376
|
+
} else if (value === null) {
|
|
1377
|
+
return {
|
|
1378
|
+
type: 3
|
|
1379
|
+
/* None */
|
|
1380
|
+
};
|
|
1381
|
+
} else if (value instanceof Date) {
|
|
1382
|
+
return {
|
|
1383
|
+
type: 1,
|
|
1384
|
+
value: String(PyDateTime.convertDate(value))
|
|
1385
|
+
};
|
|
1386
|
+
} else if (value instanceof PyDate || value instanceof PyDateTime) {
|
|
1387
|
+
return { type: 1, value };
|
|
1388
|
+
} else {
|
|
1389
|
+
const content = {};
|
|
1390
|
+
for (const key in value) {
|
|
1391
|
+
content[key] = toPyValue(value[key]);
|
|
1392
|
+
}
|
|
1393
|
+
return { type: 11, value: content };
|
|
1394
|
+
}
|
|
1395
|
+
default:
|
|
1396
|
+
throw new Error("Invalid type");
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
function formatAST(ast, lbp = 0) {
|
|
1400
|
+
switch (ast.type) {
|
|
1401
|
+
case 3:
|
|
1402
|
+
return "None";
|
|
1403
|
+
case 1:
|
|
1404
|
+
return JSON.stringify(ast.value);
|
|
1405
|
+
case 0:
|
|
1406
|
+
return String(ast.value);
|
|
1407
|
+
case 2:
|
|
1408
|
+
return ast.value ? "True" : "False";
|
|
1409
|
+
case 4:
|
|
1410
|
+
return `[${ast.value.map(formatAST).join(", ")}]`;
|
|
1411
|
+
case 6:
|
|
1412
|
+
if (ast.op === "not") {
|
|
1413
|
+
return `not ${formatAST(ast.right, 50)}`;
|
|
1698
1414
|
}
|
|
1415
|
+
return `${ast.op}${formatAST(ast.right, 130)}`;
|
|
1416
|
+
case 7:
|
|
1417
|
+
const abp = bp(ast.op);
|
|
1418
|
+
const binaryStr = `${formatAST(ast.left, abp)} ${ast.op} ${formatAST(ast.right, abp)}`;
|
|
1419
|
+
return abp < lbp ? `(${binaryStr})` : binaryStr;
|
|
1420
|
+
case 11:
|
|
1421
|
+
const pairs = [];
|
|
1422
|
+
for (const k in ast.value) {
|
|
1423
|
+
pairs.push(`"${k}": ${formatAST(ast.value[k])}`);
|
|
1424
|
+
}
|
|
1425
|
+
return `{${pairs.join(", ")}}`;
|
|
1426
|
+
case 10:
|
|
1427
|
+
return `(${ast.value.map(formatAST).join(", ")})`;
|
|
1428
|
+
case 5:
|
|
1429
|
+
return ast.value;
|
|
1430
|
+
case 12:
|
|
1431
|
+
return `${formatAST(ast.target)}[${formatAST(ast.key)}]`;
|
|
1432
|
+
case 13:
|
|
1433
|
+
const { ifTrue, condition, ifFalse } = ast;
|
|
1434
|
+
return `${formatAST(ifTrue)} if ${formatAST(condition)} else ${formatAST(ifFalse)}`;
|
|
1435
|
+
case 14:
|
|
1436
|
+
const boolAbp = bp(ast.op);
|
|
1437
|
+
const boolStr = `${formatAST(ast.left, boolAbp)} ${ast.op} ${formatAST(ast.right, boolAbp)}`;
|
|
1438
|
+
return boolAbp < lbp ? `(${boolStr})` : boolStr;
|
|
1439
|
+
case 15:
|
|
1440
|
+
return `${formatAST(ast.obj, 150)}.${ast.key}`;
|
|
1441
|
+
case 8:
|
|
1442
|
+
const args = ast.args.map(formatAST);
|
|
1443
|
+
const kwargs = [];
|
|
1444
|
+
for (const kwarg in ast.kwargs) {
|
|
1445
|
+
kwargs.push(`${kwarg} = ${formatAST(ast.kwargs[kwarg])}`);
|
|
1446
|
+
}
|
|
1447
|
+
const argStr = args.concat(kwargs).join(", ");
|
|
1448
|
+
return `${formatAST(ast.fn)}(${argStr})`;
|
|
1449
|
+
default:
|
|
1450
|
+
throw new Error("invalid expression: " + JSON.stringify(ast));
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
var PY_DICT = /* @__PURE__ */ Object.create(null);
|
|
1454
|
+
function toPyDict(obj) {
|
|
1455
|
+
return new Proxy(obj, {
|
|
1456
|
+
getPrototypeOf() {
|
|
1457
|
+
return PY_DICT;
|
|
1699
1458
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
// src/utils/domain/py_interpreter.ts
|
|
1463
|
+
var isTrue = BUILTINS.bool;
|
|
1464
|
+
function applyUnaryOp(ast, context) {
|
|
1465
|
+
const value = evaluate(ast.right, context);
|
|
1466
|
+
switch (ast.op) {
|
|
1467
|
+
case "-":
|
|
1468
|
+
if (value instanceof Object && "negate" in value) {
|
|
1469
|
+
return value.negate();
|
|
1711
1470
|
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1471
|
+
return -value;
|
|
1472
|
+
case "+":
|
|
1473
|
+
return value;
|
|
1474
|
+
case "not":
|
|
1475
|
+
return !isTrue(value);
|
|
1476
|
+
default:
|
|
1477
|
+
throw new EvaluationError(`Unknown unary operator: ${ast.op}`);
|
|
1714
1478
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
delta.microseconds || (date instanceof PyDateTime ? date.microsecond : 0)
|
|
1727
|
-
);
|
|
1728
|
-
const newDateTime = new PyDateTime(
|
|
1729
|
-
s.year,
|
|
1730
|
-
s.month,
|
|
1731
|
-
s.day,
|
|
1732
|
-
s.hour,
|
|
1733
|
-
s.minute,
|
|
1734
|
-
s.second,
|
|
1735
|
-
s.microsecond
|
|
1736
|
-
);
|
|
1737
|
-
let leapDays = 0;
|
|
1738
|
-
if (delta.leapDays && newDateTime.month > 2 && isLeap(newDateTime.year)) {
|
|
1739
|
-
leapDays = delta.leapDays;
|
|
1740
|
-
}
|
|
1741
|
-
const temp = newDateTime.add(
|
|
1742
|
-
PyTimeDelta.create({
|
|
1743
|
-
days: delta.days + leapDays,
|
|
1744
|
-
hours: delta.hours,
|
|
1745
|
-
minutes: delta.minutes,
|
|
1746
|
-
seconds: delta.seconds,
|
|
1747
|
-
microseconds: delta.microseconds
|
|
1748
|
-
})
|
|
1749
|
-
);
|
|
1750
|
-
const hasTime = Boolean(
|
|
1751
|
-
temp.hour || temp.minute || temp.second || temp.microsecond
|
|
1752
|
-
);
|
|
1753
|
-
const returnDate = !hasTime && date instanceof PyDate ? new PyDate(temp.year, temp.month, temp.day) : temp;
|
|
1754
|
-
if (delta.weekday !== null) {
|
|
1755
|
-
const wantedDow = delta.weekday + 1;
|
|
1756
|
-
const _date = new Date(
|
|
1757
|
-
returnDate.year,
|
|
1758
|
-
returnDate.month - 1,
|
|
1759
|
-
returnDate.day
|
|
1760
|
-
);
|
|
1761
|
-
const days = (7 - _date.getDay() + wantedDow) % 7;
|
|
1762
|
-
return returnDate.add(new PyTimeDelta(days, 0, 0));
|
|
1763
|
-
}
|
|
1764
|
-
return returnDate;
|
|
1479
|
+
}
|
|
1480
|
+
function pytypeIndex(val) {
|
|
1481
|
+
switch (typeof val) {
|
|
1482
|
+
case "object":
|
|
1483
|
+
return val === null ? 1 : Array.isArray(val) ? 5 : 3;
|
|
1484
|
+
case "number":
|
|
1485
|
+
return 2;
|
|
1486
|
+
case "string":
|
|
1487
|
+
return 4;
|
|
1488
|
+
default:
|
|
1489
|
+
throw new EvaluationError(`Unknown type: ${typeof val}`);
|
|
1765
1490
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1491
|
+
}
|
|
1492
|
+
function isLess(left, right) {
|
|
1493
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
1494
|
+
return left < right;
|
|
1768
1495
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
this.months = sign * params.months;
|
|
1772
|
-
this.days = sign * params.days;
|
|
1773
|
-
this.hours = sign * params.hours;
|
|
1774
|
-
this.minutes = sign * params.minutes;
|
|
1775
|
-
this.seconds = sign * params.seconds;
|
|
1776
|
-
this.microseconds = sign * params.microseconds;
|
|
1777
|
-
this.leapDays = params.leapDays;
|
|
1778
|
-
this.year = params.year;
|
|
1779
|
-
this.month = params.month;
|
|
1780
|
-
this.day = params.day;
|
|
1781
|
-
this.hour = params.hour;
|
|
1782
|
-
this.minute = params.minute;
|
|
1783
|
-
this.second = params.second;
|
|
1784
|
-
this.microsecond = params.microsecond;
|
|
1785
|
-
this.weekday = params.weekday;
|
|
1496
|
+
if (typeof left === "boolean") {
|
|
1497
|
+
left = left ? 1 : 0;
|
|
1786
1498
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
days;
|
|
1790
|
-
hours;
|
|
1791
|
-
minutes;
|
|
1792
|
-
seconds;
|
|
1793
|
-
microseconds;
|
|
1794
|
-
leapDays;
|
|
1795
|
-
year;
|
|
1796
|
-
month;
|
|
1797
|
-
day;
|
|
1798
|
-
hour;
|
|
1799
|
-
minute;
|
|
1800
|
-
second;
|
|
1801
|
-
microsecond;
|
|
1802
|
-
weekday;
|
|
1803
|
-
negate() {
|
|
1804
|
-
return new _PyRelativeDelta(this, -1);
|
|
1499
|
+
if (typeof right === "boolean") {
|
|
1500
|
+
right = right ? 1 : 0;
|
|
1805
1501
|
}
|
|
1806
|
-
|
|
1807
|
-
|
|
1502
|
+
const leftIndex = pytypeIndex(left);
|
|
1503
|
+
const rightIndex = pytypeIndex(right);
|
|
1504
|
+
if (leftIndex === rightIndex) {
|
|
1505
|
+
return left < right;
|
|
1808
1506
|
}
|
|
1809
|
-
|
|
1810
|
-
var TIME_DELTA_KEYS = "weeks days hours minutes seconds milliseconds microseconds".split(" ");
|
|
1811
|
-
function modf(x) {
|
|
1812
|
-
const mod = x % 1;
|
|
1813
|
-
return [mod < 0 ? mod + 1 : mod, Math.floor(x)];
|
|
1507
|
+
return leftIndex < rightIndex;
|
|
1814
1508
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
this.microseconds = microseconds;
|
|
1820
|
-
}
|
|
1821
|
-
static create(...args) {
|
|
1822
|
-
const namedArgs = parseArgs(args, ["days", "seconds", "microseconds"]);
|
|
1823
|
-
for (const key of TIME_DELTA_KEYS) {
|
|
1824
|
-
namedArgs[key] = namedArgs[key] || 0;
|
|
1509
|
+
function isEqual(left, right) {
|
|
1510
|
+
if (typeof left !== typeof right) {
|
|
1511
|
+
if (typeof left === "boolean" && typeof right === "number") {
|
|
1512
|
+
return right === (left ? 1 : 0);
|
|
1825
1513
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
let us = 0;
|
|
1829
|
-
const days = namedArgs.days + namedArgs.weeks * 7;
|
|
1830
|
-
let seconds = namedArgs.seconds + 60 * namedArgs.minutes + 3600 * namedArgs.hours;
|
|
1831
|
-
let microseconds = namedArgs.microseconds + 1e3 * namedArgs.milliseconds;
|
|
1832
|
-
const [dFrac, dInt] = modf(days);
|
|
1833
|
-
d = dInt;
|
|
1834
|
-
let daysecondsfrac = 0;
|
|
1835
|
-
if (dFrac) {
|
|
1836
|
-
const [dsFrac, dsInt] = modf(dFrac * 24 * 3600);
|
|
1837
|
-
s = dsInt;
|
|
1838
|
-
daysecondsfrac = dsFrac;
|
|
1514
|
+
if (typeof left === "number" && typeof right === "boolean") {
|
|
1515
|
+
return left === (right ? 1 : 0);
|
|
1839
1516
|
}
|
|
1840
|
-
|
|
1841
|
-
seconds = sInt;
|
|
1842
|
-
const secondsfrac = sFrac + daysecondsfrac;
|
|
1843
|
-
divmod(seconds, 24 * 3600, (days2, seconds2) => {
|
|
1844
|
-
d += days2;
|
|
1845
|
-
s += seconds2;
|
|
1846
|
-
});
|
|
1847
|
-
microseconds += secondsfrac * 1e6;
|
|
1848
|
-
divmod(microseconds, 1e6, (seconds2, microseconds2) => {
|
|
1849
|
-
divmod(seconds2, 24 * 3600, (days2, seconds3) => {
|
|
1850
|
-
d += days2;
|
|
1851
|
-
s += seconds3;
|
|
1852
|
-
us += Math.round(microseconds2);
|
|
1853
|
-
});
|
|
1854
|
-
});
|
|
1855
|
-
return new _PyTimeDelta(d, s, us);
|
|
1517
|
+
return false;
|
|
1856
1518
|
}
|
|
1857
|
-
|
|
1858
|
-
return
|
|
1859
|
-
days: this.days + other.days,
|
|
1860
|
-
seconds: this.seconds + other.seconds,
|
|
1861
|
-
microseconds: this.microseconds + other.microseconds
|
|
1862
|
-
});
|
|
1519
|
+
if (left instanceof Object && "isEqual" in left) {
|
|
1520
|
+
return left.isEqual(right);
|
|
1863
1521
|
}
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1522
|
+
return left === right;
|
|
1523
|
+
}
|
|
1524
|
+
function isIn(left, right) {
|
|
1525
|
+
if (Array.isArray(right)) {
|
|
1526
|
+
return right.includes(left);
|
|
1527
|
+
}
|
|
1528
|
+
if (typeof right === "string" && typeof left === "string") {
|
|
1529
|
+
return right.includes(left);
|
|
1530
|
+
}
|
|
1531
|
+
if (typeof right === "object") {
|
|
1532
|
+
return left in right;
|
|
1533
|
+
}
|
|
1534
|
+
return false;
|
|
1535
|
+
}
|
|
1536
|
+
function applyBinaryOp(ast, context) {
|
|
1537
|
+
const left = evaluate(ast.left, context);
|
|
1538
|
+
const right = evaluate(ast.right, context);
|
|
1539
|
+
switch (ast.op) {
|
|
1540
|
+
case "+": {
|
|
1541
|
+
const relativeDeltaOnLeft = left instanceof PyRelativeDelta;
|
|
1542
|
+
const relativeDeltaOnRight = right instanceof PyRelativeDelta;
|
|
1543
|
+
if (relativeDeltaOnLeft || relativeDeltaOnRight) {
|
|
1544
|
+
const date = relativeDeltaOnLeft ? right : left;
|
|
1545
|
+
const delta = relativeDeltaOnLeft ? left : right;
|
|
1546
|
+
return PyRelativeDelta.add(date, delta);
|
|
1547
|
+
}
|
|
1548
|
+
const timeDeltaOnLeft = left instanceof PyTimeDelta;
|
|
1549
|
+
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
1550
|
+
if (timeDeltaOnLeft && timeDeltaOnRight) {
|
|
1551
|
+
return left.add(right);
|
|
1552
|
+
}
|
|
1553
|
+
if (timeDeltaOnLeft) {
|
|
1554
|
+
if (right instanceof PyDate || right instanceof PyDateTime) {
|
|
1555
|
+
return right.add(left);
|
|
1556
|
+
} else {
|
|
1557
|
+
throw new NotSupportedError();
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
if (timeDeltaOnRight) {
|
|
1561
|
+
if (left instanceof PyDate || left instanceof PyDateTime) {
|
|
1562
|
+
return left.add(right);
|
|
1563
|
+
} else {
|
|
1564
|
+
throw new NotSupportedError();
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
if (left instanceof Array && right instanceof Array) {
|
|
1568
|
+
return [...left, ...right];
|
|
1569
|
+
}
|
|
1570
|
+
return left + right;
|
|
1571
|
+
}
|
|
1572
|
+
case "-": {
|
|
1573
|
+
const isRightDelta = right instanceof PyRelativeDelta;
|
|
1574
|
+
if (isRightDelta) {
|
|
1575
|
+
return PyRelativeDelta.substract(left, right);
|
|
1576
|
+
}
|
|
1577
|
+
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
1578
|
+
if (timeDeltaOnRight) {
|
|
1579
|
+
if (left instanceof PyTimeDelta) {
|
|
1580
|
+
return left.substract(right);
|
|
1581
|
+
} else if (left instanceof PyDate || left instanceof PyDateTime) {
|
|
1582
|
+
return left.substract(right);
|
|
1583
|
+
} else {
|
|
1584
|
+
throw new NotSupportedError();
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
if (left instanceof PyDate) {
|
|
1588
|
+
return left.substract(right);
|
|
1589
|
+
}
|
|
1590
|
+
return left - right;
|
|
1591
|
+
}
|
|
1592
|
+
case "*": {
|
|
1593
|
+
const timeDeltaOnLeft = left instanceof PyTimeDelta;
|
|
1594
|
+
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
1595
|
+
if (timeDeltaOnLeft || timeDeltaOnRight) {
|
|
1596
|
+
const number = timeDeltaOnLeft ? right : left;
|
|
1597
|
+
const delta = timeDeltaOnLeft ? left : right;
|
|
1598
|
+
return delta.multiply(number);
|
|
1599
|
+
}
|
|
1600
|
+
return left * right;
|
|
1601
|
+
}
|
|
1602
|
+
case "/":
|
|
1603
|
+
return left / right;
|
|
1604
|
+
case "%":
|
|
1605
|
+
return left % right;
|
|
1606
|
+
case "//":
|
|
1607
|
+
if (left instanceof PyTimeDelta) {
|
|
1608
|
+
return left.divide(right);
|
|
1609
|
+
}
|
|
1610
|
+
return Math.floor(left / right);
|
|
1611
|
+
case "**":
|
|
1612
|
+
return left ** right;
|
|
1613
|
+
case "==":
|
|
1614
|
+
return isEqual(left, right);
|
|
1615
|
+
case "<>":
|
|
1616
|
+
case "!=":
|
|
1617
|
+
return !isEqual(left, right);
|
|
1618
|
+
case "<":
|
|
1619
|
+
return isLess(left, right);
|
|
1620
|
+
case ">":
|
|
1621
|
+
return isLess(right, left);
|
|
1622
|
+
case ">=":
|
|
1623
|
+
return isEqual(left, right) || isLess(right, left);
|
|
1624
|
+
case "<=":
|
|
1625
|
+
return isEqual(left, right) || isLess(left, right);
|
|
1626
|
+
case "in":
|
|
1627
|
+
return isIn(left, right);
|
|
1628
|
+
case "not in":
|
|
1629
|
+
return !isIn(left, right);
|
|
1630
|
+
default:
|
|
1631
|
+
throw new EvaluationError(`Unknown binary operator: ${ast.op}`);
|
|
1867
1632
|
}
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1633
|
+
}
|
|
1634
|
+
var DICT = {
|
|
1635
|
+
get(...args) {
|
|
1636
|
+
const { key, defValue } = parseArgs(args, ["key", "defValue"]);
|
|
1637
|
+
const self = this;
|
|
1638
|
+
if (key in self) {
|
|
1639
|
+
return self[key];
|
|
1640
|
+
} else if (defValue !== void 0) {
|
|
1641
|
+
return defValue;
|
|
1871
1642
|
}
|
|
1872
|
-
return
|
|
1643
|
+
return null;
|
|
1873
1644
|
}
|
|
1874
|
-
|
|
1875
|
-
|
|
1645
|
+
};
|
|
1646
|
+
var STRING = {
|
|
1647
|
+
lower() {
|
|
1648
|
+
return this.toLowerCase();
|
|
1649
|
+
},
|
|
1650
|
+
upper() {
|
|
1651
|
+
return this.toUpperCase();
|
|
1876
1652
|
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
microseconds: n * this.microseconds
|
|
1882
|
-
});
|
|
1653
|
+
};
|
|
1654
|
+
function applyFunc(key, func, set, ...args) {
|
|
1655
|
+
if (args.length === 1) {
|
|
1656
|
+
return new Set(set);
|
|
1883
1657
|
}
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
microseconds: -this.microseconds
|
|
1889
|
-
});
|
|
1658
|
+
if (args.length > 2) {
|
|
1659
|
+
throw new EvaluationError(
|
|
1660
|
+
`${key}: py_js supports at most 1 argument, got (${args.length - 1})`
|
|
1661
|
+
);
|
|
1890
1662
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1663
|
+
return execOnIterable(args[0], func);
|
|
1664
|
+
}
|
|
1665
|
+
var SET = {
|
|
1666
|
+
intersection(...args) {
|
|
1667
|
+
return applyFunc(
|
|
1668
|
+
"intersection",
|
|
1669
|
+
(iterable) => {
|
|
1670
|
+
const intersection = /* @__PURE__ */ new Set();
|
|
1671
|
+
for (const i of iterable) {
|
|
1672
|
+
if (this.has(i)) {
|
|
1673
|
+
intersection.add(i);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
return intersection;
|
|
1677
|
+
},
|
|
1678
|
+
this,
|
|
1679
|
+
...args
|
|
1680
|
+
);
|
|
1681
|
+
},
|
|
1682
|
+
difference(...args) {
|
|
1683
|
+
return applyFunc(
|
|
1684
|
+
"difference",
|
|
1685
|
+
(iterable) => {
|
|
1686
|
+
iterable = new Set(iterable);
|
|
1687
|
+
const difference = /* @__PURE__ */ new Set();
|
|
1688
|
+
for (const e of this) {
|
|
1689
|
+
if (!iterable.has(e)) {
|
|
1690
|
+
difference.add(e);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
return difference;
|
|
1694
|
+
},
|
|
1695
|
+
this,
|
|
1696
|
+
...args
|
|
1697
|
+
);
|
|
1698
|
+
},
|
|
1699
|
+
union(...args) {
|
|
1700
|
+
return applyFunc(
|
|
1701
|
+
"union",
|
|
1702
|
+
(iterable) => {
|
|
1703
|
+
return /* @__PURE__ */ new Set([...this, ...iterable]);
|
|
1704
|
+
},
|
|
1705
|
+
this,
|
|
1706
|
+
...args
|
|
1707
|
+
);
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
function methods(_class) {
|
|
1711
|
+
return Object.getOwnPropertyNames(_class.prototype).map(
|
|
1712
|
+
(prop) => _class.prototype[prop]
|
|
1713
|
+
);
|
|
1714
|
+
}
|
|
1715
|
+
var allowedFns = /* @__PURE__ */ new Set([
|
|
1716
|
+
BUILTINS.time.strftime,
|
|
1717
|
+
BUILTINS.set,
|
|
1718
|
+
BUILTINS.bool,
|
|
1719
|
+
BUILTINS.context_today,
|
|
1720
|
+
BUILTINS.datetime.datetime.now,
|
|
1721
|
+
BUILTINS.datetime.datetime.combine,
|
|
1722
|
+
BUILTINS.datetime.date.today,
|
|
1723
|
+
...methods(BUILTINS.relativedelta),
|
|
1724
|
+
...Object.values(BUILTINS.datetime).flatMap((obj) => methods(obj)),
|
|
1725
|
+
...Object.values(SET),
|
|
1726
|
+
...Object.values(DICT),
|
|
1727
|
+
...Object.values(STRING)
|
|
1728
|
+
]);
|
|
1729
|
+
var unboundFn = Symbol("unbound function");
|
|
1730
|
+
function evaluate(ast, context = {}) {
|
|
1731
|
+
const dicts = /* @__PURE__ */ new Set();
|
|
1732
|
+
let pyContext;
|
|
1733
|
+
const evalContext = Object.create(context);
|
|
1734
|
+
if (!evalContext?.context) {
|
|
1735
|
+
Object.defineProperty(evalContext, "context", {
|
|
1736
|
+
get() {
|
|
1737
|
+
if (!pyContext) {
|
|
1738
|
+
pyContext = toPyDict(context);
|
|
1739
|
+
}
|
|
1740
|
+
return pyContext;
|
|
1741
|
+
}
|
|
1896
1742
|
});
|
|
1897
1743
|
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1744
|
+
function _innerEvaluate(ast2) {
|
|
1745
|
+
switch (ast2?.type) {
|
|
1746
|
+
case 0:
|
|
1747
|
+
// Number
|
|
1748
|
+
case 1:
|
|
1749
|
+
return ast2.value;
|
|
1750
|
+
case 5:
|
|
1751
|
+
if (ast2.value in evalContext) {
|
|
1752
|
+
if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
|
|
1753
|
+
return evalContext[ast2.value]?.id;
|
|
1754
|
+
}
|
|
1755
|
+
return evalContext[ast2.value] ?? false;
|
|
1756
|
+
} else if (ast2.value in BUILTINS) {
|
|
1757
|
+
return BUILTINS[ast2.value];
|
|
1758
|
+
} else {
|
|
1759
|
+
return false;
|
|
1760
|
+
}
|
|
1761
|
+
case 3:
|
|
1762
|
+
return null;
|
|
1763
|
+
case 2:
|
|
1764
|
+
return ast2.value;
|
|
1765
|
+
case 6:
|
|
1766
|
+
return applyUnaryOp(ast2, evalContext);
|
|
1767
|
+
case 7:
|
|
1768
|
+
return applyBinaryOp(ast2, evalContext);
|
|
1769
|
+
case 14:
|
|
1770
|
+
const left = _evaluate(ast2.left);
|
|
1771
|
+
if (ast2.op === "and") {
|
|
1772
|
+
return isTrue(left) ? _evaluate(ast2.right) : left;
|
|
1773
|
+
} else {
|
|
1774
|
+
return isTrue(left) ? left : _evaluate(ast2.right);
|
|
1775
|
+
}
|
|
1776
|
+
case 4:
|
|
1777
|
+
// List
|
|
1778
|
+
case 10:
|
|
1779
|
+
return ast2.value.map(_evaluate);
|
|
1780
|
+
case 11:
|
|
1781
|
+
const dict = {};
|
|
1782
|
+
for (const key2 in ast2.value) {
|
|
1783
|
+
dict[key2] = _evaluate(ast2.value[key2]);
|
|
1784
|
+
}
|
|
1785
|
+
dicts.add(dict);
|
|
1786
|
+
return dict;
|
|
1787
|
+
case 8:
|
|
1788
|
+
const fnValue = _evaluate(ast2.fn);
|
|
1789
|
+
const args = ast2.args.map(_evaluate);
|
|
1790
|
+
const kwargs = {};
|
|
1791
|
+
for (const kwarg in ast2.kwargs) {
|
|
1792
|
+
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
1793
|
+
}
|
|
1794
|
+
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
1795
|
+
return fnValue.create(...args, kwargs);
|
|
1796
|
+
}
|
|
1797
|
+
return fnValue(...args, kwargs);
|
|
1798
|
+
case 12:
|
|
1799
|
+
const dictVal = _evaluate(ast2.target);
|
|
1800
|
+
const key = _evaluate(ast2.key);
|
|
1801
|
+
return dictVal[key];
|
|
1802
|
+
case 13:
|
|
1803
|
+
if (isTrue(_evaluate(ast2.condition))) {
|
|
1804
|
+
return _evaluate(ast2.ifTrue);
|
|
1805
|
+
} else {
|
|
1806
|
+
return _evaluate(ast2.ifFalse);
|
|
1807
|
+
}
|
|
1808
|
+
case 15:
|
|
1809
|
+
let leftVal = _evaluate(ast2.obj);
|
|
1810
|
+
let result;
|
|
1811
|
+
if (dicts.has(leftVal) || Object.isPrototypeOf.call(PY_DICT, leftVal)) {
|
|
1812
|
+
result = DICT[ast2.key];
|
|
1813
|
+
} else if (typeof leftVal === "string") {
|
|
1814
|
+
result = STRING[ast2.key];
|
|
1815
|
+
} else if (leftVal instanceof Set) {
|
|
1816
|
+
result = SET[ast2.key];
|
|
1817
|
+
} else if (ast2.key === "get" && typeof leftVal === "object") {
|
|
1818
|
+
result = DICT[ast2.key];
|
|
1819
|
+
leftVal = toPyDict(leftVal);
|
|
1820
|
+
} else {
|
|
1821
|
+
result = leftVal[ast2.key];
|
|
1822
|
+
}
|
|
1823
|
+
if (typeof result === "function") {
|
|
1824
|
+
const bound = result.bind(leftVal);
|
|
1825
|
+
bound[unboundFn] = result;
|
|
1826
|
+
return bound;
|
|
1827
|
+
}
|
|
1828
|
+
return result;
|
|
1829
|
+
default:
|
|
1830
|
+
throw new EvaluationError(`AST of type ${ast2.type} cannot be evaluated`);
|
|
1831
|
+
}
|
|
1900
1832
|
}
|
|
1901
|
-
|
|
1833
|
+
function _evaluate(ast2) {
|
|
1834
|
+
const val = _innerEvaluate(ast2);
|
|
1835
|
+
if (typeof val === "function" && !allowedFns.has(val) && !allowedFns.has(val[unboundFn])) {
|
|
1836
|
+
throw new Error("Invalid Function Call");
|
|
1837
|
+
}
|
|
1838
|
+
return val;
|
|
1839
|
+
}
|
|
1840
|
+
return _evaluate(ast);
|
|
1841
|
+
}
|
|
1902
1842
|
|
|
1903
|
-
// src/utils/domain/
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1843
|
+
// src/utils/domain/py.ts
|
|
1844
|
+
function parseExpr(expr) {
|
|
1845
|
+
const tokens = tokenize(expr);
|
|
1846
|
+
return parse(tokens);
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// src/utils/domain/objects.ts
|
|
1850
|
+
function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
|
|
1851
|
+
if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") {
|
|
1852
|
+
return obj1 === obj2;
|
|
1908
1853
|
}
|
|
1854
|
+
const obj1Keys = Object.keys(obj1);
|
|
1855
|
+
return obj1Keys.length === Object.keys(obj2).length && obj1Keys.every((key) => comparisonFn(obj1[key], obj2[key]));
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
// src/utils/domain/arrays.ts
|
|
1859
|
+
var shallowEqual2 = shallowEqual;
|
|
1860
|
+
|
|
1861
|
+
// src/utils/domain/strings.ts
|
|
1862
|
+
var escapeMethod = Symbol("html");
|
|
1863
|
+
function escapeRegExp(str) {
|
|
1864
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
// src/utils/domain/domain.ts
|
|
1868
|
+
var InvalidDomainError = class extends Error {
|
|
1909
1869
|
};
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1870
|
+
var Domain = class _Domain {
|
|
1871
|
+
ast = { type: -1, value: null };
|
|
1872
|
+
static TRUE;
|
|
1873
|
+
static FALSE;
|
|
1874
|
+
static combine(domains, operator) {
|
|
1875
|
+
if (domains.length === 0) {
|
|
1876
|
+
return new _Domain([]);
|
|
1877
|
+
}
|
|
1878
|
+
const domain1 = domains[0] instanceof _Domain ? domains[0] : new _Domain(domains[0]);
|
|
1879
|
+
if (domains.length === 1) {
|
|
1880
|
+
return domain1;
|
|
1881
|
+
}
|
|
1882
|
+
const domain2 = _Domain.combine(domains.slice(1), operator);
|
|
1883
|
+
const result = new _Domain([]);
|
|
1884
|
+
const astValues1 = domain1.ast.value;
|
|
1885
|
+
const astValues2 = domain2.ast.value;
|
|
1886
|
+
const op = operator === "AND" ? "&" : "|";
|
|
1887
|
+
const combinedAST = {
|
|
1888
|
+
type: 4,
|
|
1889
|
+
value: astValues1.concat(astValues2)
|
|
1890
|
+
};
|
|
1891
|
+
result.ast = normalizeDomainAST(combinedAST, op);
|
|
1892
|
+
return result;
|
|
1913
1893
|
}
|
|
1914
|
-
|
|
1915
|
-
|
|
1894
|
+
static and(domains) {
|
|
1895
|
+
return _Domain.combine(domains, "AND");
|
|
1916
1896
|
}
|
|
1917
|
-
|
|
1918
|
-
|
|
1897
|
+
static or(domains) {
|
|
1898
|
+
return _Domain.combine(domains, "OR");
|
|
1919
1899
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
return false;
|
|
1938
|
-
}
|
|
1939
|
-
if ("isTrue" in value && typeof value.isTrue === "function") {
|
|
1940
|
-
return value.isTrue();
|
|
1900
|
+
static not(domain) {
|
|
1901
|
+
const result = new _Domain(domain);
|
|
1902
|
+
result.ast.value.unshift({ type: 1, value: "!" });
|
|
1903
|
+
return result;
|
|
1904
|
+
}
|
|
1905
|
+
static removeDomainLeaves(domain, keysToRemove) {
|
|
1906
|
+
function processLeaf(elements, idx, operatorCtx, newDomain2) {
|
|
1907
|
+
const leaf = elements[idx];
|
|
1908
|
+
if (leaf.type === 10) {
|
|
1909
|
+
if (keysToRemove.includes(leaf.value[0].value)) {
|
|
1910
|
+
if (operatorCtx === "&") {
|
|
1911
|
+
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
1912
|
+
} else if (operatorCtx === "|") {
|
|
1913
|
+
newDomain2.ast.value.push(..._Domain.FALSE.ast.value);
|
|
1914
|
+
}
|
|
1915
|
+
} else {
|
|
1916
|
+
newDomain2.ast.value.push(leaf);
|
|
1941
1917
|
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1918
|
+
return 1;
|
|
1919
|
+
} else if (leaf.type === 1) {
|
|
1920
|
+
if (leaf.value === "|" && elements[idx + 1].type === 10 && elements[idx + 2].type === 10 && keysToRemove.includes(elements[idx + 1].value[0].value) && keysToRemove.includes(elements[idx + 2].value[0].value)) {
|
|
1921
|
+
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
1922
|
+
return 3;
|
|
1944
1923
|
}
|
|
1945
|
-
|
|
1946
|
-
|
|
1924
|
+
newDomain2.ast.value.push(leaf);
|
|
1925
|
+
if (leaf.value === "!") {
|
|
1926
|
+
return 1 + processLeaf(elements, idx + 1, "&", newDomain2);
|
|
1947
1927
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1928
|
+
const firstLeafSkip = processLeaf(
|
|
1929
|
+
elements,
|
|
1930
|
+
idx + 1,
|
|
1931
|
+
leaf.value,
|
|
1932
|
+
newDomain2
|
|
1933
|
+
);
|
|
1934
|
+
const secondLeafSkip = processLeaf(
|
|
1935
|
+
elements,
|
|
1936
|
+
idx + 1 + firstLeafSkip,
|
|
1937
|
+
leaf.value,
|
|
1938
|
+
newDomain2
|
|
1939
|
+
);
|
|
1940
|
+
return 1 + firstLeafSkip + secondLeafSkip;
|
|
1941
|
+
}
|
|
1942
|
+
return 0;
|
|
1958
1943
|
}
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
);
|
|
1963
|
-
},
|
|
1964
|
-
time: {
|
|
1965
|
-
strftime(format) {
|
|
1966
|
-
return PyDateTime.now().strftime(format);
|
|
1944
|
+
const d = new _Domain(domain);
|
|
1945
|
+
if (d.ast.value.length === 0) {
|
|
1946
|
+
return d;
|
|
1967
1947
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
return
|
|
1971
|
-
},
|
|
1972
|
-
get current_date() {
|
|
1973
|
-
return this.today;
|
|
1974
|
-
},
|
|
1975
|
-
get today() {
|
|
1976
|
-
return PyDate.today().strftime("%Y-%m-%d");
|
|
1977
|
-
},
|
|
1978
|
-
get now() {
|
|
1979
|
-
return PyDateTime.now().strftime("%Y-%m-%d %H:%M:%S");
|
|
1980
|
-
},
|
|
1981
|
-
datetime: {
|
|
1982
|
-
time: PyTime,
|
|
1983
|
-
timedelta: PyTimeDelta,
|
|
1984
|
-
datetime: PyDateTime,
|
|
1985
|
-
date: PyDate
|
|
1986
|
-
},
|
|
1987
|
-
relativedelta: PyRelativeDelta,
|
|
1988
|
-
true: true,
|
|
1989
|
-
false: false
|
|
1990
|
-
};
|
|
1991
|
-
|
|
1992
|
-
// src/utils/domain/py_utils.ts
|
|
1993
|
-
function toPyValue(value) {
|
|
1994
|
-
switch (typeof value) {
|
|
1995
|
-
case "string":
|
|
1996
|
-
return { type: 1, value };
|
|
1997
|
-
case "number":
|
|
1998
|
-
return { type: 0, value };
|
|
1999
|
-
case "boolean":
|
|
2000
|
-
return { type: 2, value };
|
|
2001
|
-
case "object":
|
|
2002
|
-
if (Array.isArray(value)) {
|
|
2003
|
-
return { type: 4, value: value.map(toPyValue) };
|
|
2004
|
-
} else if (value === null) {
|
|
2005
|
-
return {
|
|
2006
|
-
type: 3
|
|
2007
|
-
/* None */
|
|
2008
|
-
};
|
|
2009
|
-
} else if (value instanceof Date) {
|
|
2010
|
-
return {
|
|
2011
|
-
type: 1,
|
|
2012
|
-
value: String(PyDateTime.convertDate(value))
|
|
2013
|
-
};
|
|
2014
|
-
} else if (value instanceof PyDate || value instanceof PyDateTime) {
|
|
2015
|
-
return { type: 1, value };
|
|
2016
|
-
} else {
|
|
2017
|
-
const content = {};
|
|
2018
|
-
for (const key in value) {
|
|
2019
|
-
content[key] = toPyValue(value[key]);
|
|
2020
|
-
}
|
|
2021
|
-
return { type: 11, value: content };
|
|
2022
|
-
}
|
|
2023
|
-
default:
|
|
2024
|
-
throw new Error("Invalid type");
|
|
1948
|
+
const newDomain = new _Domain([]);
|
|
1949
|
+
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
1950
|
+
return newDomain;
|
|
2025
1951
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
if (ast.op === "not") {
|
|
2041
|
-
return `not ${formatAST(ast.right, 50)}`;
|
|
2042
|
-
}
|
|
2043
|
-
return `${ast.op}${formatAST(ast.right, 130)}`;
|
|
2044
|
-
case 7:
|
|
2045
|
-
const abp = bp(ast.op);
|
|
2046
|
-
const binaryStr = `${formatAST(ast.left, abp)} ${ast.op} ${formatAST(ast.right, abp)}`;
|
|
2047
|
-
return abp < lbp ? `(${binaryStr})` : binaryStr;
|
|
2048
|
-
case 11:
|
|
2049
|
-
const pairs = [];
|
|
2050
|
-
for (const k in ast.value) {
|
|
2051
|
-
pairs.push(`"${k}": ${formatAST(ast.value[k])}`);
|
|
1952
|
+
constructor(descr = []) {
|
|
1953
|
+
if (descr instanceof _Domain) {
|
|
1954
|
+
return new _Domain(descr.toString());
|
|
1955
|
+
} else {
|
|
1956
|
+
let rawAST;
|
|
1957
|
+
try {
|
|
1958
|
+
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
1959
|
+
} catch (error) {
|
|
1960
|
+
throw new InvalidDomainError(
|
|
1961
|
+
`Invalid domain representation: ${descr}`,
|
|
1962
|
+
{
|
|
1963
|
+
cause: error
|
|
1964
|
+
}
|
|
1965
|
+
);
|
|
2052
1966
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
for (const kwarg in ast.kwargs) {
|
|
2073
|
-
kwargs.push(`${kwarg} = ${formatAST(ast.kwargs[kwarg])}`);
|
|
1967
|
+
this.ast = normalizeDomainAST(rawAST);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
contains(record) {
|
|
1971
|
+
const expr = evaluate(this.ast, record);
|
|
1972
|
+
return matchDomain(record, expr);
|
|
1973
|
+
}
|
|
1974
|
+
toString() {
|
|
1975
|
+
return formatAST(this.ast);
|
|
1976
|
+
}
|
|
1977
|
+
toList(context) {
|
|
1978
|
+
return evaluate(this.ast, context);
|
|
1979
|
+
}
|
|
1980
|
+
toJson() {
|
|
1981
|
+
try {
|
|
1982
|
+
const evaluatedAsList = this.toList({});
|
|
1983
|
+
const evaluatedDomain = new _Domain(evaluatedAsList);
|
|
1984
|
+
if (evaluatedDomain.toString() === this.toString()) {
|
|
1985
|
+
return evaluatedAsList;
|
|
2074
1986
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
1987
|
+
return this.toString();
|
|
1988
|
+
} catch {
|
|
1989
|
+
return this.toString();
|
|
1990
|
+
}
|
|
2079
1991
|
}
|
|
2080
|
-
}
|
|
2081
|
-
var
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
1992
|
+
};
|
|
1993
|
+
var TRUE_LEAF = [1, "=", 1];
|
|
1994
|
+
var FALSE_LEAF = [0, "=", 1];
|
|
1995
|
+
var TRUE_DOMAIN = new Domain([TRUE_LEAF]);
|
|
1996
|
+
var FALSE_DOMAIN = new Domain([FALSE_LEAF]);
|
|
1997
|
+
Domain.TRUE = TRUE_DOMAIN;
|
|
1998
|
+
Domain.FALSE = FALSE_DOMAIN;
|
|
1999
|
+
function toAST(domain) {
|
|
2000
|
+
const elems = domain.map((elem) => {
|
|
2001
|
+
switch (elem) {
|
|
2002
|
+
case "!":
|
|
2003
|
+
case "&":
|
|
2004
|
+
case "|":
|
|
2005
|
+
return { type: 1, value: elem };
|
|
2006
|
+
default:
|
|
2007
|
+
return {
|
|
2008
|
+
type: 10,
|
|
2009
|
+
value: elem.map(toPyValue)
|
|
2010
|
+
};
|
|
2086
2011
|
}
|
|
2087
2012
|
});
|
|
2013
|
+
return { type: 4, value: elems };
|
|
2088
2014
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
case "-":
|
|
2096
|
-
if (value instanceof Object && "negate" in value) {
|
|
2097
|
-
return value.negate();
|
|
2015
|
+
function normalizeDomainAST(domain, op = "&") {
|
|
2016
|
+
if (domain.type !== 4) {
|
|
2017
|
+
if (domain.type === 10) {
|
|
2018
|
+
const value = domain.value;
|
|
2019
|
+
if (value.findIndex((e) => e.type === 10) === -1 || !value.every((e) => e.type === 10 || e.type === 1)) {
|
|
2020
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2098
2021
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
case "not":
|
|
2103
|
-
return !isTrue(value);
|
|
2104
|
-
default:
|
|
2105
|
-
throw new EvaluationError(`Unknown unary operator: ${ast.op}`);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
function pytypeIndex(val) {
|
|
2109
|
-
switch (typeof val) {
|
|
2110
|
-
case "object":
|
|
2111
|
-
return val === null ? 1 : Array.isArray(val) ? 5 : 3;
|
|
2112
|
-
case "number":
|
|
2113
|
-
return 2;
|
|
2114
|
-
case "string":
|
|
2115
|
-
return 4;
|
|
2116
|
-
default:
|
|
2117
|
-
throw new EvaluationError(`Unknown type: ${typeof val}`);
|
|
2022
|
+
} else {
|
|
2023
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2024
|
+
}
|
|
2118
2025
|
}
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
2122
|
-
return left < right;
|
|
2026
|
+
if (domain.value.length === 0) {
|
|
2027
|
+
return domain;
|
|
2123
2028
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2029
|
+
let expected = 1;
|
|
2030
|
+
for (const child of domain.value) {
|
|
2031
|
+
switch (child.type) {
|
|
2032
|
+
case 1:
|
|
2033
|
+
if (child.value === "&" || child.value === "|") {
|
|
2034
|
+
expected++;
|
|
2035
|
+
} else if (child.value !== "!") {
|
|
2036
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2037
|
+
}
|
|
2038
|
+
break;
|
|
2039
|
+
case 4:
|
|
2040
|
+
/* list */
|
|
2041
|
+
case 10:
|
|
2042
|
+
if (child.value.length === 3) {
|
|
2043
|
+
expected--;
|
|
2044
|
+
break;
|
|
2045
|
+
}
|
|
2046
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2047
|
+
default:
|
|
2048
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2049
|
+
}
|
|
2126
2050
|
}
|
|
2127
|
-
|
|
2128
|
-
|
|
2051
|
+
const values = domain.value.slice();
|
|
2052
|
+
while (expected < 0) {
|
|
2053
|
+
expected++;
|
|
2054
|
+
values.unshift({ type: 1, value: op });
|
|
2129
2055
|
}
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2056
|
+
if (expected > 0) {
|
|
2057
|
+
throw new InvalidDomainError(
|
|
2058
|
+
`invalid domain ${formatAST(domain)} (missing ${expected} segment(s))`
|
|
2059
|
+
);
|
|
2134
2060
|
}
|
|
2135
|
-
return
|
|
2061
|
+
return { type: 4, value: values };
|
|
2136
2062
|
}
|
|
2137
|
-
function
|
|
2138
|
-
if (typeof
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2063
|
+
function matchCondition(record, condition) {
|
|
2064
|
+
if (typeof condition === "boolean") {
|
|
2065
|
+
return condition;
|
|
2066
|
+
}
|
|
2067
|
+
const [field, operator, value] = condition;
|
|
2068
|
+
if (typeof field === "string") {
|
|
2069
|
+
const names = field.split(".");
|
|
2070
|
+
if (names.length >= 2) {
|
|
2071
|
+
return matchCondition(record[names[0]], [
|
|
2072
|
+
names.slice(1).join("."),
|
|
2073
|
+
operator,
|
|
2074
|
+
value
|
|
2075
|
+
]);
|
|
2144
2076
|
}
|
|
2145
|
-
return false;
|
|
2146
2077
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2078
|
+
let likeRegexp, ilikeRegexp;
|
|
2079
|
+
if (["like", "not like", "ilike", "not ilike"].includes(operator)) {
|
|
2080
|
+
likeRegexp = new RegExp(
|
|
2081
|
+
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2082
|
+
"g"
|
|
2083
|
+
);
|
|
2084
|
+
ilikeRegexp = new RegExp(
|
|
2085
|
+
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2086
|
+
"gi"
|
|
2087
|
+
);
|
|
2088
|
+
}
|
|
2089
|
+
const fieldValue = typeof field === "number" ? field : record[field];
|
|
2090
|
+
switch (operator) {
|
|
2091
|
+
case "=?":
|
|
2092
|
+
if ([false, null].includes(value)) {
|
|
2093
|
+
return true;
|
|
2094
|
+
}
|
|
2095
|
+
// eslint-disable-next-line no-fallthrough
|
|
2096
|
+
case "=":
|
|
2097
|
+
case "==":
|
|
2098
|
+
if (Array.isArray(fieldValue) && Array.isArray(value)) {
|
|
2099
|
+
return shallowEqual2(fieldValue, value);
|
|
2100
|
+
}
|
|
2101
|
+
return fieldValue === value;
|
|
2102
|
+
case "!=":
|
|
2103
|
+
case "<>":
|
|
2104
|
+
return !matchCondition(record, [field, "==", value]);
|
|
2105
|
+
case "<":
|
|
2106
|
+
return fieldValue < value;
|
|
2107
|
+
case "<=":
|
|
2108
|
+
return fieldValue <= value;
|
|
2109
|
+
case ">":
|
|
2110
|
+
return fieldValue > value;
|
|
2111
|
+
case ">=":
|
|
2112
|
+
return fieldValue >= value;
|
|
2113
|
+
case "in": {
|
|
2114
|
+
const val = Array.isArray(value) ? value : [value];
|
|
2115
|
+
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2116
|
+
return fieldVal.some((fv) => val.includes(fv));
|
|
2117
|
+
}
|
|
2118
|
+
case "not in": {
|
|
2119
|
+
const val = Array.isArray(value) ? value : [value];
|
|
2120
|
+
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2121
|
+
return !fieldVal.some((fv) => val.includes(fv));
|
|
2122
|
+
}
|
|
2123
|
+
case "like":
|
|
2124
|
+
if (fieldValue === false) {
|
|
2125
|
+
return false;
|
|
2126
|
+
}
|
|
2127
|
+
return Boolean(fieldValue.match(likeRegexp));
|
|
2128
|
+
case "not like":
|
|
2129
|
+
if (fieldValue === false) {
|
|
2130
|
+
return false;
|
|
2131
|
+
}
|
|
2132
|
+
return Boolean(!fieldValue.match(likeRegexp));
|
|
2133
|
+
case "=like":
|
|
2134
|
+
if (fieldValue === false) {
|
|
2135
|
+
return false;
|
|
2136
|
+
}
|
|
2137
|
+
return new RegExp(escapeRegExp(value).replace(/%/g, ".*")).test(
|
|
2138
|
+
fieldValue
|
|
2139
|
+
);
|
|
2140
|
+
case "ilike":
|
|
2141
|
+
if (fieldValue === false) {
|
|
2142
|
+
return false;
|
|
2143
|
+
}
|
|
2144
|
+
return Boolean(fieldValue.match(ilikeRegexp));
|
|
2145
|
+
case "not ilike":
|
|
2146
|
+
if (fieldValue === false) {
|
|
2147
|
+
return false;
|
|
2148
|
+
}
|
|
2149
|
+
return Boolean(!fieldValue.match(ilikeRegexp));
|
|
2150
|
+
case "=ilike":
|
|
2151
|
+
if (fieldValue === false) {
|
|
2152
|
+
return false;
|
|
2153
|
+
}
|
|
2154
|
+
return new RegExp(escapeRegExp(value).replace(/%/g, ".*"), "i").test(
|
|
2155
|
+
fieldValue
|
|
2156
|
+
);
|
|
2149
2157
|
}
|
|
2150
|
-
|
|
2158
|
+
throw new InvalidDomainError("could not match domain");
|
|
2151
2159
|
}
|
|
2152
|
-
function
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2160
|
+
function makeOperators(record) {
|
|
2161
|
+
const match = matchCondition.bind(null, record);
|
|
2162
|
+
return {
|
|
2163
|
+
"!": (x) => !match(x),
|
|
2164
|
+
"&": (a, b) => match(a) && match(b),
|
|
2165
|
+
"|": (a, b) => match(a) || match(b)
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
function matchDomain(record, domain) {
|
|
2169
|
+
if (domain.length === 0) {
|
|
2170
|
+
return true;
|
|
2158
2171
|
}
|
|
2159
|
-
|
|
2160
|
-
|
|
2172
|
+
const operators = makeOperators(record);
|
|
2173
|
+
const reversedDomain = Array.from(domain).reverse();
|
|
2174
|
+
const condStack = [];
|
|
2175
|
+
for (const item of reversedDomain) {
|
|
2176
|
+
const operator = typeof item === "string" && operators[item];
|
|
2177
|
+
if (operator) {
|
|
2178
|
+
const operands = condStack.splice(-operator.length);
|
|
2179
|
+
condStack.push(operator(...operands));
|
|
2180
|
+
} else {
|
|
2181
|
+
condStack.push(item);
|
|
2182
|
+
}
|
|
2161
2183
|
}
|
|
2162
|
-
return
|
|
2184
|
+
return matchCondition(record, condStack.pop());
|
|
2163
2185
|
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
return left.add(right);
|
|
2186
|
+
|
|
2187
|
+
// src/utils/function.ts
|
|
2188
|
+
var import_react = require("react");
|
|
2189
|
+
var toQueryString = (params) => {
|
|
2190
|
+
return Object.keys(params).map(
|
|
2191
|
+
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
|
2192
|
+
).join("&");
|
|
2193
|
+
};
|
|
2194
|
+
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2195
|
+
if (!originalRequest.data) return originalRequest.data;
|
|
2196
|
+
if (typeof originalRequest.data === "string") {
|
|
2197
|
+
try {
|
|
2198
|
+
const parsedData = JSON.parse(originalRequest.data);
|
|
2199
|
+
if (parsedData.with_context && typeof parsedData.with_context === "object") {
|
|
2200
|
+
parsedData.with_context.token = newAccessToken;
|
|
2180
2201
|
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2202
|
+
return JSON.stringify(parsedData);
|
|
2203
|
+
} catch (e) {
|
|
2204
|
+
console.warn("Failed to parse originalRequest.data", e);
|
|
2205
|
+
return originalRequest.data;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
|
|
2209
|
+
originalRequest.data.with_context.token = newAccessToken;
|
|
2210
|
+
}
|
|
2211
|
+
return originalRequest.data;
|
|
2212
|
+
};
|
|
2213
|
+
|
|
2214
|
+
// src/utils/storage/local-storage.ts
|
|
2215
|
+
var localStorageUtils = () => {
|
|
2216
|
+
const setToken = async (access_token) => {
|
|
2217
|
+
localStorage.setItem("accessToken", access_token);
|
|
2218
|
+
};
|
|
2219
|
+
const setRefreshToken = async (refresh_token) => {
|
|
2220
|
+
localStorage.setItem("refreshToken", refresh_token);
|
|
2221
|
+
};
|
|
2222
|
+
const getAccessToken = async () => {
|
|
2223
|
+
return localStorage.getItem("accessToken");
|
|
2224
|
+
};
|
|
2225
|
+
const getRefreshToken = async () => {
|
|
2226
|
+
return localStorage.getItem("refreshToken");
|
|
2227
|
+
};
|
|
2228
|
+
const clearToken = async () => {
|
|
2229
|
+
localStorage.removeItem("accessToken");
|
|
2230
|
+
localStorage.removeItem("refreshToken");
|
|
2231
|
+
};
|
|
2232
|
+
return {
|
|
2233
|
+
setToken,
|
|
2234
|
+
setRefreshToken,
|
|
2235
|
+
getAccessToken,
|
|
2236
|
+
getRefreshToken,
|
|
2237
|
+
clearToken
|
|
2238
|
+
};
|
|
2239
|
+
};
|
|
2240
|
+
|
|
2241
|
+
// src/utils/storage/session-storage.ts
|
|
2242
|
+
var sessionStorageUtils = () => {
|
|
2243
|
+
const getBrowserSession = async () => {
|
|
2244
|
+
return sessionStorage.getItem("browserSession");
|
|
2245
|
+
};
|
|
2246
|
+
return {
|
|
2247
|
+
getBrowserSession
|
|
2248
|
+
};
|
|
2249
|
+
};
|
|
2250
|
+
|
|
2251
|
+
// src/configs/axios-client.ts
|
|
2252
|
+
var axiosClient = {
|
|
2253
|
+
init(config) {
|
|
2254
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2255
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2256
|
+
const db = config.db;
|
|
2257
|
+
let isRefreshing = false;
|
|
2258
|
+
let failedQueue = [];
|
|
2259
|
+
const processQueue = (error, token = null) => {
|
|
2260
|
+
failedQueue?.forEach((prom) => {
|
|
2261
|
+
if (error) {
|
|
2262
|
+
prom.reject(error);
|
|
2184
2263
|
} else {
|
|
2185
|
-
|
|
2264
|
+
prom.resolve(token);
|
|
2186
2265
|
}
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2266
|
+
});
|
|
2267
|
+
failedQueue = [];
|
|
2268
|
+
};
|
|
2269
|
+
const instance = import_axios.default.create({
|
|
2270
|
+
adapter: import_axios.default.defaults.adapter,
|
|
2271
|
+
baseURL: config.baseUrl,
|
|
2272
|
+
timeout: 5e4,
|
|
2273
|
+
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2274
|
+
});
|
|
2275
|
+
instance.interceptors.request.use(
|
|
2276
|
+
async (config2) => {
|
|
2277
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2278
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2279
|
+
if (token) {
|
|
2280
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2193
2281
|
}
|
|
2282
|
+
return config2;
|
|
2283
|
+
},
|
|
2284
|
+
(error) => {
|
|
2285
|
+
Promise.reject(error);
|
|
2194
2286
|
}
|
|
2195
|
-
|
|
2196
|
-
|
|
2287
|
+
);
|
|
2288
|
+
instance.interceptors.response.use(
|
|
2289
|
+
(response) => {
|
|
2290
|
+
return handleResponse(response);
|
|
2291
|
+
},
|
|
2292
|
+
async (error) => {
|
|
2293
|
+
const handleError3 = async (error2) => {
|
|
2294
|
+
if (!error2.response) {
|
|
2295
|
+
return error2;
|
|
2296
|
+
}
|
|
2297
|
+
const { data } = error2.response;
|
|
2298
|
+
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
2299
|
+
await clearAuthToken();
|
|
2300
|
+
}
|
|
2301
|
+
return data;
|
|
2302
|
+
};
|
|
2303
|
+
const originalRequest = error.config;
|
|
2304
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2305
|
+
error.response.data.code
|
|
2306
|
+
)) {
|
|
2307
|
+
if (isRefreshing) {
|
|
2308
|
+
return new Promise(function(resolve, reject) {
|
|
2309
|
+
failedQueue.push({ resolve, reject });
|
|
2310
|
+
}).then((token) => {
|
|
2311
|
+
originalRequest.headers["Authorization"] = "Bearer " + token;
|
|
2312
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2313
|
+
originalRequest,
|
|
2314
|
+
token
|
|
2315
|
+
);
|
|
2316
|
+
return instance.request(originalRequest);
|
|
2317
|
+
}).catch(async (err) => {
|
|
2318
|
+
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2319
|
+
await clearAuthToken();
|
|
2320
|
+
}
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
const browserSession = await sessionStorage2.getBrowserSession();
|
|
2324
|
+
const refreshToken = await localStorage2.getRefreshToken();
|
|
2325
|
+
const accessTokenExp = await localStorage2.getAccessToken();
|
|
2326
|
+
isRefreshing = true;
|
|
2327
|
+
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2328
|
+
await clearAuthToken();
|
|
2329
|
+
} else {
|
|
2330
|
+
const payload = Object.fromEntries(
|
|
2331
|
+
Object.entries({
|
|
2332
|
+
refresh_token: refreshToken,
|
|
2333
|
+
grant_type: "refresh_token",
|
|
2334
|
+
client_id: config.config.clientId,
|
|
2335
|
+
client_secret: config.config.clientSecret
|
|
2336
|
+
}).filter(([_, value]) => !!value)
|
|
2337
|
+
);
|
|
2338
|
+
return new Promise(function(resolve) {
|
|
2339
|
+
import_axios.default.post(
|
|
2340
|
+
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2341
|
+
payload,
|
|
2342
|
+
{
|
|
2343
|
+
headers: {
|
|
2344
|
+
"Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
|
|
2345
|
+
Authorization: `Bearer ${accessTokenExp}`
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
).then(async (res) => {
|
|
2349
|
+
const data = res.data;
|
|
2350
|
+
await localStorage2.setToken(data.access_token);
|
|
2351
|
+
await localStorage2.setRefreshToken(data.refresh_token);
|
|
2352
|
+
import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2353
|
+
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2354
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2355
|
+
originalRequest,
|
|
2356
|
+
data.access_token
|
|
2357
|
+
);
|
|
2358
|
+
processQueue(null, data.access_token);
|
|
2359
|
+
resolve(instance.request(originalRequest));
|
|
2360
|
+
}).catch(async (err) => {
|
|
2361
|
+
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
2362
|
+
await clearAuthToken();
|
|
2363
|
+
}
|
|
2364
|
+
if (err && err.response) {
|
|
2365
|
+
const { error_code } = err.response?.data || {};
|
|
2366
|
+
if (error_code === "AUTHEN_FAIL") {
|
|
2367
|
+
await clearAuthToken();
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
processQueue(err, null);
|
|
2371
|
+
}).finally(() => {
|
|
2372
|
+
isRefreshing = false;
|
|
2373
|
+
});
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
return Promise.reject(await handleError3(error));
|
|
2197
2378
|
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
if (isRightDelta) {
|
|
2203
|
-
return PyRelativeDelta.substract(left, right);
|
|
2379
|
+
);
|
|
2380
|
+
const handleResponse = (res) => {
|
|
2381
|
+
if (res && res.data) {
|
|
2382
|
+
return res.data;
|
|
2204
2383
|
}
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2384
|
+
return res;
|
|
2385
|
+
};
|
|
2386
|
+
const handleError2 = (error) => {
|
|
2387
|
+
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2388
|
+
console.error("Request Timeout Error:", error);
|
|
2389
|
+
return "Request Timeout Error";
|
|
2390
|
+
} else if (error.isAxiosError && !error.response) {
|
|
2391
|
+
console.error("Network Error:", error);
|
|
2392
|
+
return "Network Error";
|
|
2393
|
+
} else {
|
|
2394
|
+
console.error("Other Error:", error?.response);
|
|
2395
|
+
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
2396
|
+
return { message: errorMessage, status: error?.response?.status };
|
|
2214
2397
|
}
|
|
2215
|
-
|
|
2216
|
-
|
|
2398
|
+
};
|
|
2399
|
+
const clearAuthToken = async () => {
|
|
2400
|
+
await localStorage2.clearToken();
|
|
2401
|
+
if (typeof window !== "undefined") {
|
|
2402
|
+
window.location.href = `/login`;
|
|
2217
2403
|
}
|
|
2218
|
-
|
|
2404
|
+
};
|
|
2405
|
+
function formatUrl(url, db2) {
|
|
2406
|
+
return url + (db2 ? "?db=" + db2 : "");
|
|
2219
2407
|
}
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2408
|
+
const responseBody = (response) => response;
|
|
2409
|
+
const requests = {
|
|
2410
|
+
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
2411
|
+
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
2412
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
2413
|
+
responseType: "arraybuffer",
|
|
2414
|
+
headers: {
|
|
2415
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2416
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2417
|
+
}
|
|
2418
|
+
}).then(responseBody),
|
|
2419
|
+
put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
|
|
2420
|
+
patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
|
|
2421
|
+
delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
|
|
2422
|
+
};
|
|
2423
|
+
return requests;
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
|
|
2427
|
+
// src/store/index.ts
|
|
2428
|
+
var import_react_redux = require("react-redux");
|
|
2429
|
+
|
|
2430
|
+
// src/store/reducers/breadcrums-slice/index.ts
|
|
2431
|
+
var import_toolkit = require("@reduxjs/toolkit");
|
|
2432
|
+
var initialState = {
|
|
2433
|
+
breadCrumbs: []
|
|
2434
|
+
};
|
|
2435
|
+
var breadcrumbsSlice = (0, import_toolkit.createSlice)({
|
|
2436
|
+
name: "breadcrumbs",
|
|
2437
|
+
initialState,
|
|
2438
|
+
reducers: {
|
|
2439
|
+
setBreadCrumbs: (state, action) => {
|
|
2440
|
+
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
2229
2441
|
}
|
|
2230
|
-
case "/":
|
|
2231
|
-
return left / right;
|
|
2232
|
-
case "%":
|
|
2233
|
-
return left % right;
|
|
2234
|
-
case "//":
|
|
2235
|
-
if (left instanceof PyTimeDelta) {
|
|
2236
|
-
return left.divide(right);
|
|
2237
|
-
}
|
|
2238
|
-
return Math.floor(left / right);
|
|
2239
|
-
case "**":
|
|
2240
|
-
return left ** right;
|
|
2241
|
-
case "==":
|
|
2242
|
-
return isEqual(left, right);
|
|
2243
|
-
case "<>":
|
|
2244
|
-
case "!=":
|
|
2245
|
-
return !isEqual(left, right);
|
|
2246
|
-
case "<":
|
|
2247
|
-
return isLess(left, right);
|
|
2248
|
-
case ">":
|
|
2249
|
-
return isLess(right, left);
|
|
2250
|
-
case ">=":
|
|
2251
|
-
return isEqual(left, right) || isLess(right, left);
|
|
2252
|
-
case "<=":
|
|
2253
|
-
return isEqual(left, right) || isLess(left, right);
|
|
2254
|
-
case "in":
|
|
2255
|
-
return isIn(left, right);
|
|
2256
|
-
case "not in":
|
|
2257
|
-
return !isIn(left, right);
|
|
2258
|
-
default:
|
|
2259
|
-
throw new EvaluationError(`Unknown binary operator: ${ast.op}`);
|
|
2260
2442
|
}
|
|
2261
|
-
}
|
|
2262
|
-
var
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2443
|
+
});
|
|
2444
|
+
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
2445
|
+
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
2446
|
+
|
|
2447
|
+
// src/store/reducers/env-slice/index.ts
|
|
2448
|
+
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
2449
|
+
var initialState2 = {
|
|
2450
|
+
baseUrl: "",
|
|
2451
|
+
requests: null,
|
|
2452
|
+
companies: [],
|
|
2453
|
+
user: {},
|
|
2454
|
+
config: null,
|
|
2455
|
+
envFile: null,
|
|
2456
|
+
defaultCompany: {
|
|
2457
|
+
id: null,
|
|
2458
|
+
logo: "",
|
|
2459
|
+
secondary_color: "",
|
|
2460
|
+
primary_color: ""
|
|
2461
|
+
},
|
|
2462
|
+
context: {
|
|
2463
|
+
uid: null,
|
|
2464
|
+
allowed_company_ids: [],
|
|
2465
|
+
lang: "vi_VN",
|
|
2466
|
+
tz: "Asia/Saigon"
|
|
2467
|
+
}
|
|
2468
|
+
};
|
|
2469
|
+
var envSlice = (0, import_toolkit2.createSlice)({
|
|
2470
|
+
name: "env",
|
|
2471
|
+
initialState: initialState2,
|
|
2472
|
+
reducers: {
|
|
2473
|
+
setEnv: (state, action) => {
|
|
2474
|
+
Object.assign(state, action.payload);
|
|
2475
|
+
},
|
|
2476
|
+
setUid: (state, action) => {
|
|
2477
|
+
state.context.uid = action.payload;
|
|
2478
|
+
},
|
|
2479
|
+
setAllowCompanies: (state, action) => {
|
|
2480
|
+
state.context.allowed_company_ids = action.payload;
|
|
2481
|
+
},
|
|
2482
|
+
setCompanies: (state, action) => {
|
|
2483
|
+
state.companies = action.payload;
|
|
2484
|
+
},
|
|
2485
|
+
setDefaultCompany: (state, action) => {
|
|
2486
|
+
state.defaultCompany = action.payload;
|
|
2487
|
+
},
|
|
2488
|
+
setLang: (state, action) => {
|
|
2489
|
+
state.context.lang = action.payload;
|
|
2490
|
+
},
|
|
2491
|
+
setUser: (state, action) => {
|
|
2492
|
+
state.user = action.payload;
|
|
2493
|
+
},
|
|
2494
|
+
setConfig: (state, action) => {
|
|
2495
|
+
state.config = action.payload;
|
|
2496
|
+
},
|
|
2497
|
+
setEnvFile: (state, action) => {
|
|
2498
|
+
state.envFile = action.payload;
|
|
2270
2499
|
}
|
|
2271
|
-
return null;
|
|
2272
2500
|
}
|
|
2501
|
+
});
|
|
2502
|
+
var {
|
|
2503
|
+
setEnv,
|
|
2504
|
+
setUid,
|
|
2505
|
+
setLang,
|
|
2506
|
+
setAllowCompanies,
|
|
2507
|
+
setCompanies,
|
|
2508
|
+
setDefaultCompany,
|
|
2509
|
+
setUser,
|
|
2510
|
+
setConfig,
|
|
2511
|
+
setEnvFile
|
|
2512
|
+
} = envSlice.actions;
|
|
2513
|
+
var env_slice_default = envSlice.reducer;
|
|
2514
|
+
|
|
2515
|
+
// src/store/reducers/excel-slice/index.ts
|
|
2516
|
+
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
2517
|
+
var initialState3 = {
|
|
2518
|
+
dataParse: null,
|
|
2519
|
+
idFile: null,
|
|
2520
|
+
isFileLoaded: false,
|
|
2521
|
+
loadingImport: false,
|
|
2522
|
+
selectedFile: null,
|
|
2523
|
+
errorData: null
|
|
2273
2524
|
};
|
|
2274
|
-
var
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2525
|
+
var excelSlice = (0, import_toolkit3.createSlice)({
|
|
2526
|
+
name: "excel",
|
|
2527
|
+
initialState: initialState3,
|
|
2528
|
+
reducers: {
|
|
2529
|
+
setDataParse: (state, action) => {
|
|
2530
|
+
state.dataParse = action.payload;
|
|
2531
|
+
},
|
|
2532
|
+
setIdFile: (state, action) => {
|
|
2533
|
+
state.idFile = action.payload;
|
|
2534
|
+
},
|
|
2535
|
+
setIsFileLoaded: (state, action) => {
|
|
2536
|
+
state.isFileLoaded = action.payload;
|
|
2537
|
+
},
|
|
2538
|
+
setLoadingImport: (state, action) => {
|
|
2539
|
+
state.loadingImport = action.payload;
|
|
2540
|
+
},
|
|
2541
|
+
setSelectedFile: (state, action) => {
|
|
2542
|
+
state.selectedFile = action.payload;
|
|
2543
|
+
},
|
|
2544
|
+
setErrorData: (state, action) => {
|
|
2545
|
+
state.errorData = action.payload;
|
|
2546
|
+
}
|
|
2280
2547
|
}
|
|
2548
|
+
});
|
|
2549
|
+
var {
|
|
2550
|
+
setDataParse,
|
|
2551
|
+
setIdFile,
|
|
2552
|
+
setIsFileLoaded,
|
|
2553
|
+
setLoadingImport,
|
|
2554
|
+
setSelectedFile,
|
|
2555
|
+
setErrorData
|
|
2556
|
+
} = excelSlice.actions;
|
|
2557
|
+
var excel_slice_default = excelSlice.reducer;
|
|
2558
|
+
|
|
2559
|
+
// src/store/reducers/form-slice/index.ts
|
|
2560
|
+
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
2561
|
+
var initialState4 = {
|
|
2562
|
+
viewDataStore: {},
|
|
2563
|
+
isShowingModalDetail: false,
|
|
2564
|
+
isShowModalTranslate: false,
|
|
2565
|
+
formSubmitComponent: {},
|
|
2566
|
+
fieldTranslation: null,
|
|
2567
|
+
listSubject: {},
|
|
2568
|
+
dataUser: {}
|
|
2281
2569
|
};
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
)
|
|
2570
|
+
var formSlice = (0, import_toolkit4.createSlice)({
|
|
2571
|
+
name: "form",
|
|
2572
|
+
initialState: initialState4,
|
|
2573
|
+
reducers: {
|
|
2574
|
+
setViewDataStore: (state, action) => {
|
|
2575
|
+
state.viewDataStore = action.payload;
|
|
2576
|
+
},
|
|
2577
|
+
setIsShowingModalDetail: (state, action) => {
|
|
2578
|
+
state.isShowingModalDetail = action.payload;
|
|
2579
|
+
},
|
|
2580
|
+
setIsShowModalTranslate: (state, action) => {
|
|
2581
|
+
state.isShowModalTranslate = action.payload;
|
|
2582
|
+
},
|
|
2583
|
+
setFormSubmitComponent: (state, action) => {
|
|
2584
|
+
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
2585
|
+
},
|
|
2586
|
+
setFieldTranslate: (state, action) => {
|
|
2587
|
+
state.fieldTranslation = action.payload;
|
|
2588
|
+
},
|
|
2589
|
+
setListSubject: (state, action) => {
|
|
2590
|
+
state.listSubject = action.payload;
|
|
2591
|
+
},
|
|
2592
|
+
setDataUser: (state, action) => {
|
|
2593
|
+
state.dataUser = action.payload;
|
|
2594
|
+
}
|
|
2290
2595
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
},
|
|
2310
|
-
difference(...args) {
|
|
2311
|
-
return applyFunc(
|
|
2312
|
-
"difference",
|
|
2313
|
-
(iterable) => {
|
|
2314
|
-
iterable = new Set(iterable);
|
|
2315
|
-
const difference = /* @__PURE__ */ new Set();
|
|
2316
|
-
for (const e of this) {
|
|
2317
|
-
if (!iterable.has(e)) {
|
|
2318
|
-
difference.add(e);
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
return difference;
|
|
2322
|
-
},
|
|
2323
|
-
this,
|
|
2324
|
-
...args
|
|
2325
|
-
);
|
|
2596
|
+
});
|
|
2597
|
+
var {
|
|
2598
|
+
setViewDataStore,
|
|
2599
|
+
setIsShowingModalDetail,
|
|
2600
|
+
setIsShowModalTranslate,
|
|
2601
|
+
setFormSubmitComponent,
|
|
2602
|
+
setFieldTranslate,
|
|
2603
|
+
setListSubject,
|
|
2604
|
+
setDataUser
|
|
2605
|
+
} = formSlice.actions;
|
|
2606
|
+
var form_slice_default = formSlice.reducer;
|
|
2607
|
+
|
|
2608
|
+
// src/store/reducers/header-slice/index.ts
|
|
2609
|
+
var import_toolkit5 = require("@reduxjs/toolkit");
|
|
2610
|
+
var headerSlice = (0, import_toolkit5.createSlice)({
|
|
2611
|
+
name: "header",
|
|
2612
|
+
initialState: {
|
|
2613
|
+
value: { allowedCompanyIds: [] }
|
|
2326
2614
|
},
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
...args
|
|
2335
|
-
);
|
|
2615
|
+
reducers: {
|
|
2616
|
+
setHeader: (state, action) => {
|
|
2617
|
+
state.value = { ...state.value, ...action.payload };
|
|
2618
|
+
},
|
|
2619
|
+
setAllowedCompanyIds: (state, action) => {
|
|
2620
|
+
state.value.allowedCompanyIds = action.payload;
|
|
2621
|
+
}
|
|
2336
2622
|
}
|
|
2623
|
+
});
|
|
2624
|
+
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
2625
|
+
var header_slice_default = headerSlice.reducer;
|
|
2626
|
+
|
|
2627
|
+
// src/store/reducers/list-slice/index.ts
|
|
2628
|
+
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
2629
|
+
var initialState5 = {
|
|
2630
|
+
pageLimit: 10,
|
|
2631
|
+
fields: {},
|
|
2632
|
+
order: "",
|
|
2633
|
+
selectedRowKeys: [],
|
|
2634
|
+
selectedRadioKey: 0,
|
|
2635
|
+
indexRowTableModal: -2,
|
|
2636
|
+
isUpdateTableModal: false,
|
|
2637
|
+
footerGroupTable: {},
|
|
2638
|
+
transferDetail: null,
|
|
2639
|
+
page: 0,
|
|
2640
|
+
domainTable: []
|
|
2337
2641
|
};
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2642
|
+
var listSlice = (0, import_toolkit6.createSlice)({
|
|
2643
|
+
name: "list",
|
|
2644
|
+
initialState: initialState5,
|
|
2645
|
+
reducers: {
|
|
2646
|
+
setPageLimit: (state, action) => {
|
|
2647
|
+
state.pageLimit = action.payload;
|
|
2648
|
+
},
|
|
2649
|
+
setFields: (state, action) => {
|
|
2650
|
+
state.fields = action.payload;
|
|
2651
|
+
},
|
|
2652
|
+
setOrder: (state, action) => {
|
|
2653
|
+
state.order = action.payload;
|
|
2654
|
+
},
|
|
2655
|
+
setSelectedRowKeys: (state, action) => {
|
|
2656
|
+
state.selectedRowKeys = action.payload;
|
|
2657
|
+
},
|
|
2658
|
+
setSelectedRadioKey: (state, action) => {
|
|
2659
|
+
state.selectedRadioKey = action.payload;
|
|
2660
|
+
},
|
|
2661
|
+
setIndexRowTableModal: (state, action) => {
|
|
2662
|
+
state.indexRowTableModal = action.payload;
|
|
2663
|
+
},
|
|
2664
|
+
setTransferDetail: (state, action) => {
|
|
2665
|
+
state.transferDetail = action.payload;
|
|
2666
|
+
},
|
|
2667
|
+
setIsUpdateTableModal: (state, action) => {
|
|
2668
|
+
state.isUpdateTableModal = action.payload;
|
|
2669
|
+
},
|
|
2670
|
+
setPage: (state, action) => {
|
|
2671
|
+
state.page = action.payload;
|
|
2672
|
+
},
|
|
2673
|
+
setDomainTable: (state, action) => {
|
|
2674
|
+
state.domainTable = action.payload;
|
|
2675
|
+
}
|
|
2371
2676
|
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
case 10:
|
|
2407
|
-
return ast2.value.map(_evaluate);
|
|
2408
|
-
case 11:
|
|
2409
|
-
const dict = {};
|
|
2410
|
-
for (const key2 in ast2.value) {
|
|
2411
|
-
dict[key2] = _evaluate(ast2.value[key2]);
|
|
2412
|
-
}
|
|
2413
|
-
dicts.add(dict);
|
|
2414
|
-
return dict;
|
|
2415
|
-
case 8:
|
|
2416
|
-
const fnValue = _evaluate(ast2.fn);
|
|
2417
|
-
const args = ast2.args.map(_evaluate);
|
|
2418
|
-
const kwargs = {};
|
|
2419
|
-
for (const kwarg in ast2.kwargs) {
|
|
2420
|
-
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
2421
|
-
}
|
|
2422
|
-
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
2423
|
-
return fnValue.create(...args, kwargs);
|
|
2424
|
-
}
|
|
2425
|
-
return fnValue(...args, kwargs);
|
|
2426
|
-
case 12:
|
|
2427
|
-
const dictVal = _evaluate(ast2.target);
|
|
2428
|
-
const key = _evaluate(ast2.key);
|
|
2429
|
-
return dictVal[key];
|
|
2430
|
-
case 13:
|
|
2431
|
-
if (isTrue(_evaluate(ast2.condition))) {
|
|
2432
|
-
return _evaluate(ast2.ifTrue);
|
|
2433
|
-
} else {
|
|
2434
|
-
return _evaluate(ast2.ifFalse);
|
|
2435
|
-
}
|
|
2436
|
-
case 15:
|
|
2437
|
-
let leftVal = _evaluate(ast2.obj);
|
|
2438
|
-
let result;
|
|
2439
|
-
if (dicts.has(leftVal) || Object.isPrototypeOf.call(PY_DICT, leftVal)) {
|
|
2440
|
-
result = DICT[ast2.key];
|
|
2441
|
-
} else if (typeof leftVal === "string") {
|
|
2442
|
-
result = STRING[ast2.key];
|
|
2443
|
-
} else if (leftVal instanceof Set) {
|
|
2444
|
-
result = SET[ast2.key];
|
|
2445
|
-
} else if (ast2.key === "get" && typeof leftVal === "object") {
|
|
2446
|
-
result = DICT[ast2.key];
|
|
2447
|
-
leftVal = toPyDict(leftVal);
|
|
2448
|
-
} else {
|
|
2449
|
-
result = leftVal[ast2.key];
|
|
2450
|
-
}
|
|
2451
|
-
if (typeof result === "function") {
|
|
2452
|
-
const bound = result.bind(leftVal);
|
|
2453
|
-
bound[unboundFn] = result;
|
|
2454
|
-
return bound;
|
|
2455
|
-
}
|
|
2456
|
-
return result;
|
|
2457
|
-
default:
|
|
2458
|
-
throw new EvaluationError(`AST of type ${ast2.type} cannot be evaluated`);
|
|
2677
|
+
});
|
|
2678
|
+
var {
|
|
2679
|
+
setPageLimit,
|
|
2680
|
+
setFields,
|
|
2681
|
+
setOrder,
|
|
2682
|
+
setSelectedRowKeys,
|
|
2683
|
+
setIndexRowTableModal,
|
|
2684
|
+
setIsUpdateTableModal,
|
|
2685
|
+
setPage,
|
|
2686
|
+
setSelectedRadioKey,
|
|
2687
|
+
setTransferDetail,
|
|
2688
|
+
setDomainTable
|
|
2689
|
+
} = listSlice.actions;
|
|
2690
|
+
var list_slice_default = listSlice.reducer;
|
|
2691
|
+
|
|
2692
|
+
// src/store/reducers/login-slice/index.ts
|
|
2693
|
+
var import_toolkit7 = require("@reduxjs/toolkit");
|
|
2694
|
+
var initialState6 = {
|
|
2695
|
+
db: "",
|
|
2696
|
+
redirectTo: "/",
|
|
2697
|
+
forgotPasswordUrl: "/"
|
|
2698
|
+
};
|
|
2699
|
+
var loginSlice = (0, import_toolkit7.createSlice)({
|
|
2700
|
+
name: "login",
|
|
2701
|
+
initialState: initialState6,
|
|
2702
|
+
reducers: {
|
|
2703
|
+
setDb: (state, action) => {
|
|
2704
|
+
state.db = action.payload;
|
|
2705
|
+
},
|
|
2706
|
+
setRedirectTo: (state, action) => {
|
|
2707
|
+
state.redirectTo = action.payload;
|
|
2708
|
+
},
|
|
2709
|
+
setForgotPasswordUrl: (state, action) => {
|
|
2710
|
+
state.forgotPasswordUrl = action.payload;
|
|
2459
2711
|
}
|
|
2460
2712
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2713
|
+
});
|
|
2714
|
+
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
2715
|
+
var login_slice_default = loginSlice.reducer;
|
|
2716
|
+
|
|
2717
|
+
// src/store/reducers/navbar-slice/index.ts
|
|
2718
|
+
var import_toolkit8 = require("@reduxjs/toolkit");
|
|
2719
|
+
var initialState7 = {
|
|
2720
|
+
menuFocus: {},
|
|
2721
|
+
menuAction: {},
|
|
2722
|
+
navbarWidth: 250,
|
|
2723
|
+
menuList: []
|
|
2724
|
+
};
|
|
2725
|
+
var navbarSlice = (0, import_toolkit8.createSlice)({
|
|
2726
|
+
name: "navbar",
|
|
2727
|
+
initialState: initialState7,
|
|
2728
|
+
reducers: {
|
|
2729
|
+
setMenuFocus: (state, action) => {
|
|
2730
|
+
state.menuFocus = action.payload;
|
|
2731
|
+
},
|
|
2732
|
+
setMenuFocusAction: (state, action) => {
|
|
2733
|
+
state.menuAction = action.payload;
|
|
2734
|
+
},
|
|
2735
|
+
setNavbarWidth: (state, action) => {
|
|
2736
|
+
state.navbarWidth = action.payload;
|
|
2737
|
+
},
|
|
2738
|
+
setMenuList: (state, action) => {
|
|
2739
|
+
state.menuList = action.payload;
|
|
2465
2740
|
}
|
|
2466
|
-
return val;
|
|
2467
2741
|
}
|
|
2468
|
-
|
|
2469
|
-
}
|
|
2742
|
+
});
|
|
2743
|
+
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
2744
|
+
var navbar_slice_default = navbarSlice.reducer;
|
|
2470
2745
|
|
|
2471
|
-
// src/
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
}
|
|
2746
|
+
// src/store/reducers/profile-slice/index.ts
|
|
2747
|
+
var import_toolkit9 = require("@reduxjs/toolkit");
|
|
2748
|
+
var initialState8 = {
|
|
2749
|
+
profile: {}
|
|
2750
|
+
};
|
|
2751
|
+
var profileSlice = (0, import_toolkit9.createSlice)({
|
|
2752
|
+
name: "profile",
|
|
2753
|
+
initialState: initialState8,
|
|
2754
|
+
reducers: {
|
|
2755
|
+
setProfile: (state, action) => {
|
|
2756
|
+
state.profile = action.payload;
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2760
|
+
var { setProfile } = profileSlice.actions;
|
|
2761
|
+
var profile_slice_default = profileSlice.reducer;
|
|
2476
2762
|
|
|
2477
|
-
// src/
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2763
|
+
// src/store/reducers/search-slice/index.ts
|
|
2764
|
+
var import_toolkit10 = require("@reduxjs/toolkit");
|
|
2765
|
+
var initialState9 = {
|
|
2766
|
+
groupByDomain: null,
|
|
2767
|
+
searchBy: [],
|
|
2768
|
+
searchString: "",
|
|
2769
|
+
hoveredIndexSearchList: null,
|
|
2770
|
+
selectedTags: [],
|
|
2771
|
+
firstDomain: null,
|
|
2772
|
+
searchMap: {},
|
|
2773
|
+
filterBy: [],
|
|
2774
|
+
groupBy: []
|
|
2775
|
+
};
|
|
2776
|
+
var searchSlice = (0, import_toolkit10.createSlice)({
|
|
2777
|
+
name: "search",
|
|
2778
|
+
initialState: initialState9,
|
|
2779
|
+
reducers: {
|
|
2780
|
+
setGroupByDomain: (state, action) => {
|
|
2781
|
+
state.groupByDomain = action.payload;
|
|
2782
|
+
},
|
|
2783
|
+
setSearchBy: (state, action) => {
|
|
2784
|
+
state.searchBy = action.payload;
|
|
2785
|
+
},
|
|
2786
|
+
setSearchString: (state, action) => {
|
|
2787
|
+
state.searchString = action.payload;
|
|
2788
|
+
},
|
|
2789
|
+
setHoveredIndexSearchList: (state, action) => {
|
|
2790
|
+
state.hoveredIndexSearchList = action.payload;
|
|
2791
|
+
},
|
|
2792
|
+
setSelectedTags: (state, action) => {
|
|
2793
|
+
state.selectedTags = action.payload;
|
|
2794
|
+
},
|
|
2795
|
+
setFirstDomain: (state, action) => {
|
|
2796
|
+
state.firstDomain = action.payload;
|
|
2797
|
+
},
|
|
2798
|
+
setFilterBy: (state, action) => {
|
|
2799
|
+
state.filterBy = action.payload;
|
|
2800
|
+
},
|
|
2801
|
+
setGroupBy: (state, action) => {
|
|
2802
|
+
state.groupBy = action.payload;
|
|
2803
|
+
},
|
|
2804
|
+
setSearchMap: (state, action) => {
|
|
2805
|
+
state.searchMap = action.payload;
|
|
2806
|
+
},
|
|
2807
|
+
updateSearchMap: (state, action) => {
|
|
2808
|
+
if (!state.searchMap[action.payload.key]) {
|
|
2809
|
+
state.searchMap[action.payload.key] = [];
|
|
2810
|
+
}
|
|
2811
|
+
state.searchMap[action.payload.key].push(action.payload.value);
|
|
2812
|
+
},
|
|
2813
|
+
removeKeyFromSearchMap: (state, action) => {
|
|
2814
|
+
const { key, item } = action.payload;
|
|
2815
|
+
const values = state.searchMap[key];
|
|
2816
|
+
if (!values) return;
|
|
2817
|
+
if (item) {
|
|
2818
|
+
const filtered = values.filter((value) => value.name !== item.name);
|
|
2819
|
+
if (filtered.length > 0) {
|
|
2820
|
+
state.searchMap[key] = filtered;
|
|
2821
|
+
} else {
|
|
2822
|
+
delete state.searchMap[key];
|
|
2823
|
+
}
|
|
2824
|
+
} else {
|
|
2825
|
+
delete state.searchMap[key];
|
|
2826
|
+
}
|
|
2827
|
+
},
|
|
2828
|
+
clearSearchMap: (state) => {
|
|
2829
|
+
state.searchMap = {};
|
|
2830
|
+
}
|
|
2481
2831
|
}
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2832
|
+
});
|
|
2833
|
+
var {
|
|
2834
|
+
setGroupByDomain,
|
|
2835
|
+
setSelectedTags,
|
|
2836
|
+
setSearchString,
|
|
2837
|
+
setHoveredIndexSearchList,
|
|
2838
|
+
setFirstDomain,
|
|
2839
|
+
setSearchBy,
|
|
2840
|
+
setFilterBy,
|
|
2841
|
+
setSearchMap,
|
|
2842
|
+
updateSearchMap,
|
|
2843
|
+
removeKeyFromSearchMap,
|
|
2844
|
+
setGroupBy,
|
|
2845
|
+
clearSearchMap
|
|
2846
|
+
} = searchSlice.actions;
|
|
2847
|
+
var search_slice_default = searchSlice.reducer;
|
|
2485
2848
|
|
|
2486
|
-
// src/
|
|
2487
|
-
var
|
|
2849
|
+
// src/store/store.ts
|
|
2850
|
+
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
2488
2851
|
|
|
2489
|
-
//
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2852
|
+
// node_modules/redux/dist/redux.mjs
|
|
2853
|
+
function formatProdErrorMessage(code) {
|
|
2854
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2493
2855
|
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2856
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
2857
|
+
var ActionTypes = {
|
|
2858
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
2859
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
2860
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
2497
2861
|
};
|
|
2498
|
-
var
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
}
|
|
2506
|
-
const domain1 = domains[0] instanceof _Domain ? domains[0] : new _Domain(domains[0]);
|
|
2507
|
-
if (domains.length === 1) {
|
|
2508
|
-
return domain1;
|
|
2509
|
-
}
|
|
2510
|
-
const domain2 = _Domain.combine(domains.slice(1), operator);
|
|
2511
|
-
const result = new _Domain([]);
|
|
2512
|
-
const astValues1 = domain1.ast.value;
|
|
2513
|
-
const astValues2 = domain2.ast.value;
|
|
2514
|
-
const op = operator === "AND" ? "&" : "|";
|
|
2515
|
-
const combinedAST = {
|
|
2516
|
-
type: 4,
|
|
2517
|
-
value: astValues1.concat(astValues2)
|
|
2518
|
-
};
|
|
2519
|
-
result.ast = normalizeDomainAST(combinedAST, op);
|
|
2520
|
-
return result;
|
|
2521
|
-
}
|
|
2522
|
-
static and(domains) {
|
|
2523
|
-
return _Domain.combine(domains, "AND");
|
|
2524
|
-
}
|
|
2525
|
-
static or(domains) {
|
|
2526
|
-
return _Domain.combine(domains, "OR");
|
|
2527
|
-
}
|
|
2528
|
-
static not(domain) {
|
|
2529
|
-
const result = new _Domain(domain);
|
|
2530
|
-
result.ast.value.unshift({ type: 1, value: "!" });
|
|
2531
|
-
return result;
|
|
2862
|
+
var actionTypes_default = ActionTypes;
|
|
2863
|
+
function isPlainObject(obj) {
|
|
2864
|
+
if (typeof obj !== "object" || obj === null)
|
|
2865
|
+
return false;
|
|
2866
|
+
let proto = obj;
|
|
2867
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2868
|
+
proto = Object.getPrototypeOf(proto);
|
|
2532
2869
|
}
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
if (leaf.value === "|" && elements[idx + 1].type === 10 && elements[idx + 2].type === 10 && keysToRemove.includes(elements[idx + 1].value[0].value) && keysToRemove.includes(elements[idx + 2].value[0].value)) {
|
|
2549
|
-
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
2550
|
-
return 3;
|
|
2551
|
-
}
|
|
2552
|
-
newDomain2.ast.value.push(leaf);
|
|
2553
|
-
if (leaf.value === "!") {
|
|
2554
|
-
return 1 + processLeaf(elements, idx + 1, "&", newDomain2);
|
|
2555
|
-
}
|
|
2556
|
-
const firstLeafSkip = processLeaf(
|
|
2557
|
-
elements,
|
|
2558
|
-
idx + 1,
|
|
2559
|
-
leaf.value,
|
|
2560
|
-
newDomain2
|
|
2561
|
-
);
|
|
2562
|
-
const secondLeafSkip = processLeaf(
|
|
2563
|
-
elements,
|
|
2564
|
-
idx + 1 + firstLeafSkip,
|
|
2565
|
-
leaf.value,
|
|
2566
|
-
newDomain2
|
|
2567
|
-
);
|
|
2568
|
-
return 1 + firstLeafSkip + secondLeafSkip;
|
|
2569
|
-
}
|
|
2570
|
-
return 0;
|
|
2571
|
-
}
|
|
2572
|
-
const d = new _Domain(domain);
|
|
2573
|
-
if (d.ast.value.length === 0) {
|
|
2574
|
-
return d;
|
|
2870
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
2871
|
+
}
|
|
2872
|
+
function miniKindOf(val) {
|
|
2873
|
+
if (val === void 0)
|
|
2874
|
+
return "undefined";
|
|
2875
|
+
if (val === null)
|
|
2876
|
+
return "null";
|
|
2877
|
+
const type = typeof val;
|
|
2878
|
+
switch (type) {
|
|
2879
|
+
case "boolean":
|
|
2880
|
+
case "string":
|
|
2881
|
+
case "number":
|
|
2882
|
+
case "symbol":
|
|
2883
|
+
case "function": {
|
|
2884
|
+
return type;
|
|
2575
2885
|
}
|
|
2576
|
-
const newDomain = new _Domain([]);
|
|
2577
|
-
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
2578
|
-
return newDomain;
|
|
2579
2886
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
this.ast = normalizeDomainAST(rawAST);
|
|
2596
|
-
}
|
|
2887
|
+
if (Array.isArray(val))
|
|
2888
|
+
return "array";
|
|
2889
|
+
if (isDate(val))
|
|
2890
|
+
return "date";
|
|
2891
|
+
if (isError(val))
|
|
2892
|
+
return "error";
|
|
2893
|
+
const constructorName = ctorName(val);
|
|
2894
|
+
switch (constructorName) {
|
|
2895
|
+
case "Symbol":
|
|
2896
|
+
case "Promise":
|
|
2897
|
+
case "WeakMap":
|
|
2898
|
+
case "WeakSet":
|
|
2899
|
+
case "Map":
|
|
2900
|
+
case "Set":
|
|
2901
|
+
return constructorName;
|
|
2597
2902
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2903
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
2904
|
+
}
|
|
2905
|
+
function ctorName(val) {
|
|
2906
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
2907
|
+
}
|
|
2908
|
+
function isError(val) {
|
|
2909
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
2910
|
+
}
|
|
2911
|
+
function isDate(val) {
|
|
2912
|
+
if (val instanceof Date)
|
|
2913
|
+
return true;
|
|
2914
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
2915
|
+
}
|
|
2916
|
+
function kindOf(val) {
|
|
2917
|
+
let typeOfVal = typeof val;
|
|
2918
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2919
|
+
typeOfVal = miniKindOf(val);
|
|
2601
2920
|
}
|
|
2602
|
-
|
|
2603
|
-
|
|
2921
|
+
return typeOfVal;
|
|
2922
|
+
}
|
|
2923
|
+
function warning(message) {
|
|
2924
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
2925
|
+
console.error(message);
|
|
2604
2926
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2927
|
+
try {
|
|
2928
|
+
throw new Error(message);
|
|
2929
|
+
} catch (e) {
|
|
2607
2930
|
}
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
}
|
|
2615
|
-
return this.toString();
|
|
2616
|
-
} catch {
|
|
2617
|
-
return this.toString();
|
|
2618
|
-
}
|
|
2931
|
+
}
|
|
2932
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
2933
|
+
const reducerKeys = Object.keys(reducers);
|
|
2934
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
2935
|
+
if (reducerKeys.length === 0) {
|
|
2936
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
2619
2937
|
}
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2938
|
+
if (!isPlainObject(inputState)) {
|
|
2939
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
2940
|
+
}
|
|
2941
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
2942
|
+
unexpectedKeys.forEach((key) => {
|
|
2943
|
+
unexpectedKeyCache[key] = true;
|
|
2944
|
+
});
|
|
2945
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
2946
|
+
return;
|
|
2947
|
+
if (unexpectedKeys.length > 0) {
|
|
2948
|
+
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
function assertReducerShape(reducers) {
|
|
2952
|
+
Object.keys(reducers).forEach((key) => {
|
|
2953
|
+
const reducer = reducers[key];
|
|
2954
|
+
const initialState10 = reducer(void 0, {
|
|
2955
|
+
type: actionTypes_default.INIT
|
|
2956
|
+
});
|
|
2957
|
+
if (typeof initialState10 === "undefined") {
|
|
2958
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
2959
|
+
}
|
|
2960
|
+
if (typeof reducer(void 0, {
|
|
2961
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
2962
|
+
}) === "undefined") {
|
|
2963
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
2639
2964
|
}
|
|
2640
2965
|
});
|
|
2641
|
-
return { type: 4, value: elems };
|
|
2642
2966
|
}
|
|
2643
|
-
function
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2967
|
+
function combineReducers(reducers) {
|
|
2968
|
+
const reducerKeys = Object.keys(reducers);
|
|
2969
|
+
const finalReducers = {};
|
|
2970
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
2971
|
+
const key = reducerKeys[i];
|
|
2972
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2973
|
+
if (typeof reducers[key] === "undefined") {
|
|
2974
|
+
warning(`No reducer provided for key "${key}"`);
|
|
2649
2975
|
}
|
|
2650
|
-
} else {
|
|
2651
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2652
2976
|
}
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
return domain;
|
|
2656
|
-
}
|
|
2657
|
-
let expected = 1;
|
|
2658
|
-
for (const child of domain.value) {
|
|
2659
|
-
switch (child.type) {
|
|
2660
|
-
case 1:
|
|
2661
|
-
if (child.value === "&" || child.value === "|") {
|
|
2662
|
-
expected++;
|
|
2663
|
-
} else if (child.value !== "!") {
|
|
2664
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2665
|
-
}
|
|
2666
|
-
break;
|
|
2667
|
-
case 4:
|
|
2668
|
-
/* list */
|
|
2669
|
-
case 10:
|
|
2670
|
-
if (child.value.length === 3) {
|
|
2671
|
-
expected--;
|
|
2672
|
-
break;
|
|
2673
|
-
}
|
|
2674
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2675
|
-
default:
|
|
2676
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2977
|
+
if (typeof reducers[key] === "function") {
|
|
2978
|
+
finalReducers[key] = reducers[key];
|
|
2677
2979
|
}
|
|
2678
2980
|
}
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
}
|
|
2684
|
-
if (expected > 0) {
|
|
2685
|
-
throw new InvalidDomainError(
|
|
2686
|
-
`invalid domain ${formatAST(domain)} (missing ${expected} segment(s))`
|
|
2687
|
-
);
|
|
2981
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
2982
|
+
let unexpectedKeyCache;
|
|
2983
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2984
|
+
unexpectedKeyCache = {};
|
|
2688
2985
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2986
|
+
let shapeAssertionError;
|
|
2987
|
+
try {
|
|
2988
|
+
assertReducerShape(finalReducers);
|
|
2989
|
+
} catch (e) {
|
|
2990
|
+
shapeAssertionError = e;
|
|
2694
2991
|
}
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
if (names.length >= 2) {
|
|
2699
|
-
return matchCondition(record[names[0]], [
|
|
2700
|
-
names.slice(1).join("."),
|
|
2701
|
-
operator,
|
|
2702
|
-
value
|
|
2703
|
-
]);
|
|
2992
|
+
return function combination(state = {}, action) {
|
|
2993
|
+
if (shapeAssertionError) {
|
|
2994
|
+
throw shapeAssertionError;
|
|
2704
2995
|
}
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2710
|
-
"g"
|
|
2711
|
-
);
|
|
2712
|
-
ilikeRegexp = new RegExp(
|
|
2713
|
-
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2714
|
-
"gi"
|
|
2715
|
-
);
|
|
2716
|
-
}
|
|
2717
|
-
const fieldValue = typeof field === "number" ? field : record[field];
|
|
2718
|
-
switch (operator) {
|
|
2719
|
-
case "=?":
|
|
2720
|
-
if ([false, null].includes(value)) {
|
|
2721
|
-
return true;
|
|
2722
|
-
}
|
|
2723
|
-
// eslint-disable-next-line no-fallthrough
|
|
2724
|
-
case "=":
|
|
2725
|
-
case "==":
|
|
2726
|
-
if (Array.isArray(fieldValue) && Array.isArray(value)) {
|
|
2727
|
-
return shallowEqual2(fieldValue, value);
|
|
2996
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2997
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
2998
|
+
if (warningMessage) {
|
|
2999
|
+
warning(warningMessage);
|
|
2728
3000
|
}
|
|
2729
|
-
return fieldValue === value;
|
|
2730
|
-
case "!=":
|
|
2731
|
-
case "<>":
|
|
2732
|
-
return !matchCondition(record, [field, "==", value]);
|
|
2733
|
-
case "<":
|
|
2734
|
-
return fieldValue < value;
|
|
2735
|
-
case "<=":
|
|
2736
|
-
return fieldValue <= value;
|
|
2737
|
-
case ">":
|
|
2738
|
-
return fieldValue > value;
|
|
2739
|
-
case ">=":
|
|
2740
|
-
return fieldValue >= value;
|
|
2741
|
-
case "in": {
|
|
2742
|
-
const val = Array.isArray(value) ? value : [value];
|
|
2743
|
-
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2744
|
-
return fieldVal.some((fv) => val.includes(fv));
|
|
2745
3001
|
}
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
case "not like":
|
|
2757
|
-
if (fieldValue === false) {
|
|
2758
|
-
return false;
|
|
2759
|
-
}
|
|
2760
|
-
return Boolean(!fieldValue.match(likeRegexp));
|
|
2761
|
-
case "=like":
|
|
2762
|
-
if (fieldValue === false) {
|
|
2763
|
-
return false;
|
|
2764
|
-
}
|
|
2765
|
-
return new RegExp(escapeRegExp(value).replace(/%/g, ".*")).test(
|
|
2766
|
-
fieldValue
|
|
2767
|
-
);
|
|
2768
|
-
case "ilike":
|
|
2769
|
-
if (fieldValue === false) {
|
|
2770
|
-
return false;
|
|
2771
|
-
}
|
|
2772
|
-
return Boolean(fieldValue.match(ilikeRegexp));
|
|
2773
|
-
case "not ilike":
|
|
2774
|
-
if (fieldValue === false) {
|
|
2775
|
-
return false;
|
|
2776
|
-
}
|
|
2777
|
-
return Boolean(!fieldValue.match(ilikeRegexp));
|
|
2778
|
-
case "=ilike":
|
|
2779
|
-
if (fieldValue === false) {
|
|
2780
|
-
return false;
|
|
3002
|
+
let hasChanged = false;
|
|
3003
|
+
const nextState = {};
|
|
3004
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
3005
|
+
const key = finalReducerKeys[i];
|
|
3006
|
+
const reducer = finalReducers[key];
|
|
3007
|
+
const previousStateForKey = state[key];
|
|
3008
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
3009
|
+
if (typeof nextStateForKey === "undefined") {
|
|
3010
|
+
const actionType = action && action.type;
|
|
3011
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
2781
3012
|
}
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
}
|
|
2788
|
-
function makeOperators(record) {
|
|
2789
|
-
const match = matchCondition.bind(null, record);
|
|
2790
|
-
return {
|
|
2791
|
-
"!": (x) => !match(x),
|
|
2792
|
-
"&": (a, b) => match(a) && match(b),
|
|
2793
|
-
"|": (a, b) => match(a) || match(b)
|
|
3013
|
+
nextState[key] = nextStateForKey;
|
|
3014
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
3015
|
+
}
|
|
3016
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
3017
|
+
return hasChanged ? nextState : state;
|
|
2794
3018
|
};
|
|
2795
3019
|
}
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
3020
|
+
|
|
3021
|
+
// src/store/store.ts
|
|
3022
|
+
var rootReducer = combineReducers({
|
|
3023
|
+
env: env_slice_default,
|
|
3024
|
+
header: header_slice_default,
|
|
3025
|
+
navbar: navbar_slice_default,
|
|
3026
|
+
list: list_slice_default,
|
|
3027
|
+
search: search_slice_default,
|
|
3028
|
+
form: form_slice_default,
|
|
3029
|
+
breadcrumbs: breadcrums_slice_default,
|
|
3030
|
+
login: login_slice_default,
|
|
3031
|
+
excel: excel_slice_default,
|
|
3032
|
+
profile: profile_slice_default
|
|
3033
|
+
});
|
|
3034
|
+
var envStore = (0, import_toolkit11.configureStore)({
|
|
3035
|
+
reducer: rootReducer,
|
|
3036
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
3037
|
+
serializableCheck: false
|
|
3038
|
+
})
|
|
3039
|
+
});
|
|
3040
|
+
|
|
3041
|
+
// src/environment/EnvStore.ts
|
|
3042
|
+
var EnvStore = class _EnvStore {
|
|
3043
|
+
static instance = null;
|
|
3044
|
+
envStore;
|
|
3045
|
+
baseUrl;
|
|
3046
|
+
requests;
|
|
3047
|
+
context;
|
|
3048
|
+
defaultCompany;
|
|
3049
|
+
config;
|
|
3050
|
+
companies;
|
|
3051
|
+
user;
|
|
3052
|
+
db;
|
|
3053
|
+
localStorageUtils;
|
|
3054
|
+
sessionStorageUtils;
|
|
3055
|
+
refreshTokenEndpoint;
|
|
3056
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3057
|
+
this.envStore = envStore2;
|
|
3058
|
+
this.localStorageUtils = localStorageUtils2;
|
|
3059
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
3060
|
+
this.setup();
|
|
3061
|
+
}
|
|
3062
|
+
static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3063
|
+
if (!_EnvStore.instance) {
|
|
3064
|
+
console.log("Creating new EnvStore instance");
|
|
3065
|
+
_EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
|
|
2808
3066
|
} else {
|
|
2809
|
-
|
|
3067
|
+
console.log("Returning existing EnvStore instance");
|
|
2810
3068
|
}
|
|
3069
|
+
return _EnvStore.instance;
|
|
3070
|
+
}
|
|
3071
|
+
setup() {
|
|
3072
|
+
const env = this.envStore.getState().env;
|
|
3073
|
+
console.log("Redux env state in A1:", env);
|
|
3074
|
+
this.baseUrl = env?.baseUrl;
|
|
3075
|
+
this.requests = env?.requests;
|
|
3076
|
+
this.context = env?.context;
|
|
3077
|
+
this.defaultCompany = env?.defaultCompany;
|
|
3078
|
+
this.config = env?.config;
|
|
3079
|
+
this.companies = env?.companies || [];
|
|
3080
|
+
this.user = env?.user;
|
|
3081
|
+
this.db = env?.db;
|
|
3082
|
+
this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
|
|
3083
|
+
console.log("Env setup in A1:", this);
|
|
3084
|
+
}
|
|
3085
|
+
setupEnv(envConfig) {
|
|
3086
|
+
const dispatch = this.envStore.dispatch;
|
|
3087
|
+
const env = {
|
|
3088
|
+
...envConfig,
|
|
3089
|
+
localStorageUtils: this.localStorageUtils,
|
|
3090
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3091
|
+
};
|
|
3092
|
+
console.log("Setting up env with config:", envConfig);
|
|
3093
|
+
const requests = axiosClient.init(env);
|
|
3094
|
+
console.log("axiosClient.init result:", requests);
|
|
3095
|
+
dispatch(setEnv({ ...env, requests }));
|
|
3096
|
+
this.setup();
|
|
3097
|
+
}
|
|
3098
|
+
setUid(uid) {
|
|
3099
|
+
const dispatch = this.envStore.dispatch;
|
|
3100
|
+
dispatch(setUid(uid));
|
|
3101
|
+
this.setup();
|
|
3102
|
+
}
|
|
3103
|
+
setLang(lang) {
|
|
3104
|
+
const dispatch = this.envStore.dispatch;
|
|
3105
|
+
dispatch(setLang(lang));
|
|
3106
|
+
this.setup();
|
|
3107
|
+
}
|
|
3108
|
+
setAllowCompanies(allowCompanies) {
|
|
3109
|
+
const dispatch = this.envStore.dispatch;
|
|
3110
|
+
dispatch(setAllowCompanies(allowCompanies));
|
|
3111
|
+
this.setup();
|
|
3112
|
+
}
|
|
3113
|
+
setCompanies(companies) {
|
|
3114
|
+
const dispatch = this.envStore.dispatch;
|
|
3115
|
+
dispatch(setCompanies(companies));
|
|
3116
|
+
this.setup();
|
|
3117
|
+
}
|
|
3118
|
+
setDefaultCompany(company) {
|
|
3119
|
+
const dispatch = this.envStore.dispatch;
|
|
3120
|
+
dispatch(setDefaultCompany(company));
|
|
3121
|
+
this.setup();
|
|
3122
|
+
}
|
|
3123
|
+
setUserInfo(userInfo) {
|
|
3124
|
+
const dispatch = this.envStore.dispatch;
|
|
3125
|
+
dispatch(setUser(userInfo));
|
|
3126
|
+
this.setup();
|
|
2811
3127
|
}
|
|
2812
|
-
return matchCondition(record, condStack.pop());
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
|
-
// src/utils/function.ts
|
|
2816
|
-
var import_react = require("react");
|
|
2817
|
-
var toQueryString = (params) => {
|
|
2818
|
-
return Object.keys(params).map(
|
|
2819
|
-
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
|
2820
|
-
).join("&");
|
|
2821
3128
|
};
|
|
2822
|
-
|
|
2823
|
-
// src/environment/EnvStore.ts
|
|
2824
3129
|
function getEnv() {
|
|
2825
|
-
|
|
2826
|
-
|
|
3130
|
+
const instance = EnvStore.getInstance(envStore);
|
|
3131
|
+
if (!instance) {
|
|
3132
|
+
throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
|
|
3133
|
+
}
|
|
3134
|
+
return instance;
|
|
2827
3135
|
}
|
|
2828
3136
|
|
|
2829
3137
|
// src/services/action-service/index.ts
|
|
@@ -2991,7 +3299,7 @@ var AuthService = {
|
|
|
2991
3299
|
}).filter(([_, value]) => !!value)
|
|
2992
3300
|
);
|
|
2993
3301
|
const encodedData = new URLSearchParams(payload).toString();
|
|
2994
|
-
return env?.requests?.post(body
|
|
3302
|
+
return env?.requests?.post(body.path, encodedData, {
|
|
2995
3303
|
headers: {
|
|
2996
3304
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
2997
3305
|
}
|
|
@@ -3088,20 +3396,6 @@ var AuthService = {
|
|
|
3088
3396
|
}
|
|
3089
3397
|
});
|
|
3090
3398
|
},
|
|
3091
|
-
async isValidActionToken(actionToken, path) {
|
|
3092
|
-
const env = getEnv();
|
|
3093
|
-
return env?.requests?.post(
|
|
3094
|
-
path,
|
|
3095
|
-
{},
|
|
3096
|
-
{
|
|
3097
|
-
headers: {
|
|
3098
|
-
"Content-Type": "application/json"
|
|
3099
|
-
},
|
|
3100
|
-
useActionToken: true,
|
|
3101
|
-
actionToken
|
|
3102
|
-
}
|
|
3103
|
-
);
|
|
3104
|
-
},
|
|
3105
3399
|
async loginSocial({
|
|
3106
3400
|
db,
|
|
3107
3401
|
state,
|
|
@@ -3866,7 +4160,7 @@ var model_service_default = ModelService;
|
|
|
3866
4160
|
var UserService = {
|
|
3867
4161
|
async getProfile(path) {
|
|
3868
4162
|
const env = getEnv();
|
|
3869
|
-
return env
|
|
4163
|
+
return env.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
3870
4164
|
headers: {
|
|
3871
4165
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
3872
4166
|
}
|
|
@@ -4185,7 +4479,8 @@ var ViewService = {
|
|
|
4185
4479
|
},
|
|
4186
4480
|
async getVersion() {
|
|
4187
4481
|
const env = getEnv();
|
|
4188
|
-
|
|
4482
|
+
console.log("env?.requests", env, env?.requests);
|
|
4483
|
+
return env?.requests?.get("", {
|
|
4189
4484
|
headers: {
|
|
4190
4485
|
"Content-Type": "application/json"
|
|
4191
4486
|
}
|