@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/hooks.js
CHANGED
|
@@ -96,7 +96,6 @@ __export(hooks_exports, {
|
|
|
96
96
|
useUploadFile: () => use_upload_file_default,
|
|
97
97
|
useUploadIdFile: () => use_upload_id_file_default,
|
|
98
98
|
useUploadImage: () => use_upload_image_default,
|
|
99
|
-
useValidateActionToken: () => use_validate_action_token_default,
|
|
100
99
|
useVerify2FA: () => use_verify_2FA_default,
|
|
101
100
|
useVerifyTotp: () => use_verify_totp_default
|
|
102
101
|
});
|
|
@@ -135,675 +134,47 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
135
134
|
return UriConstants2;
|
|
136
135
|
})(UriConstants || {});
|
|
137
136
|
|
|
138
|
-
// src/
|
|
139
|
-
var
|
|
137
|
+
// src/configs/axios-client.ts
|
|
138
|
+
var import_axios = __toESM(require("axios"));
|
|
140
139
|
|
|
141
|
-
// src/
|
|
142
|
-
var
|
|
143
|
-
var initialState = {
|
|
144
|
-
breadCrumbs: []
|
|
145
|
-
};
|
|
146
|
-
var breadcrumbsSlice = (0, import_toolkit.createSlice)({
|
|
147
|
-
name: "breadcrumbs",
|
|
148
|
-
initialState,
|
|
149
|
-
reducers: {
|
|
150
|
-
setBreadCrumbs: (state, action) => {
|
|
151
|
-
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
156
|
-
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
140
|
+
// src/utils/format.ts
|
|
141
|
+
var import_moment = __toESM(require("moment"));
|
|
157
142
|
|
|
158
|
-
// src/
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
db: "",
|
|
165
|
-
refreshTokenEndpoint: "",
|
|
166
|
-
config: {
|
|
167
|
-
grantType: "",
|
|
168
|
-
clientId: "",
|
|
169
|
-
clientSecret: "",
|
|
170
|
-
redirectUri: ""
|
|
171
|
-
},
|
|
172
|
-
envFile: null,
|
|
173
|
-
requests: {
|
|
174
|
-
get: async (url, headers) => ({}),
|
|
175
|
-
post: async (url, body, headers) => ({}),
|
|
176
|
-
post_excel: async (url, body, headers) => ({}),
|
|
177
|
-
put: async (url, body, headers) => ({}),
|
|
178
|
-
patch: async (url, body) => ({}),
|
|
179
|
-
delete: async (url, body) => ({})
|
|
180
|
-
},
|
|
181
|
-
defaultCompany: {
|
|
182
|
-
id: null,
|
|
183
|
-
logo: "",
|
|
184
|
-
secondary_color: "",
|
|
185
|
-
primary_color: ""
|
|
186
|
-
},
|
|
187
|
-
context: {
|
|
188
|
-
uid: null,
|
|
189
|
-
allowed_company_ids: [],
|
|
190
|
-
lang: "vi_VN",
|
|
191
|
-
tz: "Asia/Saigon"
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
var envSlice = (0, import_toolkit2.createSlice)({
|
|
195
|
-
name: "env",
|
|
196
|
-
initialState: initialState2,
|
|
197
|
-
reducers: {
|
|
198
|
-
setEnv: (state, action) => {
|
|
199
|
-
Object.assign(state, action.payload);
|
|
200
|
-
},
|
|
201
|
-
setUid: (state, action) => {
|
|
202
|
-
state.context.uid = action.payload;
|
|
203
|
-
},
|
|
204
|
-
setAllowCompanies: (state, action) => {
|
|
205
|
-
state.context.allowed_company_ids = action.payload;
|
|
206
|
-
},
|
|
207
|
-
setCompanies: (state, action) => {
|
|
208
|
-
state.companies = action.payload;
|
|
209
|
-
},
|
|
210
|
-
setDefaultCompany: (state, action) => {
|
|
211
|
-
state.defaultCompany = action.payload;
|
|
212
|
-
},
|
|
213
|
-
setLang: (state, action) => {
|
|
214
|
-
state.context.lang = action.payload;
|
|
215
|
-
},
|
|
216
|
-
setUser: (state, action) => {
|
|
217
|
-
state.user = action.payload;
|
|
218
|
-
},
|
|
219
|
-
setConfig: (state, action) => {
|
|
220
|
-
state.config = action.payload;
|
|
221
|
-
},
|
|
222
|
-
setEnvFile: (state, action) => {
|
|
223
|
-
state.envFile = action.payload;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
var {
|
|
228
|
-
setEnv,
|
|
229
|
-
setUid,
|
|
230
|
-
setLang,
|
|
231
|
-
setAllowCompanies,
|
|
232
|
-
setCompanies,
|
|
233
|
-
setDefaultCompany,
|
|
234
|
-
setUser,
|
|
235
|
-
setConfig,
|
|
236
|
-
setEnvFile
|
|
237
|
-
} = envSlice.actions;
|
|
238
|
-
var env_slice_default = envSlice.reducer;
|
|
143
|
+
// src/constants/widget/widget-avatar-constant.ts
|
|
144
|
+
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
145
|
+
WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
146
|
+
WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
|
|
147
|
+
return WIDGETAVATAR2;
|
|
148
|
+
})(WIDGETAVATAR || {});
|
|
239
149
|
|
|
240
|
-
// src/
|
|
241
|
-
var
|
|
242
|
-
var initialState3 = {
|
|
243
|
-
dataParse: null,
|
|
244
|
-
idFile: null,
|
|
245
|
-
isFileLoaded: false,
|
|
246
|
-
loadingImport: false,
|
|
247
|
-
selectedFile: null,
|
|
248
|
-
errorData: null
|
|
150
|
+
// src/utils/domain/py_tokenizer.ts
|
|
151
|
+
var TokenizerError = class extends Error {
|
|
249
152
|
};
|
|
250
|
-
var
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
state.isFileLoaded = action.payload;
|
|
262
|
-
},
|
|
263
|
-
setLoadingImport: (state, action) => {
|
|
264
|
-
state.loadingImport = action.payload;
|
|
265
|
-
},
|
|
266
|
-
setSelectedFile: (state, action) => {
|
|
267
|
-
state.selectedFile = action.payload;
|
|
268
|
-
},
|
|
269
|
-
setErrorData: (state, action) => {
|
|
270
|
-
state.errorData = action.payload;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
var {
|
|
275
|
-
setDataParse,
|
|
276
|
-
setIdFile,
|
|
277
|
-
setIsFileLoaded,
|
|
278
|
-
setLoadingImport,
|
|
279
|
-
setSelectedFile,
|
|
280
|
-
setErrorData
|
|
281
|
-
} = excelSlice.actions;
|
|
282
|
-
var excel_slice_default = excelSlice.reducer;
|
|
283
|
-
|
|
284
|
-
// src/store/reducers/form-slice/index.ts
|
|
285
|
-
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
286
|
-
var initialState4 = {
|
|
287
|
-
viewDataStore: {},
|
|
288
|
-
isShowingModalDetail: false,
|
|
289
|
-
isShowModalTranslate: false,
|
|
290
|
-
formSubmitComponent: {},
|
|
291
|
-
fieldTranslation: null,
|
|
292
|
-
listSubject: {},
|
|
293
|
-
dataUser: {}
|
|
153
|
+
var directMap = {
|
|
154
|
+
"\\": "\\",
|
|
155
|
+
'"': '"',
|
|
156
|
+
"'": "'",
|
|
157
|
+
a: "\x07",
|
|
158
|
+
b: "\b",
|
|
159
|
+
f: "\f",
|
|
160
|
+
n: "\n",
|
|
161
|
+
r: "\r",
|
|
162
|
+
t: " ",
|
|
163
|
+
v: "\v"
|
|
294
164
|
};
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
setIsShowingModalDetail: (state, action) => {
|
|
303
|
-
state.isShowingModalDetail = action.payload;
|
|
304
|
-
},
|
|
305
|
-
setIsShowModalTranslate: (state, action) => {
|
|
306
|
-
state.isShowModalTranslate = action.payload;
|
|
307
|
-
},
|
|
308
|
-
setFormSubmitComponent: (state, action) => {
|
|
309
|
-
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
310
|
-
},
|
|
311
|
-
setFieldTranslate: (state, action) => {
|
|
312
|
-
state.fieldTranslation = action.payload;
|
|
313
|
-
},
|
|
314
|
-
setListSubject: (state, action) => {
|
|
315
|
-
state.listSubject = action.payload;
|
|
316
|
-
},
|
|
317
|
-
setDataUser: (state, action) => {
|
|
318
|
-
state.dataUser = action.payload;
|
|
165
|
+
function decodeStringLiteral(str, unicode) {
|
|
166
|
+
const out = [];
|
|
167
|
+
let code;
|
|
168
|
+
for (let i = 0; i < str.length; ++i) {
|
|
169
|
+
if (str[i] !== "\\") {
|
|
170
|
+
out.push(str[i]);
|
|
171
|
+
continue;
|
|
319
172
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
setIsShowModalTranslate,
|
|
326
|
-
setFormSubmitComponent,
|
|
327
|
-
setFieldTranslate,
|
|
328
|
-
setListSubject,
|
|
329
|
-
setDataUser
|
|
330
|
-
} = formSlice.actions;
|
|
331
|
-
var form_slice_default = formSlice.reducer;
|
|
332
|
-
|
|
333
|
-
// src/store/reducers/header-slice/index.ts
|
|
334
|
-
var import_toolkit5 = require("@reduxjs/toolkit");
|
|
335
|
-
var headerSlice = (0, import_toolkit5.createSlice)({
|
|
336
|
-
name: "header",
|
|
337
|
-
initialState: {
|
|
338
|
-
value: { allowedCompanyIds: [] }
|
|
339
|
-
},
|
|
340
|
-
reducers: {
|
|
341
|
-
setHeader: (state, action) => {
|
|
342
|
-
state.value = { ...state.value, ...action.payload };
|
|
343
|
-
},
|
|
344
|
-
setAllowedCompanyIds: (state, action) => {
|
|
345
|
-
state.value.allowedCompanyIds = action.payload;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
350
|
-
var header_slice_default = headerSlice.reducer;
|
|
351
|
-
|
|
352
|
-
// src/store/reducers/list-slice/index.ts
|
|
353
|
-
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
354
|
-
var initialState5 = {
|
|
355
|
-
pageLimit: 10,
|
|
356
|
-
fields: {},
|
|
357
|
-
order: "",
|
|
358
|
-
selectedRowKeys: [],
|
|
359
|
-
selectedRadioKey: 0,
|
|
360
|
-
indexRowTableModal: -2,
|
|
361
|
-
isUpdateTableModal: false,
|
|
362
|
-
footerGroupTable: {},
|
|
363
|
-
transferDetail: null,
|
|
364
|
-
page: 0,
|
|
365
|
-
domainTable: []
|
|
366
|
-
};
|
|
367
|
-
var listSlice = (0, import_toolkit6.createSlice)({
|
|
368
|
-
name: "list",
|
|
369
|
-
initialState: initialState5,
|
|
370
|
-
reducers: {
|
|
371
|
-
setPageLimit: (state, action) => {
|
|
372
|
-
state.pageLimit = action.payload;
|
|
373
|
-
},
|
|
374
|
-
setFields: (state, action) => {
|
|
375
|
-
state.fields = action.payload;
|
|
376
|
-
},
|
|
377
|
-
setOrder: (state, action) => {
|
|
378
|
-
state.order = action.payload;
|
|
379
|
-
},
|
|
380
|
-
setSelectedRowKeys: (state, action) => {
|
|
381
|
-
state.selectedRowKeys = action.payload;
|
|
382
|
-
},
|
|
383
|
-
setSelectedRadioKey: (state, action) => {
|
|
384
|
-
state.selectedRadioKey = action.payload;
|
|
385
|
-
},
|
|
386
|
-
setIndexRowTableModal: (state, action) => {
|
|
387
|
-
state.indexRowTableModal = action.payload;
|
|
388
|
-
},
|
|
389
|
-
setTransferDetail: (state, action) => {
|
|
390
|
-
state.transferDetail = action.payload;
|
|
391
|
-
},
|
|
392
|
-
setIsUpdateTableModal: (state, action) => {
|
|
393
|
-
state.isUpdateTableModal = action.payload;
|
|
394
|
-
},
|
|
395
|
-
setPage: (state, action) => {
|
|
396
|
-
state.page = action.payload;
|
|
397
|
-
},
|
|
398
|
-
setDomainTable: (state, action) => {
|
|
399
|
-
state.domainTable = action.payload;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
var {
|
|
404
|
-
setPageLimit,
|
|
405
|
-
setFields,
|
|
406
|
-
setOrder,
|
|
407
|
-
setSelectedRowKeys,
|
|
408
|
-
setIndexRowTableModal,
|
|
409
|
-
setIsUpdateTableModal,
|
|
410
|
-
setPage,
|
|
411
|
-
setSelectedRadioKey,
|
|
412
|
-
setTransferDetail,
|
|
413
|
-
setDomainTable
|
|
414
|
-
} = listSlice.actions;
|
|
415
|
-
var list_slice_default = listSlice.reducer;
|
|
416
|
-
|
|
417
|
-
// src/store/reducers/login-slice/index.ts
|
|
418
|
-
var import_toolkit7 = require("@reduxjs/toolkit");
|
|
419
|
-
var initialState6 = {
|
|
420
|
-
db: "",
|
|
421
|
-
redirectTo: "/",
|
|
422
|
-
forgotPasswordUrl: "/"
|
|
423
|
-
};
|
|
424
|
-
var loginSlice = (0, import_toolkit7.createSlice)({
|
|
425
|
-
name: "login",
|
|
426
|
-
initialState: initialState6,
|
|
427
|
-
reducers: {
|
|
428
|
-
setDb: (state, action) => {
|
|
429
|
-
state.db = action.payload;
|
|
430
|
-
},
|
|
431
|
-
setRedirectTo: (state, action) => {
|
|
432
|
-
state.redirectTo = action.payload;
|
|
433
|
-
},
|
|
434
|
-
setForgotPasswordUrl: (state, action) => {
|
|
435
|
-
state.forgotPasswordUrl = action.payload;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
440
|
-
var login_slice_default = loginSlice.reducer;
|
|
441
|
-
|
|
442
|
-
// src/store/reducers/navbar-slice/index.ts
|
|
443
|
-
var import_toolkit8 = require("@reduxjs/toolkit");
|
|
444
|
-
var initialState7 = {
|
|
445
|
-
menuFocus: {},
|
|
446
|
-
menuAction: {},
|
|
447
|
-
navbarWidth: 250,
|
|
448
|
-
menuList: []
|
|
449
|
-
};
|
|
450
|
-
var navbarSlice = (0, import_toolkit8.createSlice)({
|
|
451
|
-
name: "navbar",
|
|
452
|
-
initialState: initialState7,
|
|
453
|
-
reducers: {
|
|
454
|
-
setMenuFocus: (state, action) => {
|
|
455
|
-
state.menuFocus = action.payload;
|
|
456
|
-
},
|
|
457
|
-
setMenuFocusAction: (state, action) => {
|
|
458
|
-
state.menuAction = action.payload;
|
|
459
|
-
},
|
|
460
|
-
setNavbarWidth: (state, action) => {
|
|
461
|
-
state.navbarWidth = action.payload;
|
|
462
|
-
},
|
|
463
|
-
setMenuList: (state, action) => {
|
|
464
|
-
state.menuList = action.payload;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
469
|
-
var navbar_slice_default = navbarSlice.reducer;
|
|
470
|
-
|
|
471
|
-
// src/store/reducers/profile-slice/index.ts
|
|
472
|
-
var import_toolkit9 = require("@reduxjs/toolkit");
|
|
473
|
-
var initialState8 = {
|
|
474
|
-
profile: {}
|
|
475
|
-
};
|
|
476
|
-
var profileSlice = (0, import_toolkit9.createSlice)({
|
|
477
|
-
name: "profile",
|
|
478
|
-
initialState: initialState8,
|
|
479
|
-
reducers: {
|
|
480
|
-
setProfile: (state, action) => {
|
|
481
|
-
state.profile = action.payload;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
var { setProfile } = profileSlice.actions;
|
|
486
|
-
var profile_slice_default = profileSlice.reducer;
|
|
487
|
-
|
|
488
|
-
// src/store/reducers/search-slice/index.ts
|
|
489
|
-
var import_toolkit10 = require("@reduxjs/toolkit");
|
|
490
|
-
var initialState9 = {
|
|
491
|
-
groupByDomain: null,
|
|
492
|
-
searchBy: [],
|
|
493
|
-
searchString: "",
|
|
494
|
-
hoveredIndexSearchList: null,
|
|
495
|
-
selectedTags: [],
|
|
496
|
-
firstDomain: null,
|
|
497
|
-
searchMap: {},
|
|
498
|
-
filterBy: [],
|
|
499
|
-
groupBy: []
|
|
500
|
-
};
|
|
501
|
-
var searchSlice = (0, import_toolkit10.createSlice)({
|
|
502
|
-
name: "search",
|
|
503
|
-
initialState: initialState9,
|
|
504
|
-
reducers: {
|
|
505
|
-
setGroupByDomain: (state, action) => {
|
|
506
|
-
state.groupByDomain = action.payload;
|
|
507
|
-
},
|
|
508
|
-
setSearchBy: (state, action) => {
|
|
509
|
-
state.searchBy = action.payload;
|
|
510
|
-
},
|
|
511
|
-
setSearchString: (state, action) => {
|
|
512
|
-
state.searchString = action.payload;
|
|
513
|
-
},
|
|
514
|
-
setHoveredIndexSearchList: (state, action) => {
|
|
515
|
-
state.hoveredIndexSearchList = action.payload;
|
|
516
|
-
},
|
|
517
|
-
setSelectedTags: (state, action) => {
|
|
518
|
-
state.selectedTags = action.payload;
|
|
519
|
-
},
|
|
520
|
-
setFirstDomain: (state, action) => {
|
|
521
|
-
state.firstDomain = action.payload;
|
|
522
|
-
},
|
|
523
|
-
setFilterBy: (state, action) => {
|
|
524
|
-
state.filterBy = action.payload;
|
|
525
|
-
},
|
|
526
|
-
setGroupBy: (state, action) => {
|
|
527
|
-
state.groupBy = action.payload;
|
|
528
|
-
},
|
|
529
|
-
setSearchMap: (state, action) => {
|
|
530
|
-
state.searchMap = action.payload;
|
|
531
|
-
},
|
|
532
|
-
updateSearchMap: (state, action) => {
|
|
533
|
-
if (!state.searchMap[action.payload.key]) {
|
|
534
|
-
state.searchMap[action.payload.key] = [];
|
|
535
|
-
}
|
|
536
|
-
state.searchMap[action.payload.key].push(action.payload.value);
|
|
537
|
-
},
|
|
538
|
-
removeKeyFromSearchMap: (state, action) => {
|
|
539
|
-
const { key, item } = action.payload;
|
|
540
|
-
const values = state.searchMap[key];
|
|
541
|
-
if (!values) return;
|
|
542
|
-
if (item) {
|
|
543
|
-
const filtered = values.filter((value) => value.name !== item.name);
|
|
544
|
-
if (filtered.length > 0) {
|
|
545
|
-
state.searchMap[key] = filtered;
|
|
546
|
-
} else {
|
|
547
|
-
delete state.searchMap[key];
|
|
548
|
-
}
|
|
549
|
-
} else {
|
|
550
|
-
delete state.searchMap[key];
|
|
551
|
-
}
|
|
552
|
-
},
|
|
553
|
-
clearSearchMap: (state) => {
|
|
554
|
-
state.searchMap = {};
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
var {
|
|
559
|
-
setGroupByDomain,
|
|
560
|
-
setSelectedTags,
|
|
561
|
-
setSearchString,
|
|
562
|
-
setHoveredIndexSearchList,
|
|
563
|
-
setFirstDomain,
|
|
564
|
-
setSearchBy,
|
|
565
|
-
setFilterBy,
|
|
566
|
-
setSearchMap,
|
|
567
|
-
updateSearchMap,
|
|
568
|
-
removeKeyFromSearchMap,
|
|
569
|
-
setGroupBy,
|
|
570
|
-
clearSearchMap
|
|
571
|
-
} = searchSlice.actions;
|
|
572
|
-
var search_slice_default = searchSlice.reducer;
|
|
573
|
-
|
|
574
|
-
// src/store/store.ts
|
|
575
|
-
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
576
|
-
|
|
577
|
-
// node_modules/redux/dist/redux.mjs
|
|
578
|
-
function formatProdErrorMessage(code) {
|
|
579
|
-
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. `;
|
|
580
|
-
}
|
|
581
|
-
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
582
|
-
var ActionTypes = {
|
|
583
|
-
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
584
|
-
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
585
|
-
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
586
|
-
};
|
|
587
|
-
var actionTypes_default = ActionTypes;
|
|
588
|
-
function isPlainObject(obj) {
|
|
589
|
-
if (typeof obj !== "object" || obj === null)
|
|
590
|
-
return false;
|
|
591
|
-
let proto = obj;
|
|
592
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
593
|
-
proto = Object.getPrototypeOf(proto);
|
|
594
|
-
}
|
|
595
|
-
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
596
|
-
}
|
|
597
|
-
function miniKindOf(val) {
|
|
598
|
-
if (val === void 0)
|
|
599
|
-
return "undefined";
|
|
600
|
-
if (val === null)
|
|
601
|
-
return "null";
|
|
602
|
-
const type = typeof val;
|
|
603
|
-
switch (type) {
|
|
604
|
-
case "boolean":
|
|
605
|
-
case "string":
|
|
606
|
-
case "number":
|
|
607
|
-
case "symbol":
|
|
608
|
-
case "function": {
|
|
609
|
-
return type;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
if (Array.isArray(val))
|
|
613
|
-
return "array";
|
|
614
|
-
if (isDate(val))
|
|
615
|
-
return "date";
|
|
616
|
-
if (isError(val))
|
|
617
|
-
return "error";
|
|
618
|
-
const constructorName = ctorName(val);
|
|
619
|
-
switch (constructorName) {
|
|
620
|
-
case "Symbol":
|
|
621
|
-
case "Promise":
|
|
622
|
-
case "WeakMap":
|
|
623
|
-
case "WeakSet":
|
|
624
|
-
case "Map":
|
|
625
|
-
case "Set":
|
|
626
|
-
return constructorName;
|
|
627
|
-
}
|
|
628
|
-
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
629
|
-
}
|
|
630
|
-
function ctorName(val) {
|
|
631
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
632
|
-
}
|
|
633
|
-
function isError(val) {
|
|
634
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
635
|
-
}
|
|
636
|
-
function isDate(val) {
|
|
637
|
-
if (val instanceof Date)
|
|
638
|
-
return true;
|
|
639
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
640
|
-
}
|
|
641
|
-
function kindOf(val) {
|
|
642
|
-
let typeOfVal = typeof val;
|
|
643
|
-
if (process.env.NODE_ENV !== "production") {
|
|
644
|
-
typeOfVal = miniKindOf(val);
|
|
645
|
-
}
|
|
646
|
-
return typeOfVal;
|
|
647
|
-
}
|
|
648
|
-
function warning(message) {
|
|
649
|
-
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
650
|
-
console.error(message);
|
|
651
|
-
}
|
|
652
|
-
try {
|
|
653
|
-
throw new Error(message);
|
|
654
|
-
} catch (e) {
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
658
|
-
const reducerKeys = Object.keys(reducers);
|
|
659
|
-
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
660
|
-
if (reducerKeys.length === 0) {
|
|
661
|
-
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
662
|
-
}
|
|
663
|
-
if (!isPlainObject(inputState)) {
|
|
664
|
-
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
665
|
-
}
|
|
666
|
-
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
667
|
-
unexpectedKeys.forEach((key) => {
|
|
668
|
-
unexpectedKeyCache[key] = true;
|
|
669
|
-
});
|
|
670
|
-
if (action && action.type === actionTypes_default.REPLACE)
|
|
671
|
-
return;
|
|
672
|
-
if (unexpectedKeys.length > 0) {
|
|
673
|
-
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.`;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
function assertReducerShape(reducers) {
|
|
677
|
-
Object.keys(reducers).forEach((key) => {
|
|
678
|
-
const reducer = reducers[key];
|
|
679
|
-
const initialState10 = reducer(void 0, {
|
|
680
|
-
type: actionTypes_default.INIT
|
|
681
|
-
});
|
|
682
|
-
if (typeof initialState10 === "undefined") {
|
|
683
|
-
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.`);
|
|
684
|
-
}
|
|
685
|
-
if (typeof reducer(void 0, {
|
|
686
|
-
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
687
|
-
}) === "undefined") {
|
|
688
|
-
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.`);
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
function combineReducers(reducers) {
|
|
693
|
-
const reducerKeys = Object.keys(reducers);
|
|
694
|
-
const finalReducers = {};
|
|
695
|
-
for (let i = 0; i < reducerKeys.length; i++) {
|
|
696
|
-
const key = reducerKeys[i];
|
|
697
|
-
if (process.env.NODE_ENV !== "production") {
|
|
698
|
-
if (typeof reducers[key] === "undefined") {
|
|
699
|
-
warning(`No reducer provided for key "${key}"`);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (typeof reducers[key] === "function") {
|
|
703
|
-
finalReducers[key] = reducers[key];
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
const finalReducerKeys = Object.keys(finalReducers);
|
|
707
|
-
let unexpectedKeyCache;
|
|
708
|
-
if (process.env.NODE_ENV !== "production") {
|
|
709
|
-
unexpectedKeyCache = {};
|
|
710
|
-
}
|
|
711
|
-
let shapeAssertionError;
|
|
712
|
-
try {
|
|
713
|
-
assertReducerShape(finalReducers);
|
|
714
|
-
} catch (e) {
|
|
715
|
-
shapeAssertionError = e;
|
|
716
|
-
}
|
|
717
|
-
return function combination(state = {}, action) {
|
|
718
|
-
if (shapeAssertionError) {
|
|
719
|
-
throw shapeAssertionError;
|
|
720
|
-
}
|
|
721
|
-
if (process.env.NODE_ENV !== "production") {
|
|
722
|
-
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
723
|
-
if (warningMessage) {
|
|
724
|
-
warning(warningMessage);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
let hasChanged = false;
|
|
728
|
-
const nextState = {};
|
|
729
|
-
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
730
|
-
const key = finalReducerKeys[i];
|
|
731
|
-
const reducer = finalReducers[key];
|
|
732
|
-
const previousStateForKey = state[key];
|
|
733
|
-
const nextStateForKey = reducer(previousStateForKey, action);
|
|
734
|
-
if (typeof nextStateForKey === "undefined") {
|
|
735
|
-
const actionType = action && action.type;
|
|
736
|
-
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.`);
|
|
737
|
-
}
|
|
738
|
-
nextState[key] = nextStateForKey;
|
|
739
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
740
|
-
}
|
|
741
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
742
|
-
return hasChanged ? nextState : state;
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// src/store/store.ts
|
|
747
|
-
var rootReducer = combineReducers({
|
|
748
|
-
env: env_slice_default,
|
|
749
|
-
header: header_slice_default,
|
|
750
|
-
navbar: navbar_slice_default,
|
|
751
|
-
list: list_slice_default,
|
|
752
|
-
search: search_slice_default,
|
|
753
|
-
form: form_slice_default,
|
|
754
|
-
breadcrumbs: breadcrums_slice_default,
|
|
755
|
-
login: login_slice_default,
|
|
756
|
-
excel: excel_slice_default,
|
|
757
|
-
profile: profile_slice_default
|
|
758
|
-
});
|
|
759
|
-
var envStore = (0, import_toolkit11.configureStore)({
|
|
760
|
-
reducer: rootReducer,
|
|
761
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
762
|
-
serializableCheck: false
|
|
763
|
-
})
|
|
764
|
-
});
|
|
765
|
-
|
|
766
|
-
// src/configs/axios-client.ts
|
|
767
|
-
var import_axios = __toESM(require("axios"));
|
|
768
|
-
|
|
769
|
-
// src/utils/format.ts
|
|
770
|
-
var import_moment = __toESM(require("moment"));
|
|
771
|
-
|
|
772
|
-
// src/constants/widget/widget-avatar-constant.ts
|
|
773
|
-
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
774
|
-
WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
775
|
-
WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
|
|
776
|
-
return WIDGETAVATAR2;
|
|
777
|
-
})(WIDGETAVATAR || {});
|
|
778
|
-
|
|
779
|
-
// src/utils/domain/py_tokenizer.ts
|
|
780
|
-
var TokenizerError = class extends Error {
|
|
781
|
-
};
|
|
782
|
-
var directMap = {
|
|
783
|
-
"\\": "\\",
|
|
784
|
-
'"': '"',
|
|
785
|
-
"'": "'",
|
|
786
|
-
a: "\x07",
|
|
787
|
-
b: "\b",
|
|
788
|
-
f: "\f",
|
|
789
|
-
n: "\n",
|
|
790
|
-
r: "\r",
|
|
791
|
-
t: " ",
|
|
792
|
-
v: "\v"
|
|
793
|
-
};
|
|
794
|
-
function decodeStringLiteral(str, unicode) {
|
|
795
|
-
const out = [];
|
|
796
|
-
let code;
|
|
797
|
-
for (let i = 0; i < str.length; ++i) {
|
|
798
|
-
if (str[i] !== "\\") {
|
|
799
|
-
out.push(str[i]);
|
|
800
|
-
continue;
|
|
801
|
-
}
|
|
802
|
-
const escape = str[i + 1];
|
|
803
|
-
if (escape in directMap) {
|
|
804
|
-
out.push(directMap[escape]);
|
|
805
|
-
++i;
|
|
806
|
-
continue;
|
|
173
|
+
const escape = str[i + 1];
|
|
174
|
+
if (escape in directMap) {
|
|
175
|
+
out.push(directMap[escape]);
|
|
176
|
+
++i;
|
|
177
|
+
continue;
|
|
807
178
|
}
|
|
808
179
|
switch (escape) {
|
|
809
180
|
case "\n":
|
|
@@ -1712,1203 +1083,2139 @@ var PyTime = class _PyTime extends PyDate {
|
|
|
1712
1083
|
}
|
|
1713
1084
|
});
|
|
1714
1085
|
}
|
|
1715
|
-
toJSON() {
|
|
1716
|
-
return this.strftime("%H:%M:%S");
|
|
1086
|
+
toJSON() {
|
|
1087
|
+
return this.strftime("%H:%M:%S");
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
var DAYS_IN_YEAR = [
|
|
1091
|
+
31,
|
|
1092
|
+
59,
|
|
1093
|
+
90,
|
|
1094
|
+
120,
|
|
1095
|
+
151,
|
|
1096
|
+
181,
|
|
1097
|
+
212,
|
|
1098
|
+
243,
|
|
1099
|
+
273,
|
|
1100
|
+
304,
|
|
1101
|
+
334,
|
|
1102
|
+
366
|
|
1103
|
+
];
|
|
1104
|
+
var TIME_PERIODS = ["hour", "minute", "second"];
|
|
1105
|
+
var PERIODS = ["year", "month", "day", ...TIME_PERIODS];
|
|
1106
|
+
var RELATIVE_KEYS = "years months weeks days hours minutes seconds microseconds leapdays".split(
|
|
1107
|
+
" "
|
|
1108
|
+
);
|
|
1109
|
+
var ABSOLUTE_KEYS = "year month day hour minute second microsecond weekday nlyearday yearday".split(
|
|
1110
|
+
" "
|
|
1111
|
+
);
|
|
1112
|
+
var argsSpec = ["dt1", "dt2"];
|
|
1113
|
+
var PyRelativeDelta = class _PyRelativeDelta {
|
|
1114
|
+
static create(...args) {
|
|
1115
|
+
const params = parseArgs(args, argsSpec);
|
|
1116
|
+
if ("dt1" in params) {
|
|
1117
|
+
throw new Error("relativedelta(dt1, dt2) is not supported for now");
|
|
1118
|
+
}
|
|
1119
|
+
for (const period of PERIODS) {
|
|
1120
|
+
if (period in params) {
|
|
1121
|
+
const val = params[period];
|
|
1122
|
+
assert(val >= 0, `${period} ${val} is out of range`);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
for (const key of RELATIVE_KEYS) {
|
|
1126
|
+
params[key] = params[key] || 0;
|
|
1127
|
+
}
|
|
1128
|
+
for (const key of ABSOLUTE_KEYS) {
|
|
1129
|
+
params[key] = key in params ? params[key] : null;
|
|
1130
|
+
}
|
|
1131
|
+
params.days += 7 * params.weeks;
|
|
1132
|
+
let yearDay = 0;
|
|
1133
|
+
if (params.nlyearday) {
|
|
1134
|
+
yearDay = params.nlyearday;
|
|
1135
|
+
} else if (params.yearday) {
|
|
1136
|
+
yearDay = params.yearday;
|
|
1137
|
+
if (yearDay > 59) {
|
|
1138
|
+
params.leapDays = -1;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if (yearDay) {
|
|
1142
|
+
for (let monthIndex = 0; monthIndex < DAYS_IN_YEAR.length; monthIndex++) {
|
|
1143
|
+
if (yearDay <= DAYS_IN_YEAR[monthIndex]) {
|
|
1144
|
+
params.month = monthIndex + 1;
|
|
1145
|
+
if (monthIndex === 0) {
|
|
1146
|
+
params.day = yearDay;
|
|
1147
|
+
} else {
|
|
1148
|
+
params.day = yearDay - DAYS_IN_YEAR[monthIndex - 1];
|
|
1149
|
+
}
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return new _PyRelativeDelta(params);
|
|
1155
|
+
}
|
|
1156
|
+
static add(date, delta) {
|
|
1157
|
+
if (!(date instanceof PyDate || date instanceof PyDateTime)) {
|
|
1158
|
+
throw new NotSupportedError();
|
|
1159
|
+
}
|
|
1160
|
+
const s = tmxxx(
|
|
1161
|
+
(delta.year || date.year) + delta.years,
|
|
1162
|
+
(delta.month || date.month) + delta.months,
|
|
1163
|
+
delta.day || date.day,
|
|
1164
|
+
delta.hour || (date instanceof PyDateTime ? date.hour : 0),
|
|
1165
|
+
delta.minute || (date instanceof PyDateTime ? date.minute : 0),
|
|
1166
|
+
delta.second || (date instanceof PyDateTime ? date.second : 0),
|
|
1167
|
+
delta.microseconds || (date instanceof PyDateTime ? date.microsecond : 0)
|
|
1168
|
+
);
|
|
1169
|
+
const newDateTime = new PyDateTime(
|
|
1170
|
+
s.year,
|
|
1171
|
+
s.month,
|
|
1172
|
+
s.day,
|
|
1173
|
+
s.hour,
|
|
1174
|
+
s.minute,
|
|
1175
|
+
s.second,
|
|
1176
|
+
s.microsecond
|
|
1177
|
+
);
|
|
1178
|
+
let leapDays = 0;
|
|
1179
|
+
if (delta.leapDays && newDateTime.month > 2 && isLeap(newDateTime.year)) {
|
|
1180
|
+
leapDays = delta.leapDays;
|
|
1181
|
+
}
|
|
1182
|
+
const temp = newDateTime.add(
|
|
1183
|
+
PyTimeDelta.create({
|
|
1184
|
+
days: delta.days + leapDays,
|
|
1185
|
+
hours: delta.hours,
|
|
1186
|
+
minutes: delta.minutes,
|
|
1187
|
+
seconds: delta.seconds,
|
|
1188
|
+
microseconds: delta.microseconds
|
|
1189
|
+
})
|
|
1190
|
+
);
|
|
1191
|
+
const hasTime = Boolean(
|
|
1192
|
+
temp.hour || temp.minute || temp.second || temp.microsecond
|
|
1193
|
+
);
|
|
1194
|
+
const returnDate = !hasTime && date instanceof PyDate ? new PyDate(temp.year, temp.month, temp.day) : temp;
|
|
1195
|
+
if (delta.weekday !== null) {
|
|
1196
|
+
const wantedDow = delta.weekday + 1;
|
|
1197
|
+
const _date = new Date(
|
|
1198
|
+
returnDate.year,
|
|
1199
|
+
returnDate.month - 1,
|
|
1200
|
+
returnDate.day
|
|
1201
|
+
);
|
|
1202
|
+
const days = (7 - _date.getDay() + wantedDow) % 7;
|
|
1203
|
+
return returnDate.add(new PyTimeDelta(days, 0, 0));
|
|
1204
|
+
}
|
|
1205
|
+
return returnDate;
|
|
1206
|
+
}
|
|
1207
|
+
static substract(date, delta) {
|
|
1208
|
+
return _PyRelativeDelta.add(date, delta.negate());
|
|
1209
|
+
}
|
|
1210
|
+
constructor(params = {}, sign = 1) {
|
|
1211
|
+
this.years = sign * params.years;
|
|
1212
|
+
this.months = sign * params.months;
|
|
1213
|
+
this.days = sign * params.days;
|
|
1214
|
+
this.hours = sign * params.hours;
|
|
1215
|
+
this.minutes = sign * params.minutes;
|
|
1216
|
+
this.seconds = sign * params.seconds;
|
|
1217
|
+
this.microseconds = sign * params.microseconds;
|
|
1218
|
+
this.leapDays = params.leapDays;
|
|
1219
|
+
this.year = params.year;
|
|
1220
|
+
this.month = params.month;
|
|
1221
|
+
this.day = params.day;
|
|
1222
|
+
this.hour = params.hour;
|
|
1223
|
+
this.minute = params.minute;
|
|
1224
|
+
this.second = params.second;
|
|
1225
|
+
this.microsecond = params.microsecond;
|
|
1226
|
+
this.weekday = params.weekday;
|
|
1227
|
+
}
|
|
1228
|
+
years;
|
|
1229
|
+
months;
|
|
1230
|
+
days;
|
|
1231
|
+
hours;
|
|
1232
|
+
minutes;
|
|
1233
|
+
seconds;
|
|
1234
|
+
microseconds;
|
|
1235
|
+
leapDays;
|
|
1236
|
+
year;
|
|
1237
|
+
month;
|
|
1238
|
+
day;
|
|
1239
|
+
hour;
|
|
1240
|
+
minute;
|
|
1241
|
+
second;
|
|
1242
|
+
microsecond;
|
|
1243
|
+
weekday;
|
|
1244
|
+
negate() {
|
|
1245
|
+
return new _PyRelativeDelta(this, -1);
|
|
1246
|
+
}
|
|
1247
|
+
isEqual() {
|
|
1248
|
+
throw new NotSupportedError();
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
var TIME_DELTA_KEYS = "weeks days hours minutes seconds milliseconds microseconds".split(" ");
|
|
1252
|
+
function modf(x) {
|
|
1253
|
+
const mod = x % 1;
|
|
1254
|
+
return [mod < 0 ? mod + 1 : mod, Math.floor(x)];
|
|
1255
|
+
}
|
|
1256
|
+
var PyTimeDelta = class _PyTimeDelta {
|
|
1257
|
+
constructor(days, seconds, microseconds) {
|
|
1258
|
+
this.days = days;
|
|
1259
|
+
this.seconds = seconds;
|
|
1260
|
+
this.microseconds = microseconds;
|
|
1261
|
+
}
|
|
1262
|
+
static create(...args) {
|
|
1263
|
+
const namedArgs = parseArgs(args, ["days", "seconds", "microseconds"]);
|
|
1264
|
+
for (const key of TIME_DELTA_KEYS) {
|
|
1265
|
+
namedArgs[key] = namedArgs[key] || 0;
|
|
1266
|
+
}
|
|
1267
|
+
let d = 0;
|
|
1268
|
+
let s = 0;
|
|
1269
|
+
let us = 0;
|
|
1270
|
+
const days = namedArgs.days + namedArgs.weeks * 7;
|
|
1271
|
+
let seconds = namedArgs.seconds + 60 * namedArgs.minutes + 3600 * namedArgs.hours;
|
|
1272
|
+
let microseconds = namedArgs.microseconds + 1e3 * namedArgs.milliseconds;
|
|
1273
|
+
const [dFrac, dInt] = modf(days);
|
|
1274
|
+
d = dInt;
|
|
1275
|
+
let daysecondsfrac = 0;
|
|
1276
|
+
if (dFrac) {
|
|
1277
|
+
const [dsFrac, dsInt] = modf(dFrac * 24 * 3600);
|
|
1278
|
+
s = dsInt;
|
|
1279
|
+
daysecondsfrac = dsFrac;
|
|
1280
|
+
}
|
|
1281
|
+
const [sFrac, sInt] = modf(seconds);
|
|
1282
|
+
seconds = sInt;
|
|
1283
|
+
const secondsfrac = sFrac + daysecondsfrac;
|
|
1284
|
+
divmod(seconds, 24 * 3600, (days2, seconds2) => {
|
|
1285
|
+
d += days2;
|
|
1286
|
+
s += seconds2;
|
|
1287
|
+
});
|
|
1288
|
+
microseconds += secondsfrac * 1e6;
|
|
1289
|
+
divmod(microseconds, 1e6, (seconds2, microseconds2) => {
|
|
1290
|
+
divmod(seconds2, 24 * 3600, (days2, seconds3) => {
|
|
1291
|
+
d += days2;
|
|
1292
|
+
s += seconds3;
|
|
1293
|
+
us += Math.round(microseconds2);
|
|
1294
|
+
});
|
|
1295
|
+
});
|
|
1296
|
+
return new _PyTimeDelta(d, s, us);
|
|
1297
|
+
}
|
|
1298
|
+
add(other) {
|
|
1299
|
+
return _PyTimeDelta.create({
|
|
1300
|
+
days: this.days + other.days,
|
|
1301
|
+
seconds: this.seconds + other.seconds,
|
|
1302
|
+
microseconds: this.microseconds + other.microseconds
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
divide(n) {
|
|
1306
|
+
const us = (this.days * 24 * 3600 + this.seconds) * 1e6 + this.microseconds;
|
|
1307
|
+
return _PyTimeDelta.create({ microseconds: Math.floor(us / n) });
|
|
1308
|
+
}
|
|
1309
|
+
isEqual(other) {
|
|
1310
|
+
if (!(other instanceof _PyTimeDelta)) {
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
return this.days === other.days && this.seconds === other.seconds && this.microseconds === other.microseconds;
|
|
1314
|
+
}
|
|
1315
|
+
isTrue() {
|
|
1316
|
+
return this.days !== 0 || this.seconds !== 0 || this.microseconds !== 0;
|
|
1317
|
+
}
|
|
1318
|
+
multiply(n) {
|
|
1319
|
+
return _PyTimeDelta.create({
|
|
1320
|
+
days: n * this.days,
|
|
1321
|
+
seconds: n * this.seconds,
|
|
1322
|
+
microseconds: n * this.microseconds
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
negate() {
|
|
1326
|
+
return _PyTimeDelta.create({
|
|
1327
|
+
days: -this.days,
|
|
1328
|
+
seconds: -this.seconds,
|
|
1329
|
+
microseconds: -this.microseconds
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
substract(other) {
|
|
1333
|
+
return _PyTimeDelta.create({
|
|
1334
|
+
days: this.days - other.days,
|
|
1335
|
+
seconds: this.seconds - other.seconds,
|
|
1336
|
+
microseconds: this.microseconds - other.microseconds
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
total_seconds() {
|
|
1340
|
+
return this.days * 86400 + this.seconds + this.microseconds / 1e6;
|
|
1717
1341
|
}
|
|
1718
1342
|
};
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
);
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1343
|
+
|
|
1344
|
+
// src/utils/domain/py_builtin.ts
|
|
1345
|
+
var EvaluationError = class extends Error {
|
|
1346
|
+
constructor(message) {
|
|
1347
|
+
super(message);
|
|
1348
|
+
this.name = "EvaluationError";
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
function execOnIterable(iterable, func) {
|
|
1352
|
+
if (iterable === null) {
|
|
1353
|
+
throw new EvaluationError("value not iterable");
|
|
1354
|
+
}
|
|
1355
|
+
if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
|
|
1356
|
+
iterable = Object.keys(iterable);
|
|
1357
|
+
}
|
|
1358
|
+
if (typeof iterable?.[Symbol.iterator] !== "function") {
|
|
1359
|
+
throw new EvaluationError("value not iterable");
|
|
1360
|
+
}
|
|
1361
|
+
return func(iterable);
|
|
1362
|
+
}
|
|
1363
|
+
var BUILTINS = {
|
|
1364
|
+
/**
|
|
1365
|
+
* @param {any} value
|
|
1366
|
+
* @returns {boolean}
|
|
1367
|
+
*/
|
|
1368
|
+
bool(value) {
|
|
1369
|
+
switch (typeof value) {
|
|
1370
|
+
case "number":
|
|
1371
|
+
return value !== 0;
|
|
1372
|
+
case "string":
|
|
1373
|
+
return value !== "";
|
|
1374
|
+
case "boolean":
|
|
1375
|
+
return value;
|
|
1376
|
+
case "object":
|
|
1377
|
+
if (value === null || value === void 0) {
|
|
1378
|
+
return false;
|
|
1379
|
+
}
|
|
1380
|
+
if ("isTrue" in value && typeof value.isTrue === "function") {
|
|
1381
|
+
return value.isTrue();
|
|
1382
|
+
}
|
|
1383
|
+
if (value instanceof Array) {
|
|
1384
|
+
return !!value.length;
|
|
1385
|
+
}
|
|
1386
|
+
if (value instanceof Set) {
|
|
1387
|
+
return !!value.size;
|
|
1388
|
+
}
|
|
1389
|
+
return Object.keys(value).length !== 0;
|
|
1390
|
+
default:
|
|
1391
|
+
return true;
|
|
1753
1392
|
}
|
|
1754
|
-
|
|
1755
|
-
|
|
1393
|
+
},
|
|
1394
|
+
set(iterable) {
|
|
1395
|
+
if (arguments.length > 2) {
|
|
1396
|
+
throw new EvaluationError(
|
|
1397
|
+
`set expected at most 1 argument, got (${arguments.length - 1})`
|
|
1398
|
+
);
|
|
1756
1399
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1400
|
+
return execOnIterable(
|
|
1401
|
+
iterable,
|
|
1402
|
+
(iterable2) => new Set(iterable2)
|
|
1403
|
+
);
|
|
1404
|
+
},
|
|
1405
|
+
time: {
|
|
1406
|
+
strftime(format) {
|
|
1407
|
+
return PyDateTime.now().strftime(format);
|
|
1759
1408
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1409
|
+
},
|
|
1410
|
+
context_today() {
|
|
1411
|
+
return PyDate.today();
|
|
1412
|
+
},
|
|
1413
|
+
get current_date() {
|
|
1414
|
+
return this.today;
|
|
1415
|
+
},
|
|
1416
|
+
get today() {
|
|
1417
|
+
return PyDate.today().strftime("%Y-%m-%d");
|
|
1418
|
+
},
|
|
1419
|
+
get now() {
|
|
1420
|
+
return PyDateTime.now().strftime("%Y-%m-%d %H:%M:%S");
|
|
1421
|
+
},
|
|
1422
|
+
datetime: {
|
|
1423
|
+
time: PyTime,
|
|
1424
|
+
timedelta: PyTimeDelta,
|
|
1425
|
+
datetime: PyDateTime,
|
|
1426
|
+
date: PyDate
|
|
1427
|
+
},
|
|
1428
|
+
relativedelta: PyRelativeDelta,
|
|
1429
|
+
true: true,
|
|
1430
|
+
false: false
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
// src/utils/domain/py_utils.ts
|
|
1434
|
+
function toPyValue(value) {
|
|
1435
|
+
switch (typeof value) {
|
|
1436
|
+
case "string":
|
|
1437
|
+
return { type: 1, value };
|
|
1438
|
+
case "number":
|
|
1439
|
+
return { type: 0, value };
|
|
1440
|
+
case "boolean":
|
|
1441
|
+
return { type: 2, value };
|
|
1442
|
+
case "object":
|
|
1443
|
+
if (Array.isArray(value)) {
|
|
1444
|
+
return { type: 4, value: value.map(toPyValue) };
|
|
1445
|
+
} else if (value === null) {
|
|
1446
|
+
return {
|
|
1447
|
+
type: 3
|
|
1448
|
+
/* None */
|
|
1449
|
+
};
|
|
1450
|
+
} else if (value instanceof Date) {
|
|
1451
|
+
return {
|
|
1452
|
+
type: 1,
|
|
1453
|
+
value: String(PyDateTime.convertDate(value))
|
|
1454
|
+
};
|
|
1455
|
+
} else if (value instanceof PyDate || value instanceof PyDateTime) {
|
|
1456
|
+
return { type: 1, value };
|
|
1457
|
+
} else {
|
|
1458
|
+
const content = {};
|
|
1459
|
+
for (const key in value) {
|
|
1460
|
+
content[key] = toPyValue(value[key]);
|
|
1461
|
+
}
|
|
1462
|
+
return { type: 11, value: content };
|
|
1463
|
+
}
|
|
1464
|
+
default:
|
|
1465
|
+
throw new Error("Invalid type");
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
function formatAST(ast, lbp = 0) {
|
|
1469
|
+
switch (ast.type) {
|
|
1470
|
+
case 3:
|
|
1471
|
+
return "None";
|
|
1472
|
+
case 1:
|
|
1473
|
+
return JSON.stringify(ast.value);
|
|
1474
|
+
case 0:
|
|
1475
|
+
return String(ast.value);
|
|
1476
|
+
case 2:
|
|
1477
|
+
return ast.value ? "True" : "False";
|
|
1478
|
+
case 4:
|
|
1479
|
+
return `[${ast.value.map(formatAST).join(", ")}]`;
|
|
1480
|
+
case 6:
|
|
1481
|
+
if (ast.op === "not") {
|
|
1482
|
+
return `not ${formatAST(ast.right, 50)}`;
|
|
1483
|
+
}
|
|
1484
|
+
return `${ast.op}${formatAST(ast.right, 130)}`;
|
|
1485
|
+
case 7:
|
|
1486
|
+
const abp = bp(ast.op);
|
|
1487
|
+
const binaryStr = `${formatAST(ast.left, abp)} ${ast.op} ${formatAST(ast.right, abp)}`;
|
|
1488
|
+
return abp < lbp ? `(${binaryStr})` : binaryStr;
|
|
1489
|
+
case 11:
|
|
1490
|
+
const pairs = [];
|
|
1491
|
+
for (const k in ast.value) {
|
|
1492
|
+
pairs.push(`"${k}": ${formatAST(ast.value[k])}`);
|
|
1493
|
+
}
|
|
1494
|
+
return `{${pairs.join(", ")}}`;
|
|
1495
|
+
case 10:
|
|
1496
|
+
return `(${ast.value.map(formatAST).join(", ")})`;
|
|
1497
|
+
case 5:
|
|
1498
|
+
return ast.value;
|
|
1499
|
+
case 12:
|
|
1500
|
+
return `${formatAST(ast.target)}[${formatAST(ast.key)}]`;
|
|
1501
|
+
case 13:
|
|
1502
|
+
const { ifTrue, condition, ifFalse } = ast;
|
|
1503
|
+
return `${formatAST(ifTrue)} if ${formatAST(condition)} else ${formatAST(ifFalse)}`;
|
|
1504
|
+
case 14:
|
|
1505
|
+
const boolAbp = bp(ast.op);
|
|
1506
|
+
const boolStr = `${formatAST(ast.left, boolAbp)} ${ast.op} ${formatAST(ast.right, boolAbp)}`;
|
|
1507
|
+
return boolAbp < lbp ? `(${boolStr})` : boolStr;
|
|
1508
|
+
case 15:
|
|
1509
|
+
return `${formatAST(ast.obj, 150)}.${ast.key}`;
|
|
1510
|
+
case 8:
|
|
1511
|
+
const args = ast.args.map(formatAST);
|
|
1512
|
+
const kwargs = [];
|
|
1513
|
+
for (const kwarg in ast.kwargs) {
|
|
1514
|
+
kwargs.push(`${kwarg} = ${formatAST(ast.kwargs[kwarg])}`);
|
|
1768
1515
|
}
|
|
1516
|
+
const argStr = args.concat(kwargs).join(", ");
|
|
1517
|
+
return `${formatAST(ast.fn)}(${argStr})`;
|
|
1518
|
+
default:
|
|
1519
|
+
throw new Error("invalid expression: " + JSON.stringify(ast));
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
var PY_DICT = /* @__PURE__ */ Object.create(null);
|
|
1523
|
+
function toPyDict(obj) {
|
|
1524
|
+
return new Proxy(obj, {
|
|
1525
|
+
getPrototypeOf() {
|
|
1526
|
+
return PY_DICT;
|
|
1769
1527
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// src/utils/domain/py_interpreter.ts
|
|
1532
|
+
var isTrue = BUILTINS.bool;
|
|
1533
|
+
function applyUnaryOp(ast, context) {
|
|
1534
|
+
const value = evaluate(ast.right, context);
|
|
1535
|
+
switch (ast.op) {
|
|
1536
|
+
case "-":
|
|
1537
|
+
if (value instanceof Object && "negate" in value) {
|
|
1538
|
+
return value.negate();
|
|
1781
1539
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1540
|
+
return -value;
|
|
1541
|
+
case "+":
|
|
1542
|
+
return value;
|
|
1543
|
+
case "not":
|
|
1544
|
+
return !isTrue(value);
|
|
1545
|
+
default:
|
|
1546
|
+
throw new EvaluationError(`Unknown unary operator: ${ast.op}`);
|
|
1784
1547
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1548
|
+
}
|
|
1549
|
+
function pytypeIndex(val) {
|
|
1550
|
+
switch (typeof val) {
|
|
1551
|
+
case "object":
|
|
1552
|
+
return val === null ? 1 : Array.isArray(val) ? 5 : 3;
|
|
1553
|
+
case "number":
|
|
1554
|
+
return 2;
|
|
1555
|
+
case "string":
|
|
1556
|
+
return 4;
|
|
1557
|
+
default:
|
|
1558
|
+
throw new EvaluationError(`Unknown type: ${typeof val}`);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
function isLess(left, right) {
|
|
1562
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
1563
|
+
return left < right;
|
|
1564
|
+
}
|
|
1565
|
+
if (typeof left === "boolean") {
|
|
1566
|
+
left = left ? 1 : 0;
|
|
1567
|
+
}
|
|
1568
|
+
if (typeof right === "boolean") {
|
|
1569
|
+
right = right ? 1 : 0;
|
|
1570
|
+
}
|
|
1571
|
+
const leftIndex = pytypeIndex(left);
|
|
1572
|
+
const rightIndex = pytypeIndex(right);
|
|
1573
|
+
if (leftIndex === rightIndex) {
|
|
1574
|
+
return left < right;
|
|
1575
|
+
}
|
|
1576
|
+
return leftIndex < rightIndex;
|
|
1577
|
+
}
|
|
1578
|
+
function isEqual(left, right) {
|
|
1579
|
+
if (typeof left !== typeof right) {
|
|
1580
|
+
if (typeof left === "boolean" && typeof right === "number") {
|
|
1581
|
+
return right === (left ? 1 : 0);
|
|
1810
1582
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
days: delta.days + leapDays,
|
|
1814
|
-
hours: delta.hours,
|
|
1815
|
-
minutes: delta.minutes,
|
|
1816
|
-
seconds: delta.seconds,
|
|
1817
|
-
microseconds: delta.microseconds
|
|
1818
|
-
})
|
|
1819
|
-
);
|
|
1820
|
-
const hasTime = Boolean(
|
|
1821
|
-
temp.hour || temp.minute || temp.second || temp.microsecond
|
|
1822
|
-
);
|
|
1823
|
-
const returnDate = !hasTime && date instanceof PyDate ? new PyDate(temp.year, temp.month, temp.day) : temp;
|
|
1824
|
-
if (delta.weekday !== null) {
|
|
1825
|
-
const wantedDow = delta.weekday + 1;
|
|
1826
|
-
const _date = new Date(
|
|
1827
|
-
returnDate.year,
|
|
1828
|
-
returnDate.month - 1,
|
|
1829
|
-
returnDate.day
|
|
1830
|
-
);
|
|
1831
|
-
const days = (7 - _date.getDay() + wantedDow) % 7;
|
|
1832
|
-
return returnDate.add(new PyTimeDelta(days, 0, 0));
|
|
1583
|
+
if (typeof left === "number" && typeof right === "boolean") {
|
|
1584
|
+
return left === (right ? 1 : 0);
|
|
1833
1585
|
}
|
|
1834
|
-
return
|
|
1586
|
+
return false;
|
|
1835
1587
|
}
|
|
1836
|
-
|
|
1837
|
-
return
|
|
1588
|
+
if (left instanceof Object && "isEqual" in left) {
|
|
1589
|
+
return left.isEqual(right);
|
|
1838
1590
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
this.minutes = sign * params.minutes;
|
|
1845
|
-
this.seconds = sign * params.seconds;
|
|
1846
|
-
this.microseconds = sign * params.microseconds;
|
|
1847
|
-
this.leapDays = params.leapDays;
|
|
1848
|
-
this.year = params.year;
|
|
1849
|
-
this.month = params.month;
|
|
1850
|
-
this.day = params.day;
|
|
1851
|
-
this.hour = params.hour;
|
|
1852
|
-
this.minute = params.minute;
|
|
1853
|
-
this.second = params.second;
|
|
1854
|
-
this.microsecond = params.microsecond;
|
|
1855
|
-
this.weekday = params.weekday;
|
|
1591
|
+
return left === right;
|
|
1592
|
+
}
|
|
1593
|
+
function isIn(left, right) {
|
|
1594
|
+
if (Array.isArray(right)) {
|
|
1595
|
+
return right.includes(left);
|
|
1856
1596
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
days;
|
|
1860
|
-
hours;
|
|
1861
|
-
minutes;
|
|
1862
|
-
seconds;
|
|
1863
|
-
microseconds;
|
|
1864
|
-
leapDays;
|
|
1865
|
-
year;
|
|
1866
|
-
month;
|
|
1867
|
-
day;
|
|
1868
|
-
hour;
|
|
1869
|
-
minute;
|
|
1870
|
-
second;
|
|
1871
|
-
microsecond;
|
|
1872
|
-
weekday;
|
|
1873
|
-
negate() {
|
|
1874
|
-
return new _PyRelativeDelta(this, -1);
|
|
1597
|
+
if (typeof right === "string" && typeof left === "string") {
|
|
1598
|
+
return right.includes(left);
|
|
1875
1599
|
}
|
|
1876
|
-
|
|
1877
|
-
|
|
1600
|
+
if (typeof right === "object") {
|
|
1601
|
+
return left in right;
|
|
1878
1602
|
}
|
|
1879
|
-
|
|
1880
|
-
var TIME_DELTA_KEYS = "weeks days hours minutes seconds milliseconds microseconds".split(" ");
|
|
1881
|
-
function modf(x) {
|
|
1882
|
-
const mod = x % 1;
|
|
1883
|
-
return [mod < 0 ? mod + 1 : mod, Math.floor(x)];
|
|
1603
|
+
return false;
|
|
1884
1604
|
}
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1605
|
+
function applyBinaryOp(ast, context) {
|
|
1606
|
+
const left = evaluate(ast.left, context);
|
|
1607
|
+
const right = evaluate(ast.right, context);
|
|
1608
|
+
switch (ast.op) {
|
|
1609
|
+
case "+": {
|
|
1610
|
+
const relativeDeltaOnLeft = left instanceof PyRelativeDelta;
|
|
1611
|
+
const relativeDeltaOnRight = right instanceof PyRelativeDelta;
|
|
1612
|
+
if (relativeDeltaOnLeft || relativeDeltaOnRight) {
|
|
1613
|
+
const date = relativeDeltaOnLeft ? right : left;
|
|
1614
|
+
const delta = relativeDeltaOnLeft ? left : right;
|
|
1615
|
+
return PyRelativeDelta.add(date, delta);
|
|
1616
|
+
}
|
|
1617
|
+
const timeDeltaOnLeft = left instanceof PyTimeDelta;
|
|
1618
|
+
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
1619
|
+
if (timeDeltaOnLeft && timeDeltaOnRight) {
|
|
1620
|
+
return left.add(right);
|
|
1621
|
+
}
|
|
1622
|
+
if (timeDeltaOnLeft) {
|
|
1623
|
+
if (right instanceof PyDate || right instanceof PyDateTime) {
|
|
1624
|
+
return right.add(left);
|
|
1625
|
+
} else {
|
|
1626
|
+
throw new NotSupportedError();
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
if (timeDeltaOnRight) {
|
|
1630
|
+
if (left instanceof PyDate || left instanceof PyDateTime) {
|
|
1631
|
+
return left.add(right);
|
|
1632
|
+
} else {
|
|
1633
|
+
throw new NotSupportedError();
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
if (left instanceof Array && right instanceof Array) {
|
|
1637
|
+
return [...left, ...right];
|
|
1638
|
+
}
|
|
1639
|
+
return left + right;
|
|
1640
|
+
}
|
|
1641
|
+
case "-": {
|
|
1642
|
+
const isRightDelta = right instanceof PyRelativeDelta;
|
|
1643
|
+
if (isRightDelta) {
|
|
1644
|
+
return PyRelativeDelta.substract(left, right);
|
|
1645
|
+
}
|
|
1646
|
+
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
1647
|
+
if (timeDeltaOnRight) {
|
|
1648
|
+
if (left instanceof PyTimeDelta) {
|
|
1649
|
+
return left.substract(right);
|
|
1650
|
+
} else if (left instanceof PyDate || left instanceof PyDateTime) {
|
|
1651
|
+
return left.substract(right);
|
|
1652
|
+
} else {
|
|
1653
|
+
throw new NotSupportedError();
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
if (left instanceof PyDate) {
|
|
1657
|
+
return left.substract(right);
|
|
1658
|
+
}
|
|
1659
|
+
return left - right;
|
|
1660
|
+
}
|
|
1661
|
+
case "*": {
|
|
1662
|
+
const timeDeltaOnLeft = left instanceof PyTimeDelta;
|
|
1663
|
+
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
1664
|
+
if (timeDeltaOnLeft || timeDeltaOnRight) {
|
|
1665
|
+
const number = timeDeltaOnLeft ? right : left;
|
|
1666
|
+
const delta = timeDeltaOnLeft ? left : right;
|
|
1667
|
+
return delta.multiply(number);
|
|
1668
|
+
}
|
|
1669
|
+
return left * right;
|
|
1670
|
+
}
|
|
1671
|
+
case "/":
|
|
1672
|
+
return left / right;
|
|
1673
|
+
case "%":
|
|
1674
|
+
return left % right;
|
|
1675
|
+
case "//":
|
|
1676
|
+
if (left instanceof PyTimeDelta) {
|
|
1677
|
+
return left.divide(right);
|
|
1678
|
+
}
|
|
1679
|
+
return Math.floor(left / right);
|
|
1680
|
+
case "**":
|
|
1681
|
+
return left ** right;
|
|
1682
|
+
case "==":
|
|
1683
|
+
return isEqual(left, right);
|
|
1684
|
+
case "<>":
|
|
1685
|
+
case "!=":
|
|
1686
|
+
return !isEqual(left, right);
|
|
1687
|
+
case "<":
|
|
1688
|
+
return isLess(left, right);
|
|
1689
|
+
case ">":
|
|
1690
|
+
return isLess(right, left);
|
|
1691
|
+
case ">=":
|
|
1692
|
+
return isEqual(left, right) || isLess(right, left);
|
|
1693
|
+
case "<=":
|
|
1694
|
+
return isEqual(left, right) || isLess(left, right);
|
|
1695
|
+
case "in":
|
|
1696
|
+
return isIn(left, right);
|
|
1697
|
+
case "not in":
|
|
1698
|
+
return !isIn(left, right);
|
|
1699
|
+
default:
|
|
1700
|
+
throw new EvaluationError(`Unknown binary operator: ${ast.op}`);
|
|
1890
1701
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
let seconds = namedArgs.seconds + 60 * namedArgs.minutes + 3600 * namedArgs.hours;
|
|
1901
|
-
let microseconds = namedArgs.microseconds + 1e3 * namedArgs.milliseconds;
|
|
1902
|
-
const [dFrac, dInt] = modf(days);
|
|
1903
|
-
d = dInt;
|
|
1904
|
-
let daysecondsfrac = 0;
|
|
1905
|
-
if (dFrac) {
|
|
1906
|
-
const [dsFrac, dsInt] = modf(dFrac * 24 * 3600);
|
|
1907
|
-
s = dsInt;
|
|
1908
|
-
daysecondsfrac = dsFrac;
|
|
1702
|
+
}
|
|
1703
|
+
var DICT = {
|
|
1704
|
+
get(...args) {
|
|
1705
|
+
const { key, defValue } = parseArgs(args, ["key", "defValue"]);
|
|
1706
|
+
const self = this;
|
|
1707
|
+
if (key in self) {
|
|
1708
|
+
return self[key];
|
|
1709
|
+
} else if (defValue !== void 0) {
|
|
1710
|
+
return defValue;
|
|
1909
1711
|
}
|
|
1910
|
-
|
|
1911
|
-
seconds = sInt;
|
|
1912
|
-
const secondsfrac = sFrac + daysecondsfrac;
|
|
1913
|
-
divmod(seconds, 24 * 3600, (days2, seconds2) => {
|
|
1914
|
-
d += days2;
|
|
1915
|
-
s += seconds2;
|
|
1916
|
-
});
|
|
1917
|
-
microseconds += secondsfrac * 1e6;
|
|
1918
|
-
divmod(microseconds, 1e6, (seconds2, microseconds2) => {
|
|
1919
|
-
divmod(seconds2, 24 * 3600, (days2, seconds3) => {
|
|
1920
|
-
d += days2;
|
|
1921
|
-
s += seconds3;
|
|
1922
|
-
us += Math.round(microseconds2);
|
|
1923
|
-
});
|
|
1924
|
-
});
|
|
1925
|
-
return new _PyTimeDelta(d, s, us);
|
|
1926
|
-
}
|
|
1927
|
-
add(other) {
|
|
1928
|
-
return _PyTimeDelta.create({
|
|
1929
|
-
days: this.days + other.days,
|
|
1930
|
-
seconds: this.seconds + other.seconds,
|
|
1931
|
-
microseconds: this.microseconds + other.microseconds
|
|
1932
|
-
});
|
|
1712
|
+
return null;
|
|
1933
1713
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1714
|
+
};
|
|
1715
|
+
var STRING = {
|
|
1716
|
+
lower() {
|
|
1717
|
+
return this.toLowerCase();
|
|
1718
|
+
},
|
|
1719
|
+
upper() {
|
|
1720
|
+
return this.toUpperCase();
|
|
1937
1721
|
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
return this.days === other.days && this.seconds === other.seconds && this.microseconds === other.microseconds;
|
|
1722
|
+
};
|
|
1723
|
+
function applyFunc(key, func, set, ...args) {
|
|
1724
|
+
if (args.length === 1) {
|
|
1725
|
+
return new Set(set);
|
|
1943
1726
|
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1727
|
+
if (args.length > 2) {
|
|
1728
|
+
throw new EvaluationError(
|
|
1729
|
+
`${key}: py_js supports at most 1 argument, got (${args.length - 1})`
|
|
1730
|
+
);
|
|
1946
1731
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1732
|
+
return execOnIterable(args[0], func);
|
|
1733
|
+
}
|
|
1734
|
+
var SET = {
|
|
1735
|
+
intersection(...args) {
|
|
1736
|
+
return applyFunc(
|
|
1737
|
+
"intersection",
|
|
1738
|
+
(iterable) => {
|
|
1739
|
+
const intersection = /* @__PURE__ */ new Set();
|
|
1740
|
+
for (const i of iterable) {
|
|
1741
|
+
if (this.has(i)) {
|
|
1742
|
+
intersection.add(i);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
return intersection;
|
|
1746
|
+
},
|
|
1747
|
+
this,
|
|
1748
|
+
...args
|
|
1749
|
+
);
|
|
1750
|
+
},
|
|
1751
|
+
difference(...args) {
|
|
1752
|
+
return applyFunc(
|
|
1753
|
+
"difference",
|
|
1754
|
+
(iterable) => {
|
|
1755
|
+
iterable = new Set(iterable);
|
|
1756
|
+
const difference = /* @__PURE__ */ new Set();
|
|
1757
|
+
for (const e of this) {
|
|
1758
|
+
if (!iterable.has(e)) {
|
|
1759
|
+
difference.add(e);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
return difference;
|
|
1763
|
+
},
|
|
1764
|
+
this,
|
|
1765
|
+
...args
|
|
1766
|
+
);
|
|
1767
|
+
},
|
|
1768
|
+
union(...args) {
|
|
1769
|
+
return applyFunc(
|
|
1770
|
+
"union",
|
|
1771
|
+
(iterable) => {
|
|
1772
|
+
return /* @__PURE__ */ new Set([...this, ...iterable]);
|
|
1773
|
+
},
|
|
1774
|
+
this,
|
|
1775
|
+
...args
|
|
1776
|
+
);
|
|
1953
1777
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1778
|
+
};
|
|
1779
|
+
function methods(_class) {
|
|
1780
|
+
return Object.getOwnPropertyNames(_class.prototype).map(
|
|
1781
|
+
(prop) => _class.prototype[prop]
|
|
1782
|
+
);
|
|
1783
|
+
}
|
|
1784
|
+
var allowedFns = /* @__PURE__ */ new Set([
|
|
1785
|
+
BUILTINS.time.strftime,
|
|
1786
|
+
BUILTINS.set,
|
|
1787
|
+
BUILTINS.bool,
|
|
1788
|
+
BUILTINS.context_today,
|
|
1789
|
+
BUILTINS.datetime.datetime.now,
|
|
1790
|
+
BUILTINS.datetime.datetime.combine,
|
|
1791
|
+
BUILTINS.datetime.date.today,
|
|
1792
|
+
...methods(BUILTINS.relativedelta),
|
|
1793
|
+
...Object.values(BUILTINS.datetime).flatMap((obj) => methods(obj)),
|
|
1794
|
+
...Object.values(SET),
|
|
1795
|
+
...Object.values(DICT),
|
|
1796
|
+
...Object.values(STRING)
|
|
1797
|
+
]);
|
|
1798
|
+
var unboundFn = Symbol("unbound function");
|
|
1799
|
+
function evaluate(ast, context = {}) {
|
|
1800
|
+
const dicts = /* @__PURE__ */ new Set();
|
|
1801
|
+
let pyContext;
|
|
1802
|
+
const evalContext = Object.create(context);
|
|
1803
|
+
if (!evalContext?.context) {
|
|
1804
|
+
Object.defineProperty(evalContext, "context", {
|
|
1805
|
+
get() {
|
|
1806
|
+
if (!pyContext) {
|
|
1807
|
+
pyContext = toPyDict(context);
|
|
1808
|
+
}
|
|
1809
|
+
return pyContext;
|
|
1810
|
+
}
|
|
1959
1811
|
});
|
|
1960
1812
|
}
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1813
|
+
function _innerEvaluate(ast2) {
|
|
1814
|
+
switch (ast2?.type) {
|
|
1815
|
+
case 0:
|
|
1816
|
+
// Number
|
|
1817
|
+
case 1:
|
|
1818
|
+
return ast2.value;
|
|
1819
|
+
case 5:
|
|
1820
|
+
if (ast2.value in evalContext) {
|
|
1821
|
+
if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
|
|
1822
|
+
return evalContext[ast2.value]?.id;
|
|
1823
|
+
}
|
|
1824
|
+
return evalContext[ast2.value] ?? false;
|
|
1825
|
+
} else if (ast2.value in BUILTINS) {
|
|
1826
|
+
return BUILTINS[ast2.value];
|
|
1827
|
+
} else {
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
case 3:
|
|
1831
|
+
return null;
|
|
1832
|
+
case 2:
|
|
1833
|
+
return ast2.value;
|
|
1834
|
+
case 6:
|
|
1835
|
+
return applyUnaryOp(ast2, evalContext);
|
|
1836
|
+
case 7:
|
|
1837
|
+
return applyBinaryOp(ast2, evalContext);
|
|
1838
|
+
case 14:
|
|
1839
|
+
const left = _evaluate(ast2.left);
|
|
1840
|
+
if (ast2.op === "and") {
|
|
1841
|
+
return isTrue(left) ? _evaluate(ast2.right) : left;
|
|
1842
|
+
} else {
|
|
1843
|
+
return isTrue(left) ? left : _evaluate(ast2.right);
|
|
1844
|
+
}
|
|
1845
|
+
case 4:
|
|
1846
|
+
// List
|
|
1847
|
+
case 10:
|
|
1848
|
+
return ast2.value.map(_evaluate);
|
|
1849
|
+
case 11:
|
|
1850
|
+
const dict = {};
|
|
1851
|
+
for (const key2 in ast2.value) {
|
|
1852
|
+
dict[key2] = _evaluate(ast2.value[key2]);
|
|
1853
|
+
}
|
|
1854
|
+
dicts.add(dict);
|
|
1855
|
+
return dict;
|
|
1856
|
+
case 8:
|
|
1857
|
+
const fnValue = _evaluate(ast2.fn);
|
|
1858
|
+
const args = ast2.args.map(_evaluate);
|
|
1859
|
+
const kwargs = {};
|
|
1860
|
+
for (const kwarg in ast2.kwargs) {
|
|
1861
|
+
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
1862
|
+
}
|
|
1863
|
+
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
1864
|
+
return fnValue.create(...args, kwargs);
|
|
1865
|
+
}
|
|
1866
|
+
return fnValue(...args, kwargs);
|
|
1867
|
+
case 12:
|
|
1868
|
+
const dictVal = _evaluate(ast2.target);
|
|
1869
|
+
const key = _evaluate(ast2.key);
|
|
1870
|
+
return dictVal[key];
|
|
1871
|
+
case 13:
|
|
1872
|
+
if (isTrue(_evaluate(ast2.condition))) {
|
|
1873
|
+
return _evaluate(ast2.ifTrue);
|
|
1874
|
+
} else {
|
|
1875
|
+
return _evaluate(ast2.ifFalse);
|
|
1876
|
+
}
|
|
1877
|
+
case 15:
|
|
1878
|
+
let leftVal = _evaluate(ast2.obj);
|
|
1879
|
+
let result;
|
|
1880
|
+
if (dicts.has(leftVal) || Object.isPrototypeOf.call(PY_DICT, leftVal)) {
|
|
1881
|
+
result = DICT[ast2.key];
|
|
1882
|
+
} else if (typeof leftVal === "string") {
|
|
1883
|
+
result = STRING[ast2.key];
|
|
1884
|
+
} else if (leftVal instanceof Set) {
|
|
1885
|
+
result = SET[ast2.key];
|
|
1886
|
+
} else if (ast2.key === "get" && typeof leftVal === "object") {
|
|
1887
|
+
result = DICT[ast2.key];
|
|
1888
|
+
leftVal = toPyDict(leftVal);
|
|
1889
|
+
} else {
|
|
1890
|
+
result = leftVal[ast2.key];
|
|
1891
|
+
}
|
|
1892
|
+
if (typeof result === "function") {
|
|
1893
|
+
const bound = result.bind(leftVal);
|
|
1894
|
+
bound[unboundFn] = result;
|
|
1895
|
+
return bound;
|
|
1896
|
+
}
|
|
1897
|
+
return result;
|
|
1898
|
+
default:
|
|
1899
|
+
throw new EvaluationError(`AST of type ${ast2.type} cannot be evaluated`);
|
|
1900
|
+
}
|
|
1967
1901
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1902
|
+
function _evaluate(ast2) {
|
|
1903
|
+
const val = _innerEvaluate(ast2);
|
|
1904
|
+
if (typeof val === "function" && !allowedFns.has(val) && !allowedFns.has(val[unboundFn])) {
|
|
1905
|
+
throw new Error("Invalid Function Call");
|
|
1906
|
+
}
|
|
1907
|
+
return val;
|
|
1970
1908
|
}
|
|
1971
|
-
|
|
1909
|
+
return _evaluate(ast);
|
|
1910
|
+
}
|
|
1972
1911
|
|
|
1973
|
-
// src/utils/domain/
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1912
|
+
// src/utils/domain/py.ts
|
|
1913
|
+
function parseExpr(expr) {
|
|
1914
|
+
const tokens = tokenize(expr);
|
|
1915
|
+
return parse(tokens);
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
// src/utils/domain/objects.ts
|
|
1919
|
+
function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
|
|
1920
|
+
if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") {
|
|
1921
|
+
return obj1 === obj2;
|
|
1978
1922
|
}
|
|
1923
|
+
const obj1Keys = Object.keys(obj1);
|
|
1924
|
+
return obj1Keys.length === Object.keys(obj2).length && obj1Keys.every((key) => comparisonFn(obj1[key], obj2[key]));
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
// src/utils/domain/arrays.ts
|
|
1928
|
+
var shallowEqual2 = shallowEqual;
|
|
1929
|
+
|
|
1930
|
+
// src/utils/domain/strings.ts
|
|
1931
|
+
var escapeMethod = Symbol("html");
|
|
1932
|
+
function escapeRegExp(str) {
|
|
1933
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
// src/utils/domain/domain.ts
|
|
1937
|
+
var InvalidDomainError = class extends Error {
|
|
1979
1938
|
};
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1939
|
+
var Domain = class _Domain {
|
|
1940
|
+
ast = { type: -1, value: null };
|
|
1941
|
+
static TRUE;
|
|
1942
|
+
static FALSE;
|
|
1943
|
+
static combine(domains, operator) {
|
|
1944
|
+
if (domains.length === 0) {
|
|
1945
|
+
return new _Domain([]);
|
|
1946
|
+
}
|
|
1947
|
+
const domain1 = domains[0] instanceof _Domain ? domains[0] : new _Domain(domains[0]);
|
|
1948
|
+
if (domains.length === 1) {
|
|
1949
|
+
return domain1;
|
|
1950
|
+
}
|
|
1951
|
+
const domain2 = _Domain.combine(domains.slice(1), operator);
|
|
1952
|
+
const result = new _Domain([]);
|
|
1953
|
+
const astValues1 = domain1.ast.value;
|
|
1954
|
+
const astValues2 = domain2.ast.value;
|
|
1955
|
+
const op = operator === "AND" ? "&" : "|";
|
|
1956
|
+
const combinedAST = {
|
|
1957
|
+
type: 4,
|
|
1958
|
+
value: astValues1.concat(astValues2)
|
|
1959
|
+
};
|
|
1960
|
+
result.ast = normalizeDomainAST(combinedAST, op);
|
|
1961
|
+
return result;
|
|
1983
1962
|
}
|
|
1984
|
-
|
|
1985
|
-
|
|
1963
|
+
static and(domains) {
|
|
1964
|
+
return _Domain.combine(domains, "AND");
|
|
1986
1965
|
}
|
|
1987
|
-
|
|
1988
|
-
|
|
1966
|
+
static or(domains) {
|
|
1967
|
+
return _Domain.combine(domains, "OR");
|
|
1989
1968
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
return false;
|
|
2008
|
-
}
|
|
2009
|
-
if ("isTrue" in value && typeof value.isTrue === "function") {
|
|
2010
|
-
return value.isTrue();
|
|
1969
|
+
static not(domain) {
|
|
1970
|
+
const result = new _Domain(domain);
|
|
1971
|
+
result.ast.value.unshift({ type: 1, value: "!" });
|
|
1972
|
+
return result;
|
|
1973
|
+
}
|
|
1974
|
+
static removeDomainLeaves(domain, keysToRemove) {
|
|
1975
|
+
function processLeaf(elements, idx, operatorCtx, newDomain2) {
|
|
1976
|
+
const leaf = elements[idx];
|
|
1977
|
+
if (leaf.type === 10) {
|
|
1978
|
+
if (keysToRemove.includes(leaf.value[0].value)) {
|
|
1979
|
+
if (operatorCtx === "&") {
|
|
1980
|
+
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
1981
|
+
} else if (operatorCtx === "|") {
|
|
1982
|
+
newDomain2.ast.value.push(..._Domain.FALSE.ast.value);
|
|
1983
|
+
}
|
|
1984
|
+
} else {
|
|
1985
|
+
newDomain2.ast.value.push(leaf);
|
|
2011
1986
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
1987
|
+
return 1;
|
|
1988
|
+
} else if (leaf.type === 1) {
|
|
1989
|
+
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)) {
|
|
1990
|
+
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
1991
|
+
return 3;
|
|
2014
1992
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
1993
|
+
newDomain2.ast.value.push(leaf);
|
|
1994
|
+
if (leaf.value === "!") {
|
|
1995
|
+
return 1 + processLeaf(elements, idx + 1, "&", newDomain2);
|
|
2017
1996
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
1997
|
+
const firstLeafSkip = processLeaf(
|
|
1998
|
+
elements,
|
|
1999
|
+
idx + 1,
|
|
2000
|
+
leaf.value,
|
|
2001
|
+
newDomain2
|
|
2002
|
+
);
|
|
2003
|
+
const secondLeafSkip = processLeaf(
|
|
2004
|
+
elements,
|
|
2005
|
+
idx + 1 + firstLeafSkip,
|
|
2006
|
+
leaf.value,
|
|
2007
|
+
newDomain2
|
|
2008
|
+
);
|
|
2009
|
+
return 1 + firstLeafSkip + secondLeafSkip;
|
|
2010
|
+
}
|
|
2011
|
+
return 0;
|
|
2021
2012
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
throw new EvaluationError(
|
|
2026
|
-
`set expected at most 1 argument, got (${arguments.length - 1})`
|
|
2027
|
-
);
|
|
2013
|
+
const d = new _Domain(domain);
|
|
2014
|
+
if (d.ast.value.length === 0) {
|
|
2015
|
+
return d;
|
|
2028
2016
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2017
|
+
const newDomain = new _Domain([]);
|
|
2018
|
+
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
2019
|
+
return newDomain;
|
|
2020
|
+
}
|
|
2021
|
+
constructor(descr = []) {
|
|
2022
|
+
if (descr instanceof _Domain) {
|
|
2023
|
+
return new _Domain(descr.toString());
|
|
2024
|
+
} else {
|
|
2025
|
+
let rawAST;
|
|
2026
|
+
try {
|
|
2027
|
+
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
2028
|
+
} catch (error) {
|
|
2029
|
+
throw new InvalidDomainError(
|
|
2030
|
+
`Invalid domain representation: ${descr}`,
|
|
2031
|
+
{
|
|
2032
|
+
cause: error
|
|
2033
|
+
}
|
|
2034
|
+
);
|
|
2035
|
+
}
|
|
2036
|
+
this.ast = normalizeDomainAST(rawAST);
|
|
2037
2037
|
}
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2038
|
+
}
|
|
2039
|
+
contains(record) {
|
|
2040
|
+
const expr = evaluate(this.ast, record);
|
|
2041
|
+
return matchDomain(record, expr);
|
|
2042
|
+
}
|
|
2043
|
+
toString() {
|
|
2044
|
+
return formatAST(this.ast);
|
|
2045
|
+
}
|
|
2046
|
+
toList(context) {
|
|
2047
|
+
return evaluate(this.ast, context);
|
|
2048
|
+
}
|
|
2049
|
+
toJson() {
|
|
2050
|
+
try {
|
|
2051
|
+
const evaluatedAsList = this.toList({});
|
|
2052
|
+
const evaluatedDomain = new _Domain(evaluatedAsList);
|
|
2053
|
+
if (evaluatedDomain.toString() === this.toString()) {
|
|
2054
|
+
return evaluatedAsList;
|
|
2055
|
+
}
|
|
2056
|
+
return this.toString();
|
|
2057
|
+
} catch {
|
|
2058
|
+
return this.toString();
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2060
2061
|
};
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
return { type:
|
|
2074
|
-
|
|
2075
|
-
return {
|
|
2076
|
-
type: 3
|
|
2077
|
-
/* None */
|
|
2078
|
-
};
|
|
2079
|
-
} else if (value instanceof Date) {
|
|
2062
|
+
var TRUE_LEAF = [1, "=", 1];
|
|
2063
|
+
var FALSE_LEAF = [0, "=", 1];
|
|
2064
|
+
var TRUE_DOMAIN = new Domain([TRUE_LEAF]);
|
|
2065
|
+
var FALSE_DOMAIN = new Domain([FALSE_LEAF]);
|
|
2066
|
+
Domain.TRUE = TRUE_DOMAIN;
|
|
2067
|
+
Domain.FALSE = FALSE_DOMAIN;
|
|
2068
|
+
function toAST(domain) {
|
|
2069
|
+
const elems = domain.map((elem) => {
|
|
2070
|
+
switch (elem) {
|
|
2071
|
+
case "!":
|
|
2072
|
+
case "&":
|
|
2073
|
+
case "|":
|
|
2074
|
+
return { type: 1, value: elem };
|
|
2075
|
+
default:
|
|
2080
2076
|
return {
|
|
2081
|
-
type:
|
|
2082
|
-
value:
|
|
2077
|
+
type: 10,
|
|
2078
|
+
value: elem.map(toPyValue)
|
|
2083
2079
|
};
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2080
|
+
}
|
|
2081
|
+
});
|
|
2082
|
+
return { type: 4, value: elems };
|
|
2083
|
+
}
|
|
2084
|
+
function normalizeDomainAST(domain, op = "&") {
|
|
2085
|
+
if (domain.type !== 4) {
|
|
2086
|
+
if (domain.type === 10) {
|
|
2087
|
+
const value = domain.value;
|
|
2088
|
+
if (value.findIndex((e) => e.type === 10) === -1 || !value.every((e) => e.type === 10 || e.type === 1)) {
|
|
2089
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2092
2090
|
}
|
|
2093
|
-
|
|
2094
|
-
throw new
|
|
2091
|
+
} else {
|
|
2092
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
if (domain.value.length === 0) {
|
|
2096
|
+
return domain;
|
|
2097
|
+
}
|
|
2098
|
+
let expected = 1;
|
|
2099
|
+
for (const child of domain.value) {
|
|
2100
|
+
switch (child.type) {
|
|
2101
|
+
case 1:
|
|
2102
|
+
if (child.value === "&" || child.value === "|") {
|
|
2103
|
+
expected++;
|
|
2104
|
+
} else if (child.value !== "!") {
|
|
2105
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2106
|
+
}
|
|
2107
|
+
break;
|
|
2108
|
+
case 4:
|
|
2109
|
+
/* list */
|
|
2110
|
+
case 10:
|
|
2111
|
+
if (child.value.length === 3) {
|
|
2112
|
+
expected--;
|
|
2113
|
+
break;
|
|
2114
|
+
}
|
|
2115
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2116
|
+
default:
|
|
2117
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
const values = domain.value.slice();
|
|
2121
|
+
while (expected < 0) {
|
|
2122
|
+
expected++;
|
|
2123
|
+
values.unshift({ type: 1, value: op });
|
|
2124
|
+
}
|
|
2125
|
+
if (expected > 0) {
|
|
2126
|
+
throw new InvalidDomainError(
|
|
2127
|
+
`invalid domain ${formatAST(domain)} (missing ${expected} segment(s))`
|
|
2128
|
+
);
|
|
2095
2129
|
}
|
|
2130
|
+
return { type: 4, value: values };
|
|
2096
2131
|
}
|
|
2097
|
-
function
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2132
|
+
function matchCondition(record, condition) {
|
|
2133
|
+
if (typeof condition === "boolean") {
|
|
2134
|
+
return condition;
|
|
2135
|
+
}
|
|
2136
|
+
const [field, operator, value] = condition;
|
|
2137
|
+
if (typeof field === "string") {
|
|
2138
|
+
const names = field.split(".");
|
|
2139
|
+
if (names.length >= 2) {
|
|
2140
|
+
return matchCondition(record[names[0]], [
|
|
2141
|
+
names.slice(1).join("."),
|
|
2142
|
+
operator,
|
|
2143
|
+
value
|
|
2144
|
+
]);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
let likeRegexp, ilikeRegexp;
|
|
2148
|
+
if (["like", "not like", "ilike", "not ilike"].includes(operator)) {
|
|
2149
|
+
likeRegexp = new RegExp(
|
|
2150
|
+
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2151
|
+
"g"
|
|
2152
|
+
);
|
|
2153
|
+
ilikeRegexp = new RegExp(
|
|
2154
|
+
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2155
|
+
"gi"
|
|
2156
|
+
);
|
|
2157
|
+
}
|
|
2158
|
+
const fieldValue = typeof field === "number" ? field : record[field];
|
|
2159
|
+
switch (operator) {
|
|
2160
|
+
case "=?":
|
|
2161
|
+
if ([false, null].includes(value)) {
|
|
2162
|
+
return true;
|
|
2112
2163
|
}
|
|
2113
|
-
|
|
2114
|
-
case
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
case 11:
|
|
2119
|
-
const pairs = [];
|
|
2120
|
-
for (const k in ast.value) {
|
|
2121
|
-
pairs.push(`"${k}": ${formatAST(ast.value[k])}`);
|
|
2164
|
+
// eslint-disable-next-line no-fallthrough
|
|
2165
|
+
case "=":
|
|
2166
|
+
case "==":
|
|
2167
|
+
if (Array.isArray(fieldValue) && Array.isArray(value)) {
|
|
2168
|
+
return shallowEqual2(fieldValue, value);
|
|
2122
2169
|
}
|
|
2123
|
-
return
|
|
2124
|
-
case
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
return
|
|
2133
|
-
case
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
return
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
|
|
2170
|
+
return fieldValue === value;
|
|
2171
|
+
case "!=":
|
|
2172
|
+
case "<>":
|
|
2173
|
+
return !matchCondition(record, [field, "==", value]);
|
|
2174
|
+
case "<":
|
|
2175
|
+
return fieldValue < value;
|
|
2176
|
+
case "<=":
|
|
2177
|
+
return fieldValue <= value;
|
|
2178
|
+
case ">":
|
|
2179
|
+
return fieldValue > value;
|
|
2180
|
+
case ">=":
|
|
2181
|
+
return fieldValue >= value;
|
|
2182
|
+
case "in": {
|
|
2183
|
+
const val = Array.isArray(value) ? value : [value];
|
|
2184
|
+
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2185
|
+
return fieldVal.some((fv) => val.includes(fv));
|
|
2186
|
+
}
|
|
2187
|
+
case "not in": {
|
|
2188
|
+
const val = Array.isArray(value) ? value : [value];
|
|
2189
|
+
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2190
|
+
return !fieldVal.some((fv) => val.includes(fv));
|
|
2191
|
+
}
|
|
2192
|
+
case "like":
|
|
2193
|
+
if (fieldValue === false) {
|
|
2194
|
+
return false;
|
|
2144
2195
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2196
|
+
return Boolean(fieldValue.match(likeRegexp));
|
|
2197
|
+
case "not like":
|
|
2198
|
+
if (fieldValue === false) {
|
|
2199
|
+
return false;
|
|
2200
|
+
}
|
|
2201
|
+
return Boolean(!fieldValue.match(likeRegexp));
|
|
2202
|
+
case "=like":
|
|
2203
|
+
if (fieldValue === false) {
|
|
2204
|
+
return false;
|
|
2205
|
+
}
|
|
2206
|
+
return new RegExp(escapeRegExp(value).replace(/%/g, ".*")).test(
|
|
2207
|
+
fieldValue
|
|
2208
|
+
);
|
|
2209
|
+
case "ilike":
|
|
2210
|
+
if (fieldValue === false) {
|
|
2211
|
+
return false;
|
|
2212
|
+
}
|
|
2213
|
+
return Boolean(fieldValue.match(ilikeRegexp));
|
|
2214
|
+
case "not ilike":
|
|
2215
|
+
if (fieldValue === false) {
|
|
2216
|
+
return false;
|
|
2217
|
+
}
|
|
2218
|
+
return Boolean(!fieldValue.match(ilikeRegexp));
|
|
2219
|
+
case "=ilike":
|
|
2220
|
+
if (fieldValue === false) {
|
|
2221
|
+
return false;
|
|
2222
|
+
}
|
|
2223
|
+
return new RegExp(escapeRegExp(value).replace(/%/g, ".*"), "i").test(
|
|
2224
|
+
fieldValue
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
throw new InvalidDomainError("could not match domain");
|
|
2228
|
+
}
|
|
2229
|
+
function makeOperators(record) {
|
|
2230
|
+
const match = matchCondition.bind(null, record);
|
|
2231
|
+
return {
|
|
2232
|
+
"!": (x) => !match(x),
|
|
2233
|
+
"&": (a, b) => match(a) && match(b),
|
|
2234
|
+
"|": (a, b) => match(a) || match(b)
|
|
2235
|
+
};
|
|
2236
|
+
}
|
|
2237
|
+
function matchDomain(record, domain) {
|
|
2238
|
+
if (domain.length === 0) {
|
|
2239
|
+
return true;
|
|
2240
|
+
}
|
|
2241
|
+
const operators = makeOperators(record);
|
|
2242
|
+
const reversedDomain = Array.from(domain).reverse();
|
|
2243
|
+
const condStack = [];
|
|
2244
|
+
for (const item of reversedDomain) {
|
|
2245
|
+
const operator = typeof item === "string" && operators[item];
|
|
2246
|
+
if (operator) {
|
|
2247
|
+
const operands = condStack.splice(-operator.length);
|
|
2248
|
+
condStack.push(operator(...operands));
|
|
2249
|
+
} else {
|
|
2250
|
+
condStack.push(item);
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
return matchCondition(record, condStack.pop());
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
// src/utils/function.ts
|
|
2257
|
+
var import_react = require("react");
|
|
2258
|
+
var toQueryString = (params) => {
|
|
2259
|
+
return Object.keys(params).map(
|
|
2260
|
+
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
|
2261
|
+
).join("&");
|
|
2262
|
+
};
|
|
2263
|
+
var isBase64File = (str) => {
|
|
2264
|
+
try {
|
|
2265
|
+
const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
|
|
2266
|
+
if (dataUriPattern.test(str)) {
|
|
2267
|
+
return true;
|
|
2268
|
+
}
|
|
2269
|
+
const base64Pattern = (
|
|
2270
|
+
// eslint-disable-next-line no-useless-escape
|
|
2271
|
+
/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)?$/
|
|
2272
|
+
);
|
|
2273
|
+
return base64Pattern.test(str);
|
|
2274
|
+
} catch (e) {
|
|
2275
|
+
return false;
|
|
2149
2276
|
}
|
|
2150
|
-
}
|
|
2151
|
-
var
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2277
|
+
};
|
|
2278
|
+
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2279
|
+
if (!originalRequest.data) return originalRequest.data;
|
|
2280
|
+
if (typeof originalRequest.data === "string") {
|
|
2281
|
+
try {
|
|
2282
|
+
const parsedData = JSON.parse(originalRequest.data);
|
|
2283
|
+
if (parsedData.with_context && typeof parsedData.with_context === "object") {
|
|
2284
|
+
parsedData.with_context.token = newAccessToken;
|
|
2285
|
+
}
|
|
2286
|
+
return JSON.stringify(parsedData);
|
|
2287
|
+
} catch (e) {
|
|
2288
|
+
console.warn("Failed to parse originalRequest.data", e);
|
|
2289
|
+
return originalRequest.data;
|
|
2156
2290
|
}
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
// src/utils/domain/py_interpreter.ts
|
|
2161
|
-
var isTrue = BUILTINS.bool;
|
|
2162
|
-
function applyUnaryOp(ast, context) {
|
|
2163
|
-
const value = evaluate(ast.right, context);
|
|
2164
|
-
switch (ast.op) {
|
|
2165
|
-
case "-":
|
|
2166
|
-
if (value instanceof Object && "negate" in value) {
|
|
2167
|
-
return value.negate();
|
|
2168
|
-
}
|
|
2169
|
-
return -value;
|
|
2170
|
-
case "+":
|
|
2171
|
-
return value;
|
|
2172
|
-
case "not":
|
|
2173
|
-
return !isTrue(value);
|
|
2174
|
-
default:
|
|
2175
|
-
throw new EvaluationError(`Unknown unary operator: ${ast.op}`);
|
|
2176
2291
|
}
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
switch (typeof val) {
|
|
2180
|
-
case "object":
|
|
2181
|
-
return val === null ? 1 : Array.isArray(val) ? 5 : 3;
|
|
2182
|
-
case "number":
|
|
2183
|
-
return 2;
|
|
2184
|
-
case "string":
|
|
2185
|
-
return 4;
|
|
2186
|
-
default:
|
|
2187
|
-
throw new EvaluationError(`Unknown type: ${typeof val}`);
|
|
2292
|
+
if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
|
|
2293
|
+
originalRequest.data.with_context.token = newAccessToken;
|
|
2188
2294
|
}
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2295
|
+
return originalRequest.data;
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2298
|
+
// src/utils/storage/local-storage.ts
|
|
2299
|
+
var localStorageUtils = () => {
|
|
2300
|
+
const setToken = async (access_token) => {
|
|
2301
|
+
localStorage.setItem("accessToken", access_token);
|
|
2302
|
+
};
|
|
2303
|
+
const setRefreshToken = async (refresh_token) => {
|
|
2304
|
+
localStorage.setItem("refreshToken", refresh_token);
|
|
2305
|
+
};
|
|
2306
|
+
const getAccessToken = async () => {
|
|
2307
|
+
return localStorage.getItem("accessToken");
|
|
2308
|
+
};
|
|
2309
|
+
const getRefreshToken = async () => {
|
|
2310
|
+
return localStorage.getItem("refreshToken");
|
|
2311
|
+
};
|
|
2312
|
+
const clearToken = async () => {
|
|
2313
|
+
localStorage.removeItem("accessToken");
|
|
2314
|
+
localStorage.removeItem("refreshToken");
|
|
2315
|
+
};
|
|
2316
|
+
return {
|
|
2317
|
+
setToken,
|
|
2318
|
+
setRefreshToken,
|
|
2319
|
+
getAccessToken,
|
|
2320
|
+
getRefreshToken,
|
|
2321
|
+
clearToken
|
|
2322
|
+
};
|
|
2323
|
+
};
|
|
2324
|
+
|
|
2325
|
+
// src/utils/storage/session-storage.ts
|
|
2326
|
+
var sessionStorageUtils = () => {
|
|
2327
|
+
const getBrowserSession = async () => {
|
|
2328
|
+
return sessionStorage.getItem("browserSession");
|
|
2329
|
+
};
|
|
2330
|
+
return {
|
|
2331
|
+
getBrowserSession
|
|
2332
|
+
};
|
|
2333
|
+
};
|
|
2334
|
+
|
|
2335
|
+
// src/configs/axios-client.ts
|
|
2336
|
+
var axiosClient = {
|
|
2337
|
+
init(config) {
|
|
2338
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2339
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2340
|
+
const db = config.db;
|
|
2341
|
+
let isRefreshing = false;
|
|
2342
|
+
let failedQueue = [];
|
|
2343
|
+
const processQueue = (error, token = null) => {
|
|
2344
|
+
failedQueue?.forEach((prom) => {
|
|
2345
|
+
if (error) {
|
|
2346
|
+
prom.reject(error);
|
|
2347
|
+
} else {
|
|
2348
|
+
prom.resolve(token);
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
failedQueue = [];
|
|
2352
|
+
};
|
|
2353
|
+
const instance = import_axios.default.create({
|
|
2354
|
+
adapter: import_axios.default.defaults.adapter,
|
|
2355
|
+
baseURL: config.baseUrl,
|
|
2356
|
+
timeout: 5e4,
|
|
2357
|
+
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2358
|
+
});
|
|
2359
|
+
instance.interceptors.request.use(
|
|
2360
|
+
async (config2) => {
|
|
2361
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2362
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2363
|
+
if (token) {
|
|
2364
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2365
|
+
}
|
|
2366
|
+
return config2;
|
|
2367
|
+
},
|
|
2368
|
+
(error) => {
|
|
2369
|
+
Promise.reject(error);
|
|
2370
|
+
}
|
|
2371
|
+
);
|
|
2372
|
+
instance.interceptors.response.use(
|
|
2373
|
+
(response) => {
|
|
2374
|
+
return handleResponse(response);
|
|
2375
|
+
},
|
|
2376
|
+
async (error) => {
|
|
2377
|
+
const handleError3 = async (error2) => {
|
|
2378
|
+
if (!error2.response) {
|
|
2379
|
+
return error2;
|
|
2380
|
+
}
|
|
2381
|
+
const { data } = error2.response;
|
|
2382
|
+
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
2383
|
+
await clearAuthToken();
|
|
2384
|
+
}
|
|
2385
|
+
return data;
|
|
2386
|
+
};
|
|
2387
|
+
const originalRequest = error.config;
|
|
2388
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2389
|
+
error.response.data.code
|
|
2390
|
+
)) {
|
|
2391
|
+
if (isRefreshing) {
|
|
2392
|
+
return new Promise(function(resolve, reject) {
|
|
2393
|
+
failedQueue.push({ resolve, reject });
|
|
2394
|
+
}).then((token) => {
|
|
2395
|
+
originalRequest.headers["Authorization"] = "Bearer " + token;
|
|
2396
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2397
|
+
originalRequest,
|
|
2398
|
+
token
|
|
2399
|
+
);
|
|
2400
|
+
return instance.request(originalRequest);
|
|
2401
|
+
}).catch(async (err) => {
|
|
2402
|
+
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2403
|
+
await clearAuthToken();
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
const browserSession = await sessionStorage2.getBrowserSession();
|
|
2408
|
+
const refreshToken = await localStorage2.getRefreshToken();
|
|
2409
|
+
const accessTokenExp = await localStorage2.getAccessToken();
|
|
2410
|
+
isRefreshing = true;
|
|
2411
|
+
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2412
|
+
await clearAuthToken();
|
|
2413
|
+
} else {
|
|
2414
|
+
const payload = Object.fromEntries(
|
|
2415
|
+
Object.entries({
|
|
2416
|
+
refresh_token: refreshToken,
|
|
2417
|
+
grant_type: "refresh_token",
|
|
2418
|
+
client_id: config.config.clientId,
|
|
2419
|
+
client_secret: config.config.clientSecret
|
|
2420
|
+
}).filter(([_, value]) => !!value)
|
|
2421
|
+
);
|
|
2422
|
+
return new Promise(function(resolve) {
|
|
2423
|
+
import_axios.default.post(
|
|
2424
|
+
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2425
|
+
payload,
|
|
2426
|
+
{
|
|
2427
|
+
headers: {
|
|
2428
|
+
"Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
|
|
2429
|
+
Authorization: `Bearer ${accessTokenExp}`
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
).then(async (res) => {
|
|
2433
|
+
const data = res.data;
|
|
2434
|
+
await localStorage2.setToken(data.access_token);
|
|
2435
|
+
await localStorage2.setRefreshToken(data.refresh_token);
|
|
2436
|
+
import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2437
|
+
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2438
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2439
|
+
originalRequest,
|
|
2440
|
+
data.access_token
|
|
2441
|
+
);
|
|
2442
|
+
processQueue(null, data.access_token);
|
|
2443
|
+
resolve(instance.request(originalRequest));
|
|
2444
|
+
}).catch(async (err) => {
|
|
2445
|
+
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") {
|
|
2446
|
+
await clearAuthToken();
|
|
2447
|
+
}
|
|
2448
|
+
if (err && err.response) {
|
|
2449
|
+
const { error_code } = err.response?.data || {};
|
|
2450
|
+
if (error_code === "AUTHEN_FAIL") {
|
|
2451
|
+
await clearAuthToken();
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
processQueue(err, null);
|
|
2455
|
+
}).finally(() => {
|
|
2456
|
+
isRefreshing = false;
|
|
2457
|
+
});
|
|
2458
|
+
});
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
return Promise.reject(await handleError3(error));
|
|
2462
|
+
}
|
|
2463
|
+
);
|
|
2464
|
+
const handleResponse = (res) => {
|
|
2465
|
+
if (res && res.data) {
|
|
2466
|
+
return res.data;
|
|
2467
|
+
}
|
|
2468
|
+
return res;
|
|
2469
|
+
};
|
|
2470
|
+
const handleError2 = (error) => {
|
|
2471
|
+
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2472
|
+
console.error("Request Timeout Error:", error);
|
|
2473
|
+
return "Request Timeout Error";
|
|
2474
|
+
} else if (error.isAxiosError && !error.response) {
|
|
2475
|
+
console.error("Network Error:", error);
|
|
2476
|
+
return "Network Error";
|
|
2477
|
+
} else {
|
|
2478
|
+
console.error("Other Error:", error?.response);
|
|
2479
|
+
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
2480
|
+
return { message: errorMessage, status: error?.response?.status };
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
const clearAuthToken = async () => {
|
|
2484
|
+
await localStorage2.clearToken();
|
|
2485
|
+
if (typeof window !== "undefined") {
|
|
2486
|
+
window.location.href = `/login`;
|
|
2487
|
+
}
|
|
2488
|
+
};
|
|
2489
|
+
function formatUrl(url, db2) {
|
|
2490
|
+
return url + (db2 ? "?db=" + db2 : "");
|
|
2491
|
+
}
|
|
2492
|
+
const responseBody = (response) => response;
|
|
2493
|
+
const requests = {
|
|
2494
|
+
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
2495
|
+
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
2496
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
2497
|
+
responseType: "arraybuffer",
|
|
2498
|
+
headers: {
|
|
2499
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2500
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2501
|
+
}
|
|
2502
|
+
}).then(responseBody),
|
|
2503
|
+
put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
|
|
2504
|
+
patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
|
|
2505
|
+
delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
|
|
2506
|
+
};
|
|
2507
|
+
return requests;
|
|
2193
2508
|
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2509
|
+
};
|
|
2510
|
+
|
|
2511
|
+
// src/store/index.ts
|
|
2512
|
+
var import_react_redux = require("react-redux");
|
|
2513
|
+
|
|
2514
|
+
// src/store/reducers/breadcrums-slice/index.ts
|
|
2515
|
+
var import_toolkit = require("@reduxjs/toolkit");
|
|
2516
|
+
var initialState = {
|
|
2517
|
+
breadCrumbs: []
|
|
2518
|
+
};
|
|
2519
|
+
var breadcrumbsSlice = (0, import_toolkit.createSlice)({
|
|
2520
|
+
name: "breadcrumbs",
|
|
2521
|
+
initialState,
|
|
2522
|
+
reducers: {
|
|
2523
|
+
setBreadCrumbs: (state, action) => {
|
|
2524
|
+
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
2525
|
+
}
|
|
2196
2526
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2527
|
+
});
|
|
2528
|
+
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
2529
|
+
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
2530
|
+
|
|
2531
|
+
// src/store/reducers/env-slice/index.ts
|
|
2532
|
+
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
2533
|
+
var initialState2 = {
|
|
2534
|
+
baseUrl: "",
|
|
2535
|
+
requests: null,
|
|
2536
|
+
companies: [],
|
|
2537
|
+
user: {},
|
|
2538
|
+
config: null,
|
|
2539
|
+
envFile: null,
|
|
2540
|
+
defaultCompany: {
|
|
2541
|
+
id: null,
|
|
2542
|
+
logo: "",
|
|
2543
|
+
secondary_color: "",
|
|
2544
|
+
primary_color: ""
|
|
2545
|
+
},
|
|
2546
|
+
context: {
|
|
2547
|
+
uid: null,
|
|
2548
|
+
allowed_company_ids: [],
|
|
2549
|
+
lang: "vi_VN",
|
|
2550
|
+
tz: "Asia/Saigon"
|
|
2199
2551
|
}
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2552
|
+
};
|
|
2553
|
+
var envSlice = (0, import_toolkit2.createSlice)({
|
|
2554
|
+
name: "env",
|
|
2555
|
+
initialState: initialState2,
|
|
2556
|
+
reducers: {
|
|
2557
|
+
setEnv: (state, action) => {
|
|
2558
|
+
Object.assign(state, action.payload);
|
|
2559
|
+
},
|
|
2560
|
+
setUid: (state, action) => {
|
|
2561
|
+
state.context.uid = action.payload;
|
|
2562
|
+
},
|
|
2563
|
+
setAllowCompanies: (state, action) => {
|
|
2564
|
+
state.context.allowed_company_ids = action.payload;
|
|
2565
|
+
},
|
|
2566
|
+
setCompanies: (state, action) => {
|
|
2567
|
+
state.companies = action.payload;
|
|
2568
|
+
},
|
|
2569
|
+
setDefaultCompany: (state, action) => {
|
|
2570
|
+
state.defaultCompany = action.payload;
|
|
2571
|
+
},
|
|
2572
|
+
setLang: (state, action) => {
|
|
2573
|
+
state.context.lang = action.payload;
|
|
2574
|
+
},
|
|
2575
|
+
setUser: (state, action) => {
|
|
2576
|
+
state.user = action.payload;
|
|
2577
|
+
},
|
|
2578
|
+
setConfig: (state, action) => {
|
|
2579
|
+
state.config = action.payload;
|
|
2580
|
+
},
|
|
2581
|
+
setEnvFile: (state, action) => {
|
|
2582
|
+
state.envFile = action.payload;
|
|
2583
|
+
}
|
|
2204
2584
|
}
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2585
|
+
});
|
|
2586
|
+
var {
|
|
2587
|
+
setEnv,
|
|
2588
|
+
setUid,
|
|
2589
|
+
setLang,
|
|
2590
|
+
setAllowCompanies,
|
|
2591
|
+
setCompanies,
|
|
2592
|
+
setDefaultCompany,
|
|
2593
|
+
setUser,
|
|
2594
|
+
setConfig,
|
|
2595
|
+
setEnvFile
|
|
2596
|
+
} = envSlice.actions;
|
|
2597
|
+
var env_slice_default = envSlice.reducer;
|
|
2598
|
+
|
|
2599
|
+
// src/store/reducers/excel-slice/index.ts
|
|
2600
|
+
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
2601
|
+
var initialState3 = {
|
|
2602
|
+
dataParse: null,
|
|
2603
|
+
idFile: null,
|
|
2604
|
+
isFileLoaded: false,
|
|
2605
|
+
loadingImport: false,
|
|
2606
|
+
selectedFile: null,
|
|
2607
|
+
errorData: null
|
|
2608
|
+
};
|
|
2609
|
+
var excelSlice = (0, import_toolkit3.createSlice)({
|
|
2610
|
+
name: "excel",
|
|
2611
|
+
initialState: initialState3,
|
|
2612
|
+
reducers: {
|
|
2613
|
+
setDataParse: (state, action) => {
|
|
2614
|
+
state.dataParse = action.payload;
|
|
2615
|
+
},
|
|
2616
|
+
setIdFile: (state, action) => {
|
|
2617
|
+
state.idFile = action.payload;
|
|
2618
|
+
},
|
|
2619
|
+
setIsFileLoaded: (state, action) => {
|
|
2620
|
+
state.isFileLoaded = action.payload;
|
|
2621
|
+
},
|
|
2622
|
+
setLoadingImport: (state, action) => {
|
|
2623
|
+
state.loadingImport = action.payload;
|
|
2624
|
+
},
|
|
2625
|
+
setSelectedFile: (state, action) => {
|
|
2626
|
+
state.selectedFile = action.payload;
|
|
2627
|
+
},
|
|
2628
|
+
setErrorData: (state, action) => {
|
|
2629
|
+
state.errorData = action.payload;
|
|
2211
2630
|
}
|
|
2212
|
-
|
|
2213
|
-
|
|
2631
|
+
}
|
|
2632
|
+
});
|
|
2633
|
+
var {
|
|
2634
|
+
setDataParse,
|
|
2635
|
+
setIdFile,
|
|
2636
|
+
setIsFileLoaded,
|
|
2637
|
+
setLoadingImport,
|
|
2638
|
+
setSelectedFile,
|
|
2639
|
+
setErrorData
|
|
2640
|
+
} = excelSlice.actions;
|
|
2641
|
+
var excel_slice_default = excelSlice.reducer;
|
|
2642
|
+
|
|
2643
|
+
// src/store/reducers/form-slice/index.ts
|
|
2644
|
+
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
2645
|
+
var initialState4 = {
|
|
2646
|
+
viewDataStore: {},
|
|
2647
|
+
isShowingModalDetail: false,
|
|
2648
|
+
isShowModalTranslate: false,
|
|
2649
|
+
formSubmitComponent: {},
|
|
2650
|
+
fieldTranslation: null,
|
|
2651
|
+
listSubject: {},
|
|
2652
|
+
dataUser: {}
|
|
2653
|
+
};
|
|
2654
|
+
var formSlice = (0, import_toolkit4.createSlice)({
|
|
2655
|
+
name: "form",
|
|
2656
|
+
initialState: initialState4,
|
|
2657
|
+
reducers: {
|
|
2658
|
+
setViewDataStore: (state, action) => {
|
|
2659
|
+
state.viewDataStore = action.payload;
|
|
2660
|
+
},
|
|
2661
|
+
setIsShowingModalDetail: (state, action) => {
|
|
2662
|
+
state.isShowingModalDetail = action.payload;
|
|
2663
|
+
},
|
|
2664
|
+
setIsShowModalTranslate: (state, action) => {
|
|
2665
|
+
state.isShowModalTranslate = action.payload;
|
|
2666
|
+
},
|
|
2667
|
+
setFormSubmitComponent: (state, action) => {
|
|
2668
|
+
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
2669
|
+
},
|
|
2670
|
+
setFieldTranslate: (state, action) => {
|
|
2671
|
+
state.fieldTranslation = action.payload;
|
|
2672
|
+
},
|
|
2673
|
+
setListSubject: (state, action) => {
|
|
2674
|
+
state.listSubject = action.payload;
|
|
2675
|
+
},
|
|
2676
|
+
setDataUser: (state, action) => {
|
|
2677
|
+
state.dataUser = action.payload;
|
|
2214
2678
|
}
|
|
2215
|
-
return false;
|
|
2216
|
-
}
|
|
2217
|
-
if (left instanceof Object && "isEqual" in left) {
|
|
2218
|
-
return left.isEqual(right);
|
|
2219
|
-
}
|
|
2220
|
-
return left === right;
|
|
2221
|
-
}
|
|
2222
|
-
function isIn(left, right) {
|
|
2223
|
-
if (Array.isArray(right)) {
|
|
2224
|
-
return right.includes(left);
|
|
2225
|
-
}
|
|
2226
|
-
if (typeof right === "string" && typeof left === "string") {
|
|
2227
|
-
return right.includes(left);
|
|
2228
|
-
}
|
|
2229
|
-
if (typeof right === "object") {
|
|
2230
|
-
return left in right;
|
|
2231
2679
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
}
|
|
2258
|
-
if (timeDeltaOnRight) {
|
|
2259
|
-
if (left instanceof PyDate || left instanceof PyDateTime) {
|
|
2260
|
-
return left.add(right);
|
|
2261
|
-
} else {
|
|
2262
|
-
throw new NotSupportedError();
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
if (left instanceof Array && right instanceof Array) {
|
|
2266
|
-
return [...left, ...right];
|
|
2267
|
-
}
|
|
2268
|
-
return left + right;
|
|
2269
|
-
}
|
|
2270
|
-
case "-": {
|
|
2271
|
-
const isRightDelta = right instanceof PyRelativeDelta;
|
|
2272
|
-
if (isRightDelta) {
|
|
2273
|
-
return PyRelativeDelta.substract(left, right);
|
|
2274
|
-
}
|
|
2275
|
-
const timeDeltaOnRight = right instanceof PyTimeDelta;
|
|
2276
|
-
if (timeDeltaOnRight) {
|
|
2277
|
-
if (left instanceof PyTimeDelta) {
|
|
2278
|
-
return left.substract(right);
|
|
2279
|
-
} else if (left instanceof PyDate || left instanceof PyDateTime) {
|
|
2280
|
-
return left.substract(right);
|
|
2281
|
-
} else {
|
|
2282
|
-
throw new NotSupportedError();
|
|
2283
|
-
}
|
|
2284
|
-
}
|
|
2285
|
-
if (left instanceof PyDate) {
|
|
2286
|
-
return left.substract(right);
|
|
2287
|
-
}
|
|
2288
|
-
return left - right;
|
|
2680
|
+
});
|
|
2681
|
+
var {
|
|
2682
|
+
setViewDataStore,
|
|
2683
|
+
setIsShowingModalDetail,
|
|
2684
|
+
setIsShowModalTranslate,
|
|
2685
|
+
setFormSubmitComponent,
|
|
2686
|
+
setFieldTranslate,
|
|
2687
|
+
setListSubject,
|
|
2688
|
+
setDataUser
|
|
2689
|
+
} = formSlice.actions;
|
|
2690
|
+
var form_slice_default = formSlice.reducer;
|
|
2691
|
+
|
|
2692
|
+
// src/store/reducers/header-slice/index.ts
|
|
2693
|
+
var import_toolkit5 = require("@reduxjs/toolkit");
|
|
2694
|
+
var headerSlice = (0, import_toolkit5.createSlice)({
|
|
2695
|
+
name: "header",
|
|
2696
|
+
initialState: {
|
|
2697
|
+
value: { allowedCompanyIds: [] }
|
|
2698
|
+
},
|
|
2699
|
+
reducers: {
|
|
2700
|
+
setHeader: (state, action) => {
|
|
2701
|
+
state.value = { ...state.value, ...action.payload };
|
|
2702
|
+
},
|
|
2703
|
+
setAllowedCompanyIds: (state, action) => {
|
|
2704
|
+
state.value.allowedCompanyIds = action.payload;
|
|
2289
2705
|
}
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2706
|
+
}
|
|
2707
|
+
});
|
|
2708
|
+
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
2709
|
+
var header_slice_default = headerSlice.reducer;
|
|
2710
|
+
|
|
2711
|
+
// src/store/reducers/list-slice/index.ts
|
|
2712
|
+
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
2713
|
+
var initialState5 = {
|
|
2714
|
+
pageLimit: 10,
|
|
2715
|
+
fields: {},
|
|
2716
|
+
order: "",
|
|
2717
|
+
selectedRowKeys: [],
|
|
2718
|
+
selectedRadioKey: 0,
|
|
2719
|
+
indexRowTableModal: -2,
|
|
2720
|
+
isUpdateTableModal: false,
|
|
2721
|
+
footerGroupTable: {},
|
|
2722
|
+
transferDetail: null,
|
|
2723
|
+
page: 0,
|
|
2724
|
+
domainTable: []
|
|
2725
|
+
};
|
|
2726
|
+
var listSlice = (0, import_toolkit6.createSlice)({
|
|
2727
|
+
name: "list",
|
|
2728
|
+
initialState: initialState5,
|
|
2729
|
+
reducers: {
|
|
2730
|
+
setPageLimit: (state, action) => {
|
|
2731
|
+
state.pageLimit = action.payload;
|
|
2732
|
+
},
|
|
2733
|
+
setFields: (state, action) => {
|
|
2734
|
+
state.fields = action.payload;
|
|
2735
|
+
},
|
|
2736
|
+
setOrder: (state, action) => {
|
|
2737
|
+
state.order = action.payload;
|
|
2738
|
+
},
|
|
2739
|
+
setSelectedRowKeys: (state, action) => {
|
|
2740
|
+
state.selectedRowKeys = action.payload;
|
|
2741
|
+
},
|
|
2742
|
+
setSelectedRadioKey: (state, action) => {
|
|
2743
|
+
state.selectedRadioKey = action.payload;
|
|
2744
|
+
},
|
|
2745
|
+
setIndexRowTableModal: (state, action) => {
|
|
2746
|
+
state.indexRowTableModal = action.payload;
|
|
2747
|
+
},
|
|
2748
|
+
setTransferDetail: (state, action) => {
|
|
2749
|
+
state.transferDetail = action.payload;
|
|
2750
|
+
},
|
|
2751
|
+
setIsUpdateTableModal: (state, action) => {
|
|
2752
|
+
state.isUpdateTableModal = action.payload;
|
|
2753
|
+
},
|
|
2754
|
+
setPage: (state, action) => {
|
|
2755
|
+
state.page = action.payload;
|
|
2756
|
+
},
|
|
2757
|
+
setDomainTable: (state, action) => {
|
|
2758
|
+
state.domainTable = action.payload;
|
|
2299
2759
|
}
|
|
2300
|
-
case "/":
|
|
2301
|
-
return left / right;
|
|
2302
|
-
case "%":
|
|
2303
|
-
return left % right;
|
|
2304
|
-
case "//":
|
|
2305
|
-
if (left instanceof PyTimeDelta) {
|
|
2306
|
-
return left.divide(right);
|
|
2307
|
-
}
|
|
2308
|
-
return Math.floor(left / right);
|
|
2309
|
-
case "**":
|
|
2310
|
-
return left ** right;
|
|
2311
|
-
case "==":
|
|
2312
|
-
return isEqual(left, right);
|
|
2313
|
-
case "<>":
|
|
2314
|
-
case "!=":
|
|
2315
|
-
return !isEqual(left, right);
|
|
2316
|
-
case "<":
|
|
2317
|
-
return isLess(left, right);
|
|
2318
|
-
case ">":
|
|
2319
|
-
return isLess(right, left);
|
|
2320
|
-
case ">=":
|
|
2321
|
-
return isEqual(left, right) || isLess(right, left);
|
|
2322
|
-
case "<=":
|
|
2323
|
-
return isEqual(left, right) || isLess(left, right);
|
|
2324
|
-
case "in":
|
|
2325
|
-
return isIn(left, right);
|
|
2326
|
-
case "not in":
|
|
2327
|
-
return !isIn(left, right);
|
|
2328
|
-
default:
|
|
2329
|
-
throw new EvaluationError(`Unknown binary operator: ${ast.op}`);
|
|
2330
2760
|
}
|
|
2331
|
-
}
|
|
2332
|
-
var
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2761
|
+
});
|
|
2762
|
+
var {
|
|
2763
|
+
setPageLimit,
|
|
2764
|
+
setFields,
|
|
2765
|
+
setOrder,
|
|
2766
|
+
setSelectedRowKeys,
|
|
2767
|
+
setIndexRowTableModal,
|
|
2768
|
+
setIsUpdateTableModal,
|
|
2769
|
+
setPage,
|
|
2770
|
+
setSelectedRadioKey,
|
|
2771
|
+
setTransferDetail,
|
|
2772
|
+
setDomainTable
|
|
2773
|
+
} = listSlice.actions;
|
|
2774
|
+
var list_slice_default = listSlice.reducer;
|
|
2775
|
+
|
|
2776
|
+
// src/store/reducers/login-slice/index.ts
|
|
2777
|
+
var import_toolkit7 = require("@reduxjs/toolkit");
|
|
2778
|
+
var initialState6 = {
|
|
2779
|
+
db: "",
|
|
2780
|
+
redirectTo: "/",
|
|
2781
|
+
forgotPasswordUrl: "/"
|
|
2782
|
+
};
|
|
2783
|
+
var loginSlice = (0, import_toolkit7.createSlice)({
|
|
2784
|
+
name: "login",
|
|
2785
|
+
initialState: initialState6,
|
|
2786
|
+
reducers: {
|
|
2787
|
+
setDb: (state, action) => {
|
|
2788
|
+
state.db = action.payload;
|
|
2789
|
+
},
|
|
2790
|
+
setRedirectTo: (state, action) => {
|
|
2791
|
+
state.redirectTo = action.payload;
|
|
2792
|
+
},
|
|
2793
|
+
setForgotPasswordUrl: (state, action) => {
|
|
2794
|
+
state.forgotPasswordUrl = action.payload;
|
|
2340
2795
|
}
|
|
2341
|
-
return null;
|
|
2342
2796
|
}
|
|
2797
|
+
});
|
|
2798
|
+
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
2799
|
+
var login_slice_default = loginSlice.reducer;
|
|
2800
|
+
|
|
2801
|
+
// src/store/reducers/navbar-slice/index.ts
|
|
2802
|
+
var import_toolkit8 = require("@reduxjs/toolkit");
|
|
2803
|
+
var initialState7 = {
|
|
2804
|
+
menuFocus: {},
|
|
2805
|
+
menuAction: {},
|
|
2806
|
+
navbarWidth: 250,
|
|
2807
|
+
menuList: []
|
|
2343
2808
|
};
|
|
2344
|
-
var
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2809
|
+
var navbarSlice = (0, import_toolkit8.createSlice)({
|
|
2810
|
+
name: "navbar",
|
|
2811
|
+
initialState: initialState7,
|
|
2812
|
+
reducers: {
|
|
2813
|
+
setMenuFocus: (state, action) => {
|
|
2814
|
+
state.menuFocus = action.payload;
|
|
2815
|
+
},
|
|
2816
|
+
setMenuFocusAction: (state, action) => {
|
|
2817
|
+
state.menuAction = action.payload;
|
|
2818
|
+
},
|
|
2819
|
+
setNavbarWidth: (state, action) => {
|
|
2820
|
+
state.navbarWidth = action.payload;
|
|
2821
|
+
},
|
|
2822
|
+
setMenuList: (state, action) => {
|
|
2823
|
+
state.menuList = action.payload;
|
|
2824
|
+
}
|
|
2350
2825
|
}
|
|
2826
|
+
});
|
|
2827
|
+
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
2828
|
+
var navbar_slice_default = navbarSlice.reducer;
|
|
2829
|
+
|
|
2830
|
+
// src/store/reducers/profile-slice/index.ts
|
|
2831
|
+
var import_toolkit9 = require("@reduxjs/toolkit");
|
|
2832
|
+
var initialState8 = {
|
|
2833
|
+
profile: {}
|
|
2351
2834
|
};
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
);
|
|
2360
|
-
}
|
|
2361
|
-
return execOnIterable(args[0], func);
|
|
2362
|
-
}
|
|
2363
|
-
var SET = {
|
|
2364
|
-
intersection(...args) {
|
|
2365
|
-
return applyFunc(
|
|
2366
|
-
"intersection",
|
|
2367
|
-
(iterable) => {
|
|
2368
|
-
const intersection = /* @__PURE__ */ new Set();
|
|
2369
|
-
for (const i of iterable) {
|
|
2370
|
-
if (this.has(i)) {
|
|
2371
|
-
intersection.add(i);
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
return intersection;
|
|
2375
|
-
},
|
|
2376
|
-
this,
|
|
2377
|
-
...args
|
|
2378
|
-
);
|
|
2379
|
-
},
|
|
2380
|
-
difference(...args) {
|
|
2381
|
-
return applyFunc(
|
|
2382
|
-
"difference",
|
|
2383
|
-
(iterable) => {
|
|
2384
|
-
iterable = new Set(iterable);
|
|
2385
|
-
const difference = /* @__PURE__ */ new Set();
|
|
2386
|
-
for (const e of this) {
|
|
2387
|
-
if (!iterable.has(e)) {
|
|
2388
|
-
difference.add(e);
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
return difference;
|
|
2392
|
-
},
|
|
2393
|
-
this,
|
|
2394
|
-
...args
|
|
2395
|
-
);
|
|
2396
|
-
},
|
|
2397
|
-
union(...args) {
|
|
2398
|
-
return applyFunc(
|
|
2399
|
-
"union",
|
|
2400
|
-
(iterable) => {
|
|
2401
|
-
return /* @__PURE__ */ new Set([...this, ...iterable]);
|
|
2402
|
-
},
|
|
2403
|
-
this,
|
|
2404
|
-
...args
|
|
2405
|
-
);
|
|
2835
|
+
var profileSlice = (0, import_toolkit9.createSlice)({
|
|
2836
|
+
name: "profile",
|
|
2837
|
+
initialState: initialState8,
|
|
2838
|
+
reducers: {
|
|
2839
|
+
setProfile: (state, action) => {
|
|
2840
|
+
state.profile = action.payload;
|
|
2841
|
+
}
|
|
2406
2842
|
}
|
|
2843
|
+
});
|
|
2844
|
+
var { setProfile } = profileSlice.actions;
|
|
2845
|
+
var profile_slice_default = profileSlice.reducer;
|
|
2846
|
+
|
|
2847
|
+
// src/store/reducers/search-slice/index.ts
|
|
2848
|
+
var import_toolkit10 = require("@reduxjs/toolkit");
|
|
2849
|
+
var initialState9 = {
|
|
2850
|
+
groupByDomain: null,
|
|
2851
|
+
searchBy: [],
|
|
2852
|
+
searchString: "",
|
|
2853
|
+
hoveredIndexSearchList: null,
|
|
2854
|
+
selectedTags: [],
|
|
2855
|
+
firstDomain: null,
|
|
2856
|
+
searchMap: {},
|
|
2857
|
+
filterBy: [],
|
|
2858
|
+
groupBy: []
|
|
2407
2859
|
};
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
return evalContext[ast2.value] ?? false;
|
|
2454
|
-
} else if (ast2.value in BUILTINS) {
|
|
2455
|
-
return BUILTINS[ast2.value];
|
|
2456
|
-
} else {
|
|
2457
|
-
return false;
|
|
2458
|
-
}
|
|
2459
|
-
case 3:
|
|
2460
|
-
return null;
|
|
2461
|
-
case 2:
|
|
2462
|
-
return ast2.value;
|
|
2463
|
-
case 6:
|
|
2464
|
-
return applyUnaryOp(ast2, evalContext);
|
|
2465
|
-
case 7:
|
|
2466
|
-
return applyBinaryOp(ast2, evalContext);
|
|
2467
|
-
case 14:
|
|
2468
|
-
const left = _evaluate(ast2.left);
|
|
2469
|
-
if (ast2.op === "and") {
|
|
2470
|
-
return isTrue(left) ? _evaluate(ast2.right) : left;
|
|
2471
|
-
} else {
|
|
2472
|
-
return isTrue(left) ? left : _evaluate(ast2.right);
|
|
2473
|
-
}
|
|
2474
|
-
case 4:
|
|
2475
|
-
// List
|
|
2476
|
-
case 10:
|
|
2477
|
-
return ast2.value.map(_evaluate);
|
|
2478
|
-
case 11:
|
|
2479
|
-
const dict = {};
|
|
2480
|
-
for (const key2 in ast2.value) {
|
|
2481
|
-
dict[key2] = _evaluate(ast2.value[key2]);
|
|
2482
|
-
}
|
|
2483
|
-
dicts.add(dict);
|
|
2484
|
-
return dict;
|
|
2485
|
-
case 8:
|
|
2486
|
-
const fnValue = _evaluate(ast2.fn);
|
|
2487
|
-
const args = ast2.args.map(_evaluate);
|
|
2488
|
-
const kwargs = {};
|
|
2489
|
-
for (const kwarg in ast2.kwargs) {
|
|
2490
|
-
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
2491
|
-
}
|
|
2492
|
-
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
2493
|
-
return fnValue.create(...args, kwargs);
|
|
2494
|
-
}
|
|
2495
|
-
return fnValue(...args, kwargs);
|
|
2496
|
-
case 12:
|
|
2497
|
-
const dictVal = _evaluate(ast2.target);
|
|
2498
|
-
const key = _evaluate(ast2.key);
|
|
2499
|
-
return dictVal[key];
|
|
2500
|
-
case 13:
|
|
2501
|
-
if (isTrue(_evaluate(ast2.condition))) {
|
|
2502
|
-
return _evaluate(ast2.ifTrue);
|
|
2503
|
-
} else {
|
|
2504
|
-
return _evaluate(ast2.ifFalse);
|
|
2505
|
-
}
|
|
2506
|
-
case 15:
|
|
2507
|
-
let leftVal = _evaluate(ast2.obj);
|
|
2508
|
-
let result;
|
|
2509
|
-
if (dicts.has(leftVal) || Object.isPrototypeOf.call(PY_DICT, leftVal)) {
|
|
2510
|
-
result = DICT[ast2.key];
|
|
2511
|
-
} else if (typeof leftVal === "string") {
|
|
2512
|
-
result = STRING[ast2.key];
|
|
2513
|
-
} else if (leftVal instanceof Set) {
|
|
2514
|
-
result = SET[ast2.key];
|
|
2515
|
-
} else if (ast2.key === "get" && typeof leftVal === "object") {
|
|
2516
|
-
result = DICT[ast2.key];
|
|
2517
|
-
leftVal = toPyDict(leftVal);
|
|
2860
|
+
var searchSlice = (0, import_toolkit10.createSlice)({
|
|
2861
|
+
name: "search",
|
|
2862
|
+
initialState: initialState9,
|
|
2863
|
+
reducers: {
|
|
2864
|
+
setGroupByDomain: (state, action) => {
|
|
2865
|
+
state.groupByDomain = action.payload;
|
|
2866
|
+
},
|
|
2867
|
+
setSearchBy: (state, action) => {
|
|
2868
|
+
state.searchBy = action.payload;
|
|
2869
|
+
},
|
|
2870
|
+
setSearchString: (state, action) => {
|
|
2871
|
+
state.searchString = action.payload;
|
|
2872
|
+
},
|
|
2873
|
+
setHoveredIndexSearchList: (state, action) => {
|
|
2874
|
+
state.hoveredIndexSearchList = action.payload;
|
|
2875
|
+
},
|
|
2876
|
+
setSelectedTags: (state, action) => {
|
|
2877
|
+
state.selectedTags = action.payload;
|
|
2878
|
+
},
|
|
2879
|
+
setFirstDomain: (state, action) => {
|
|
2880
|
+
state.firstDomain = action.payload;
|
|
2881
|
+
},
|
|
2882
|
+
setFilterBy: (state, action) => {
|
|
2883
|
+
state.filterBy = action.payload;
|
|
2884
|
+
},
|
|
2885
|
+
setGroupBy: (state, action) => {
|
|
2886
|
+
state.groupBy = action.payload;
|
|
2887
|
+
},
|
|
2888
|
+
setSearchMap: (state, action) => {
|
|
2889
|
+
state.searchMap = action.payload;
|
|
2890
|
+
},
|
|
2891
|
+
updateSearchMap: (state, action) => {
|
|
2892
|
+
if (!state.searchMap[action.payload.key]) {
|
|
2893
|
+
state.searchMap[action.payload.key] = [];
|
|
2894
|
+
}
|
|
2895
|
+
state.searchMap[action.payload.key].push(action.payload.value);
|
|
2896
|
+
},
|
|
2897
|
+
removeKeyFromSearchMap: (state, action) => {
|
|
2898
|
+
const { key, item } = action.payload;
|
|
2899
|
+
const values = state.searchMap[key];
|
|
2900
|
+
if (!values) return;
|
|
2901
|
+
if (item) {
|
|
2902
|
+
const filtered = values.filter((value) => value.name !== item.name);
|
|
2903
|
+
if (filtered.length > 0) {
|
|
2904
|
+
state.searchMap[key] = filtered;
|
|
2518
2905
|
} else {
|
|
2519
|
-
|
|
2520
|
-
}
|
|
2521
|
-
if (typeof result === "function") {
|
|
2522
|
-
const bound = result.bind(leftVal);
|
|
2523
|
-
bound[unboundFn] = result;
|
|
2524
|
-
return bound;
|
|
2906
|
+
delete state.searchMap[key];
|
|
2525
2907
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
const val = _innerEvaluate(ast2);
|
|
2533
|
-
if (typeof val === "function" && !allowedFns.has(val) && !allowedFns.has(val[unboundFn])) {
|
|
2534
|
-
throw new Error("Invalid Function Call");
|
|
2908
|
+
} else {
|
|
2909
|
+
delete state.searchMap[key];
|
|
2910
|
+
}
|
|
2911
|
+
},
|
|
2912
|
+
clearSearchMap: (state) => {
|
|
2913
|
+
state.searchMap = {};
|
|
2535
2914
|
}
|
|
2536
|
-
return val;
|
|
2537
|
-
}
|
|
2538
|
-
return _evaluate(ast);
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
// src/utils/domain/py.ts
|
|
2542
|
-
function parseExpr(expr) {
|
|
2543
|
-
const tokens = tokenize(expr);
|
|
2544
|
-
return parse(tokens);
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
// src/utils/domain/objects.ts
|
|
2548
|
-
function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
|
|
2549
|
-
if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") {
|
|
2550
|
-
return obj1 === obj2;
|
|
2551
2915
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2916
|
+
});
|
|
2917
|
+
var {
|
|
2918
|
+
setGroupByDomain,
|
|
2919
|
+
setSelectedTags,
|
|
2920
|
+
setSearchString,
|
|
2921
|
+
setHoveredIndexSearchList,
|
|
2922
|
+
setFirstDomain,
|
|
2923
|
+
setSearchBy,
|
|
2924
|
+
setFilterBy,
|
|
2925
|
+
setSearchMap,
|
|
2926
|
+
updateSearchMap,
|
|
2927
|
+
removeKeyFromSearchMap,
|
|
2928
|
+
setGroupBy,
|
|
2929
|
+
clearSearchMap
|
|
2930
|
+
} = searchSlice.actions;
|
|
2931
|
+
var search_slice_default = searchSlice.reducer;
|
|
2555
2932
|
|
|
2556
|
-
// src/
|
|
2557
|
-
var
|
|
2933
|
+
// src/store/store.ts
|
|
2934
|
+
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
2558
2935
|
|
|
2559
|
-
//
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2936
|
+
// node_modules/redux/dist/redux.mjs
|
|
2937
|
+
function formatProdErrorMessage(code) {
|
|
2938
|
+
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. `;
|
|
2563
2939
|
}
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2940
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
2941
|
+
var ActionTypes = {
|
|
2942
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
2943
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
2944
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
2567
2945
|
};
|
|
2568
|
-
var
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
}
|
|
2576
|
-
const domain1 = domains[0] instanceof _Domain ? domains[0] : new _Domain(domains[0]);
|
|
2577
|
-
if (domains.length === 1) {
|
|
2578
|
-
return domain1;
|
|
2579
|
-
}
|
|
2580
|
-
const domain2 = _Domain.combine(domains.slice(1), operator);
|
|
2581
|
-
const result = new _Domain([]);
|
|
2582
|
-
const astValues1 = domain1.ast.value;
|
|
2583
|
-
const astValues2 = domain2.ast.value;
|
|
2584
|
-
const op = operator === "AND" ? "&" : "|";
|
|
2585
|
-
const combinedAST = {
|
|
2586
|
-
type: 4,
|
|
2587
|
-
value: astValues1.concat(astValues2)
|
|
2588
|
-
};
|
|
2589
|
-
result.ast = normalizeDomainAST(combinedAST, op);
|
|
2590
|
-
return result;
|
|
2946
|
+
var actionTypes_default = ActionTypes;
|
|
2947
|
+
function isPlainObject(obj) {
|
|
2948
|
+
if (typeof obj !== "object" || obj === null)
|
|
2949
|
+
return false;
|
|
2950
|
+
let proto = obj;
|
|
2951
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2952
|
+
proto = Object.getPrototypeOf(proto);
|
|
2591
2953
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
2954
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
2955
|
+
}
|
|
2956
|
+
function miniKindOf(val) {
|
|
2957
|
+
if (val === void 0)
|
|
2958
|
+
return "undefined";
|
|
2959
|
+
if (val === null)
|
|
2960
|
+
return "null";
|
|
2961
|
+
const type = typeof val;
|
|
2962
|
+
switch (type) {
|
|
2963
|
+
case "boolean":
|
|
2964
|
+
case "string":
|
|
2965
|
+
case "number":
|
|
2966
|
+
case "symbol":
|
|
2967
|
+
case "function": {
|
|
2968
|
+
return type;
|
|
2969
|
+
}
|
|
2594
2970
|
}
|
|
2595
|
-
|
|
2596
|
-
return
|
|
2971
|
+
if (Array.isArray(val))
|
|
2972
|
+
return "array";
|
|
2973
|
+
if (isDate(val))
|
|
2974
|
+
return "date";
|
|
2975
|
+
if (isError(val))
|
|
2976
|
+
return "error";
|
|
2977
|
+
const constructorName = ctorName(val);
|
|
2978
|
+
switch (constructorName) {
|
|
2979
|
+
case "Symbol":
|
|
2980
|
+
case "Promise":
|
|
2981
|
+
case "WeakMap":
|
|
2982
|
+
case "WeakSet":
|
|
2983
|
+
case "Map":
|
|
2984
|
+
case "Set":
|
|
2985
|
+
return constructorName;
|
|
2597
2986
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2987
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
2988
|
+
}
|
|
2989
|
+
function ctorName(val) {
|
|
2990
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
2991
|
+
}
|
|
2992
|
+
function isError(val) {
|
|
2993
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
2994
|
+
}
|
|
2995
|
+
function isDate(val) {
|
|
2996
|
+
if (val instanceof Date)
|
|
2997
|
+
return true;
|
|
2998
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
2999
|
+
}
|
|
3000
|
+
function kindOf(val) {
|
|
3001
|
+
let typeOfVal = typeof val;
|
|
3002
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3003
|
+
typeOfVal = miniKindOf(val);
|
|
2602
3004
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
if (operatorCtx === "&") {
|
|
2609
|
-
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
2610
|
-
} else if (operatorCtx === "|") {
|
|
2611
|
-
newDomain2.ast.value.push(..._Domain.FALSE.ast.value);
|
|
2612
|
-
}
|
|
2613
|
-
} else {
|
|
2614
|
-
newDomain2.ast.value.push(leaf);
|
|
2615
|
-
}
|
|
2616
|
-
return 1;
|
|
2617
|
-
} else if (leaf.type === 1) {
|
|
2618
|
-
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)) {
|
|
2619
|
-
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
2620
|
-
return 3;
|
|
2621
|
-
}
|
|
2622
|
-
newDomain2.ast.value.push(leaf);
|
|
2623
|
-
if (leaf.value === "!") {
|
|
2624
|
-
return 1 + processLeaf(elements, idx + 1, "&", newDomain2);
|
|
2625
|
-
}
|
|
2626
|
-
const firstLeafSkip = processLeaf(
|
|
2627
|
-
elements,
|
|
2628
|
-
idx + 1,
|
|
2629
|
-
leaf.value,
|
|
2630
|
-
newDomain2
|
|
2631
|
-
);
|
|
2632
|
-
const secondLeafSkip = processLeaf(
|
|
2633
|
-
elements,
|
|
2634
|
-
idx + 1 + firstLeafSkip,
|
|
2635
|
-
leaf.value,
|
|
2636
|
-
newDomain2
|
|
2637
|
-
);
|
|
2638
|
-
return 1 + firstLeafSkip + secondLeafSkip;
|
|
2639
|
-
}
|
|
2640
|
-
return 0;
|
|
2641
|
-
}
|
|
2642
|
-
const d = new _Domain(domain);
|
|
2643
|
-
if (d.ast.value.length === 0) {
|
|
2644
|
-
return d;
|
|
2645
|
-
}
|
|
2646
|
-
const newDomain = new _Domain([]);
|
|
2647
|
-
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
2648
|
-
return newDomain;
|
|
3005
|
+
return typeOfVal;
|
|
3006
|
+
}
|
|
3007
|
+
function warning(message) {
|
|
3008
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
3009
|
+
console.error(message);
|
|
2649
3010
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
} else {
|
|
2654
|
-
let rawAST;
|
|
2655
|
-
try {
|
|
2656
|
-
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
2657
|
-
} catch (error) {
|
|
2658
|
-
throw new InvalidDomainError(
|
|
2659
|
-
`Invalid domain representation: ${descr}`,
|
|
2660
|
-
{
|
|
2661
|
-
cause: error
|
|
2662
|
-
}
|
|
2663
|
-
);
|
|
2664
|
-
}
|
|
2665
|
-
this.ast = normalizeDomainAST(rawAST);
|
|
2666
|
-
}
|
|
3011
|
+
try {
|
|
3012
|
+
throw new Error(message);
|
|
3013
|
+
} catch (e) {
|
|
2667
3014
|
}
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
3015
|
+
}
|
|
3016
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
3017
|
+
const reducerKeys = Object.keys(reducers);
|
|
3018
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
3019
|
+
if (reducerKeys.length === 0) {
|
|
3020
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
2671
3021
|
}
|
|
2672
|
-
|
|
2673
|
-
return
|
|
3022
|
+
if (!isPlainObject(inputState)) {
|
|
3023
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
2674
3024
|
}
|
|
2675
|
-
|
|
2676
|
-
|
|
3025
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
3026
|
+
unexpectedKeys.forEach((key) => {
|
|
3027
|
+
unexpectedKeyCache[key] = true;
|
|
3028
|
+
});
|
|
3029
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
3030
|
+
return;
|
|
3031
|
+
if (unexpectedKeys.length > 0) {
|
|
3032
|
+
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.`;
|
|
2677
3033
|
}
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
return this.toString();
|
|
3034
|
+
}
|
|
3035
|
+
function assertReducerShape(reducers) {
|
|
3036
|
+
Object.keys(reducers).forEach((key) => {
|
|
3037
|
+
const reducer = reducers[key];
|
|
3038
|
+
const initialState10 = reducer(void 0, {
|
|
3039
|
+
type: actionTypes_default.INIT
|
|
3040
|
+
});
|
|
3041
|
+
if (typeof initialState10 === "undefined") {
|
|
3042
|
+
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.`);
|
|
2688
3043
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
var TRUE_DOMAIN = new Domain([TRUE_LEAF]);
|
|
2694
|
-
var FALSE_DOMAIN = new Domain([FALSE_LEAF]);
|
|
2695
|
-
Domain.TRUE = TRUE_DOMAIN;
|
|
2696
|
-
Domain.FALSE = FALSE_DOMAIN;
|
|
2697
|
-
function toAST(domain) {
|
|
2698
|
-
const elems = domain.map((elem) => {
|
|
2699
|
-
switch (elem) {
|
|
2700
|
-
case "!":
|
|
2701
|
-
case "&":
|
|
2702
|
-
case "|":
|
|
2703
|
-
return { type: 1, value: elem };
|
|
2704
|
-
default:
|
|
2705
|
-
return {
|
|
2706
|
-
type: 10,
|
|
2707
|
-
value: elem.map(toPyValue)
|
|
2708
|
-
};
|
|
3044
|
+
if (typeof reducer(void 0, {
|
|
3045
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
3046
|
+
}) === "undefined") {
|
|
3047
|
+
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.`);
|
|
2709
3048
|
}
|
|
2710
3049
|
});
|
|
2711
|
-
return { type: 4, value: elems };
|
|
2712
3050
|
}
|
|
2713
|
-
function
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
3051
|
+
function combineReducers(reducers) {
|
|
3052
|
+
const reducerKeys = Object.keys(reducers);
|
|
3053
|
+
const finalReducers = {};
|
|
3054
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
3055
|
+
const key = reducerKeys[i];
|
|
3056
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3057
|
+
if (typeof reducers[key] === "undefined") {
|
|
3058
|
+
warning(`No reducer provided for key "${key}"`);
|
|
2719
3059
|
}
|
|
2720
|
-
} else {
|
|
2721
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2722
3060
|
}
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
return domain;
|
|
2726
|
-
}
|
|
2727
|
-
let expected = 1;
|
|
2728
|
-
for (const child of domain.value) {
|
|
2729
|
-
switch (child.type) {
|
|
2730
|
-
case 1:
|
|
2731
|
-
if (child.value === "&" || child.value === "|") {
|
|
2732
|
-
expected++;
|
|
2733
|
-
} else if (child.value !== "!") {
|
|
2734
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2735
|
-
}
|
|
2736
|
-
break;
|
|
2737
|
-
case 4:
|
|
2738
|
-
/* list */
|
|
2739
|
-
case 10:
|
|
2740
|
-
if (child.value.length === 3) {
|
|
2741
|
-
expected--;
|
|
2742
|
-
break;
|
|
2743
|
-
}
|
|
2744
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2745
|
-
default:
|
|
2746
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
3061
|
+
if (typeof reducers[key] === "function") {
|
|
3062
|
+
finalReducers[key] = reducers[key];
|
|
2747
3063
|
}
|
|
2748
3064
|
}
|
|
2749
|
-
const
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
}
|
|
2754
|
-
if (expected > 0) {
|
|
2755
|
-
throw new InvalidDomainError(
|
|
2756
|
-
`invalid domain ${formatAST(domain)} (missing ${expected} segment(s))`
|
|
2757
|
-
);
|
|
3065
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
3066
|
+
let unexpectedKeyCache;
|
|
3067
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3068
|
+
unexpectedKeyCache = {};
|
|
2758
3069
|
}
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
3070
|
+
let shapeAssertionError;
|
|
3071
|
+
try {
|
|
3072
|
+
assertReducerShape(finalReducers);
|
|
3073
|
+
} catch (e) {
|
|
3074
|
+
shapeAssertionError = e;
|
|
2764
3075
|
}
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
if (names.length >= 2) {
|
|
2769
|
-
return matchCondition(record[names[0]], [
|
|
2770
|
-
names.slice(1).join("."),
|
|
2771
|
-
operator,
|
|
2772
|
-
value
|
|
2773
|
-
]);
|
|
3076
|
+
return function combination(state = {}, action) {
|
|
3077
|
+
if (shapeAssertionError) {
|
|
3078
|
+
throw shapeAssertionError;
|
|
2774
3079
|
}
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2780
|
-
"g"
|
|
2781
|
-
);
|
|
2782
|
-
ilikeRegexp = new RegExp(
|
|
2783
|
-
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2784
|
-
"gi"
|
|
2785
|
-
);
|
|
2786
|
-
}
|
|
2787
|
-
const fieldValue = typeof field === "number" ? field : record[field];
|
|
2788
|
-
switch (operator) {
|
|
2789
|
-
case "=?":
|
|
2790
|
-
if ([false, null].includes(value)) {
|
|
2791
|
-
return true;
|
|
2792
|
-
}
|
|
2793
|
-
// eslint-disable-next-line no-fallthrough
|
|
2794
|
-
case "=":
|
|
2795
|
-
case "==":
|
|
2796
|
-
if (Array.isArray(fieldValue) && Array.isArray(value)) {
|
|
2797
|
-
return shallowEqual2(fieldValue, value);
|
|
3080
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3081
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
3082
|
+
if (warningMessage) {
|
|
3083
|
+
warning(warningMessage);
|
|
2798
3084
|
}
|
|
2799
|
-
return fieldValue === value;
|
|
2800
|
-
case "!=":
|
|
2801
|
-
case "<>":
|
|
2802
|
-
return !matchCondition(record, [field, "==", value]);
|
|
2803
|
-
case "<":
|
|
2804
|
-
return fieldValue < value;
|
|
2805
|
-
case "<=":
|
|
2806
|
-
return fieldValue <= value;
|
|
2807
|
-
case ">":
|
|
2808
|
-
return fieldValue > value;
|
|
2809
|
-
case ">=":
|
|
2810
|
-
return fieldValue >= value;
|
|
2811
|
-
case "in": {
|
|
2812
|
-
const val = Array.isArray(value) ? value : [value];
|
|
2813
|
-
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2814
|
-
return fieldVal.some((fv) => val.includes(fv));
|
|
2815
3085
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
}
|
|
2830
|
-
return Boolean(!fieldValue.match(likeRegexp));
|
|
2831
|
-
case "=like":
|
|
2832
|
-
if (fieldValue === false) {
|
|
2833
|
-
return false;
|
|
2834
|
-
}
|
|
2835
|
-
return new RegExp(escapeRegExp(value).replace(/%/g, ".*")).test(
|
|
2836
|
-
fieldValue
|
|
2837
|
-
);
|
|
2838
|
-
case "ilike":
|
|
2839
|
-
if (fieldValue === false) {
|
|
2840
|
-
return false;
|
|
2841
|
-
}
|
|
2842
|
-
return Boolean(fieldValue.match(ilikeRegexp));
|
|
2843
|
-
case "not ilike":
|
|
2844
|
-
if (fieldValue === false) {
|
|
2845
|
-
return false;
|
|
2846
|
-
}
|
|
2847
|
-
return Boolean(!fieldValue.match(ilikeRegexp));
|
|
2848
|
-
case "=ilike":
|
|
2849
|
-
if (fieldValue === false) {
|
|
2850
|
-
return false;
|
|
2851
|
-
}
|
|
2852
|
-
return new RegExp(escapeRegExp(value).replace(/%/g, ".*"), "i").test(
|
|
2853
|
-
fieldValue
|
|
2854
|
-
);
|
|
2855
|
-
}
|
|
2856
|
-
throw new InvalidDomainError("could not match domain");
|
|
2857
|
-
}
|
|
2858
|
-
function makeOperators(record) {
|
|
2859
|
-
const match = matchCondition.bind(null, record);
|
|
2860
|
-
return {
|
|
2861
|
-
"!": (x) => !match(x),
|
|
2862
|
-
"&": (a, b) => match(a) && match(b),
|
|
2863
|
-
"|": (a, b) => match(a) || match(b)
|
|
2864
|
-
};
|
|
2865
|
-
}
|
|
2866
|
-
function matchDomain(record, domain) {
|
|
2867
|
-
if (domain.length === 0) {
|
|
2868
|
-
return true;
|
|
2869
|
-
}
|
|
2870
|
-
const operators = makeOperators(record);
|
|
2871
|
-
const reversedDomain = Array.from(domain).reverse();
|
|
2872
|
-
const condStack = [];
|
|
2873
|
-
for (const item of reversedDomain) {
|
|
2874
|
-
const operator = typeof item === "string" && operators[item];
|
|
2875
|
-
if (operator) {
|
|
2876
|
-
const operands = condStack.splice(-operator.length);
|
|
2877
|
-
condStack.push(operator(...operands));
|
|
2878
|
-
} else {
|
|
2879
|
-
condStack.push(item);
|
|
3086
|
+
let hasChanged = false;
|
|
3087
|
+
const nextState = {};
|
|
3088
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
3089
|
+
const key = finalReducerKeys[i];
|
|
3090
|
+
const reducer = finalReducers[key];
|
|
3091
|
+
const previousStateForKey = state[key];
|
|
3092
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
3093
|
+
if (typeof nextStateForKey === "undefined") {
|
|
3094
|
+
const actionType = action && action.type;
|
|
3095
|
+
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.`);
|
|
3096
|
+
}
|
|
3097
|
+
nextState[key] = nextStateForKey;
|
|
3098
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
2880
3099
|
}
|
|
2881
|
-
|
|
2882
|
-
|
|
3100
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
3101
|
+
return hasChanged ? nextState : state;
|
|
3102
|
+
};
|
|
2883
3103
|
}
|
|
2884
3104
|
|
|
2885
|
-
// src/
|
|
2886
|
-
var
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
3105
|
+
// src/store/store.ts
|
|
3106
|
+
var rootReducer = combineReducers({
|
|
3107
|
+
env: env_slice_default,
|
|
3108
|
+
header: header_slice_default,
|
|
3109
|
+
navbar: navbar_slice_default,
|
|
3110
|
+
list: list_slice_default,
|
|
3111
|
+
search: search_slice_default,
|
|
3112
|
+
form: form_slice_default,
|
|
3113
|
+
breadcrumbs: breadcrums_slice_default,
|
|
3114
|
+
login: login_slice_default,
|
|
3115
|
+
excel: excel_slice_default,
|
|
3116
|
+
profile: profile_slice_default
|
|
3117
|
+
});
|
|
3118
|
+
var envStore = (0, import_toolkit11.configureStore)({
|
|
3119
|
+
reducer: rootReducer,
|
|
3120
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
3121
|
+
serializableCheck: false
|
|
3122
|
+
})
|
|
3123
|
+
});
|
|
3124
|
+
|
|
3125
|
+
// src/environment/EnvStore.ts
|
|
3126
|
+
var EnvStore = class _EnvStore {
|
|
3127
|
+
static instance = null;
|
|
3128
|
+
envStore;
|
|
3129
|
+
baseUrl;
|
|
3130
|
+
requests;
|
|
3131
|
+
context;
|
|
3132
|
+
defaultCompany;
|
|
3133
|
+
config;
|
|
3134
|
+
companies;
|
|
3135
|
+
user;
|
|
3136
|
+
db;
|
|
3137
|
+
localStorageUtils;
|
|
3138
|
+
sessionStorageUtils;
|
|
3139
|
+
refreshTokenEndpoint;
|
|
3140
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3141
|
+
this.envStore = envStore2;
|
|
3142
|
+
this.localStorageUtils = localStorageUtils2;
|
|
3143
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
3144
|
+
this.setup();
|
|
3145
|
+
}
|
|
3146
|
+
static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3147
|
+
if (!_EnvStore.instance) {
|
|
3148
|
+
console.log("Creating new EnvStore instance");
|
|
3149
|
+
_EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
|
|
3150
|
+
} else {
|
|
3151
|
+
console.log("Returning existing EnvStore instance");
|
|
2897
3152
|
}
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
);
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3153
|
+
return _EnvStore.instance;
|
|
3154
|
+
}
|
|
3155
|
+
setup() {
|
|
3156
|
+
const env = this.envStore.getState().env;
|
|
3157
|
+
console.log("Redux env state in A1:", env);
|
|
3158
|
+
this.baseUrl = env?.baseUrl;
|
|
3159
|
+
this.requests = env?.requests;
|
|
3160
|
+
this.context = env?.context;
|
|
3161
|
+
this.defaultCompany = env?.defaultCompany;
|
|
3162
|
+
this.config = env?.config;
|
|
3163
|
+
this.companies = env?.companies || [];
|
|
3164
|
+
this.user = env?.user;
|
|
3165
|
+
this.db = env?.db;
|
|
3166
|
+
this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
|
|
3167
|
+
console.log("Env setup in A1:", this);
|
|
3168
|
+
}
|
|
3169
|
+
setupEnv(envConfig) {
|
|
3170
|
+
const dispatch = this.envStore.dispatch;
|
|
3171
|
+
const env = {
|
|
3172
|
+
...envConfig,
|
|
3173
|
+
localStorageUtils: this.localStorageUtils,
|
|
3174
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3175
|
+
};
|
|
3176
|
+
console.log("Setting up env with config:", envConfig);
|
|
3177
|
+
const requests = axiosClient.init(env);
|
|
3178
|
+
console.log("axiosClient.init result:", requests);
|
|
3179
|
+
dispatch(setEnv({ ...env, requests }));
|
|
3180
|
+
this.setup();
|
|
3181
|
+
}
|
|
3182
|
+
setUid(uid) {
|
|
3183
|
+
const dispatch = this.envStore.dispatch;
|
|
3184
|
+
dispatch(setUid(uid));
|
|
3185
|
+
this.setup();
|
|
3186
|
+
}
|
|
3187
|
+
setLang(lang) {
|
|
3188
|
+
const dispatch = this.envStore.dispatch;
|
|
3189
|
+
dispatch(setLang(lang));
|
|
3190
|
+
this.setup();
|
|
3191
|
+
}
|
|
3192
|
+
setAllowCompanies(allowCompanies) {
|
|
3193
|
+
const dispatch = this.envStore.dispatch;
|
|
3194
|
+
dispatch(setAllowCompanies(allowCompanies));
|
|
3195
|
+
this.setup();
|
|
3196
|
+
}
|
|
3197
|
+
setCompanies(companies) {
|
|
3198
|
+
const dispatch = this.envStore.dispatch;
|
|
3199
|
+
dispatch(setCompanies(companies));
|
|
3200
|
+
this.setup();
|
|
3201
|
+
}
|
|
3202
|
+
setDefaultCompany(company) {
|
|
3203
|
+
const dispatch = this.envStore.dispatch;
|
|
3204
|
+
dispatch(setDefaultCompany(company));
|
|
3205
|
+
this.setup();
|
|
3206
|
+
}
|
|
3207
|
+
setUserInfo(userInfo) {
|
|
3208
|
+
const dispatch = this.envStore.dispatch;
|
|
3209
|
+
dispatch(setUser(userInfo));
|
|
3210
|
+
this.setup();
|
|
2905
3211
|
}
|
|
2906
3212
|
};
|
|
2907
|
-
|
|
2908
|
-
// src/environment/EnvStore.ts
|
|
2909
3213
|
function getEnv() {
|
|
2910
|
-
|
|
2911
|
-
|
|
3214
|
+
const instance = EnvStore.getInstance(envStore);
|
|
3215
|
+
if (!instance) {
|
|
3216
|
+
throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
|
|
3217
|
+
}
|
|
3218
|
+
return instance;
|
|
2912
3219
|
}
|
|
2913
3220
|
|
|
2914
3221
|
// src/services/action-service/index.ts
|
|
@@ -3076,7 +3383,7 @@ var AuthService = {
|
|
|
3076
3383
|
}).filter(([_, value]) => !!value)
|
|
3077
3384
|
);
|
|
3078
3385
|
const encodedData = new URLSearchParams(payload).toString();
|
|
3079
|
-
return env?.requests?.post(body
|
|
3386
|
+
return env?.requests?.post(body.path, encodedData, {
|
|
3080
3387
|
headers: {
|
|
3081
3388
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
3082
3389
|
}
|
|
@@ -3173,20 +3480,6 @@ var AuthService = {
|
|
|
3173
3480
|
}
|
|
3174
3481
|
});
|
|
3175
3482
|
},
|
|
3176
|
-
async isValidActionToken(actionToken, path) {
|
|
3177
|
-
const env = getEnv();
|
|
3178
|
-
return env?.requests?.post(
|
|
3179
|
-
path,
|
|
3180
|
-
{},
|
|
3181
|
-
{
|
|
3182
|
-
headers: {
|
|
3183
|
-
"Content-Type": "application/json"
|
|
3184
|
-
},
|
|
3185
|
-
useActionToken: true,
|
|
3186
|
-
actionToken
|
|
3187
|
-
}
|
|
3188
|
-
);
|
|
3189
|
-
},
|
|
3190
3483
|
async loginSocial({
|
|
3191
3484
|
db,
|
|
3192
3485
|
state,
|
|
@@ -3951,7 +4244,7 @@ var model_service_default = ModelService;
|
|
|
3951
4244
|
var UserService = {
|
|
3952
4245
|
async getProfile(path) {
|
|
3953
4246
|
const env = getEnv();
|
|
3954
|
-
return env
|
|
4247
|
+
return env.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
3955
4248
|
headers: {
|
|
3956
4249
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
3957
4250
|
}
|
|
@@ -4270,7 +4563,8 @@ var ViewService = {
|
|
|
4270
4563
|
},
|
|
4271
4564
|
async getVersion() {
|
|
4272
4565
|
const env = getEnv();
|
|
4273
|
-
|
|
4566
|
+
console.log("env?.requests", env, env?.requests);
|
|
4567
|
+
return env?.requests?.get("", {
|
|
4274
4568
|
headers: {
|
|
4275
4569
|
"Content-Type": "application/json"
|
|
4276
4570
|
}
|
|
@@ -4587,40 +4881,26 @@ var useGetAccessByCode = () => {
|
|
|
4587
4881
|
};
|
|
4588
4882
|
var use_get_access_by_code_default = useGetAccessByCode;
|
|
4589
4883
|
|
|
4590
|
-
// src/hooks/auth/use-validate-action-token.ts
|
|
4591
|
-
var import_react_query12 = require("@tanstack/react-query");
|
|
4592
|
-
var useValidateActionToken = () => {
|
|
4593
|
-
return (0, import_react_query12.useMutation)({
|
|
4594
|
-
mutationFn: ({
|
|
4595
|
-
actionToken,
|
|
4596
|
-
path
|
|
4597
|
-
}) => {
|
|
4598
|
-
return auth_service_default.isValidActionToken(actionToken, path);
|
|
4599
|
-
}
|
|
4600
|
-
});
|
|
4601
|
-
};
|
|
4602
|
-
var use_validate_action_token_default = useValidateActionToken;
|
|
4603
|
-
|
|
4604
4884
|
// src/hooks/company/use-get-company-info.ts
|
|
4605
|
-
var
|
|
4885
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
4606
4886
|
var useGetCompanyInfo = () => {
|
|
4607
|
-
return (0,
|
|
4887
|
+
return (0, import_react_query12.useMutation)({
|
|
4608
4888
|
mutationFn: (id) => company_service_default.getInfoCompany(id)
|
|
4609
4889
|
});
|
|
4610
4890
|
};
|
|
4611
4891
|
var use_get_company_info_default = useGetCompanyInfo;
|
|
4612
4892
|
|
|
4613
4893
|
// src/hooks/company/use-get-current-company.ts
|
|
4614
|
-
var
|
|
4894
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
4615
4895
|
var useGetCurrentCompany = () => {
|
|
4616
|
-
return (0,
|
|
4896
|
+
return (0, import_react_query13.useMutation)({
|
|
4617
4897
|
mutationFn: () => company_service_default.getCurrentCompany()
|
|
4618
4898
|
});
|
|
4619
4899
|
};
|
|
4620
4900
|
var use_get_current_company_default = useGetCurrentCompany;
|
|
4621
4901
|
|
|
4622
4902
|
// src/hooks/company/use-get-list-company.ts
|
|
4623
|
-
var
|
|
4903
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
4624
4904
|
var useGetListCompany = (companyIDs = []) => {
|
|
4625
4905
|
const companySpec = {
|
|
4626
4906
|
id: {},
|
|
@@ -4631,7 +4911,7 @@ var useGetListCompany = (companyIDs = []) => {
|
|
|
4631
4911
|
ids: companyIDs,
|
|
4632
4912
|
specification: companySpec
|
|
4633
4913
|
};
|
|
4634
|
-
return (0,
|
|
4914
|
+
return (0, import_react_query14.useQuery)({
|
|
4635
4915
|
queryKey: ["list_company" /* LIST_COMPANY */, companyIDs],
|
|
4636
4916
|
queryFn: () => model_service_default.getList(getListParams),
|
|
4637
4917
|
refetchOnWindowFocus: false
|
|
@@ -4640,9 +4920,9 @@ var useGetListCompany = (companyIDs = []) => {
|
|
|
4640
4920
|
var use_get_list_company_default = useGetListCompany;
|
|
4641
4921
|
|
|
4642
4922
|
// src/hooks/excel/use-export-excel.ts
|
|
4643
|
-
var
|
|
4923
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
4644
4924
|
var useExportExcel = () => {
|
|
4645
|
-
return (0,
|
|
4925
|
+
return (0, import_react_query15.useMutation)({
|
|
4646
4926
|
mutationFn: ({
|
|
4647
4927
|
model,
|
|
4648
4928
|
domain,
|
|
@@ -4667,9 +4947,9 @@ var useExportExcel = () => {
|
|
|
4667
4947
|
var use_export_excel_default = useExportExcel;
|
|
4668
4948
|
|
|
4669
4949
|
// src/hooks/excel/use-get-field-export.ts
|
|
4670
|
-
var
|
|
4950
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
4671
4951
|
var useGetFieldExport = () => {
|
|
4672
|
-
return (0,
|
|
4952
|
+
return (0, import_react_query16.useMutation)({
|
|
4673
4953
|
mutationFn: ({
|
|
4674
4954
|
ids,
|
|
4675
4955
|
model,
|
|
@@ -4698,9 +4978,9 @@ var useGetFieldExport = () => {
|
|
|
4698
4978
|
var use_get_field_export_default = useGetFieldExport;
|
|
4699
4979
|
|
|
4700
4980
|
// src/hooks/excel/use-get-file-excel.ts
|
|
4701
|
-
var
|
|
4981
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
4702
4982
|
var useGetFileExcel = ({ model }) => {
|
|
4703
|
-
return (0,
|
|
4983
|
+
return (0, import_react_query17.useQuery)({
|
|
4704
4984
|
queryKey: [],
|
|
4705
4985
|
queryFn: () => excel_service_default.getFileExcel({
|
|
4706
4986
|
model
|
|
@@ -4716,9 +4996,9 @@ var useGetFileExcel = ({ model }) => {
|
|
|
4716
4996
|
var use_get_file_excel_default = useGetFileExcel;
|
|
4717
4997
|
|
|
4718
4998
|
// src/hooks/excel/use-parse-preview.ts
|
|
4719
|
-
var
|
|
4999
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
4720
5000
|
var useParsePreview = () => {
|
|
4721
|
-
return (0,
|
|
5001
|
+
return (0, import_react_query18.useMutation)({
|
|
4722
5002
|
mutationFn: ({
|
|
4723
5003
|
id,
|
|
4724
5004
|
selectedSheet,
|
|
@@ -4735,9 +5015,9 @@ var useParsePreview = () => {
|
|
|
4735
5015
|
var use_parse_preview_default = useParsePreview;
|
|
4736
5016
|
|
|
4737
5017
|
// src/hooks/excel/use-upload-file.ts
|
|
4738
|
-
var
|
|
5018
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
4739
5019
|
var useUploadFile = () => {
|
|
4740
|
-
return (0,
|
|
5020
|
+
return (0, import_react_query19.useMutation)({
|
|
4741
5021
|
mutationFn: ({ formData }) => excel_service_default.uploadFile({
|
|
4742
5022
|
formData
|
|
4743
5023
|
})
|
|
@@ -4746,9 +5026,9 @@ var useUploadFile = () => {
|
|
|
4746
5026
|
var use_upload_file_default = useUploadFile;
|
|
4747
5027
|
|
|
4748
5028
|
// src/hooks/excel/use-upload-id-file.ts
|
|
4749
|
-
var
|
|
5029
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
4750
5030
|
var useUploadIdFile = () => {
|
|
4751
|
-
return (0,
|
|
5031
|
+
return (0, import_react_query20.useMutation)({
|
|
4752
5032
|
mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
|
|
4753
5033
|
formData
|
|
4754
5034
|
})
|
|
@@ -4757,9 +5037,9 @@ var useUploadIdFile = () => {
|
|
|
4757
5037
|
var use_upload_id_file_default = useUploadIdFile;
|
|
4758
5038
|
|
|
4759
5039
|
// src/hooks/excel/uss-execute-import.ts
|
|
4760
|
-
var
|
|
5040
|
+
var import_react_query21 = require("@tanstack/react-query");
|
|
4761
5041
|
var useExecuteImport = () => {
|
|
4762
|
-
return (0,
|
|
5042
|
+
return (0, import_react_query21.useMutation)({
|
|
4763
5043
|
mutationFn: ({
|
|
4764
5044
|
fields,
|
|
4765
5045
|
columns,
|
|
@@ -4780,9 +5060,9 @@ var useExecuteImport = () => {
|
|
|
4780
5060
|
var uss_execute_import_default = useExecuteImport;
|
|
4781
5061
|
|
|
4782
5062
|
// src/hooks/form/use-change-status.ts
|
|
4783
|
-
var
|
|
5063
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
4784
5064
|
var useChangeStatus = () => {
|
|
4785
|
-
return (0,
|
|
5065
|
+
return (0, import_react_query22.useMutation)({
|
|
4786
5066
|
mutationFn: ({ data }) => {
|
|
4787
5067
|
return form_service_default.changeStatus({
|
|
4788
5068
|
data
|
|
@@ -4793,9 +5073,9 @@ var useChangeStatus = () => {
|
|
|
4793
5073
|
var use_change_status_default = useChangeStatus;
|
|
4794
5074
|
|
|
4795
5075
|
// src/hooks/form/use-delete-comment.ts
|
|
4796
|
-
var
|
|
5076
|
+
var import_react_query23 = require("@tanstack/react-query");
|
|
4797
5077
|
var useDeleteComment = () => {
|
|
4798
|
-
return (0,
|
|
5078
|
+
return (0, import_react_query23.useMutation)({
|
|
4799
5079
|
mutationFn: ({ data }) => form_service_default.deleteComment({
|
|
4800
5080
|
data
|
|
4801
5081
|
})
|
|
@@ -4804,9 +5084,9 @@ var useDeleteComment = () => {
|
|
|
4804
5084
|
var use_delete_comment_default = useDeleteComment;
|
|
4805
5085
|
|
|
4806
5086
|
// src/hooks/form/use-get-comment.ts
|
|
4807
|
-
var
|
|
5087
|
+
var import_react_query24 = require("@tanstack/react-query");
|
|
4808
5088
|
var useGetComment = ({ data, queryKey }) => {
|
|
4809
|
-
return (0,
|
|
5089
|
+
return (0, import_react_query24.useQuery)({
|
|
4810
5090
|
queryKey,
|
|
4811
5091
|
queryFn: () => form_service_default.getComment({ data }).then((res) => {
|
|
4812
5092
|
if (res) {
|
|
@@ -4820,13 +5100,13 @@ var useGetComment = ({ data, queryKey }) => {
|
|
|
4820
5100
|
var use_get_comment_default = useGetComment;
|
|
4821
5101
|
|
|
4822
5102
|
// src/hooks/form/use-get-form-view.ts
|
|
4823
|
-
var
|
|
5103
|
+
var import_react_query25 = require("@tanstack/react-query");
|
|
4824
5104
|
var useGetFormView = ({
|
|
4825
5105
|
data,
|
|
4826
5106
|
queryKey,
|
|
4827
5107
|
enabled
|
|
4828
5108
|
}) => {
|
|
4829
|
-
return (0,
|
|
5109
|
+
return (0, import_react_query25.useQuery)({
|
|
4830
5110
|
queryKey,
|
|
4831
5111
|
queryFn: () => form_service_default.getFormView({ data }).then((res) => {
|
|
4832
5112
|
if (res) {
|
|
@@ -4840,13 +5120,13 @@ var useGetFormView = ({
|
|
|
4840
5120
|
var use_get_form_view_default = useGetFormView;
|
|
4841
5121
|
|
|
4842
5122
|
// src/hooks/form/use-get-image.ts
|
|
4843
|
-
var
|
|
5123
|
+
var import_react_query26 = require("@tanstack/react-query");
|
|
4844
5124
|
var useGetImage = ({
|
|
4845
5125
|
data,
|
|
4846
5126
|
queryKey,
|
|
4847
5127
|
src
|
|
4848
5128
|
}) => {
|
|
4849
|
-
return (0,
|
|
5129
|
+
return (0, import_react_query26.useQuery)({
|
|
4850
5130
|
queryKey,
|
|
4851
5131
|
queryFn: () => form_service_default.getImage({ data }).then((res) => {
|
|
4852
5132
|
if (res) {
|
|
@@ -4860,9 +5140,9 @@ var useGetImage = ({
|
|
|
4860
5140
|
var use_get_image_default = useGetImage;
|
|
4861
5141
|
|
|
4862
5142
|
// src/hooks/form/use-send-comment.ts
|
|
4863
|
-
var
|
|
5143
|
+
var import_react_query27 = require("@tanstack/react-query");
|
|
4864
5144
|
var useSendComment = () => {
|
|
4865
|
-
return (0,
|
|
5145
|
+
return (0, import_react_query27.useMutation)({
|
|
4866
5146
|
mutationFn: ({ data }) => form_service_default.sentComment({
|
|
4867
5147
|
data
|
|
4868
5148
|
})
|
|
@@ -4871,9 +5151,9 @@ var useSendComment = () => {
|
|
|
4871
5151
|
var use_send_comment_default = useSendComment;
|
|
4872
5152
|
|
|
4873
5153
|
// src/hooks/form/use-upload-image.ts
|
|
4874
|
-
var
|
|
5154
|
+
var import_react_query28 = require("@tanstack/react-query");
|
|
4875
5155
|
var useUploadImage = () => {
|
|
4876
|
-
return (0,
|
|
5156
|
+
return (0, import_react_query28.useMutation)({
|
|
4877
5157
|
mutationFn: ({ data }) => form_service_default.uploadImage({
|
|
4878
5158
|
data
|
|
4879
5159
|
})
|
|
@@ -4882,18 +5162,18 @@ var useUploadImage = () => {
|
|
|
4882
5162
|
var use_upload_image_default = useUploadImage;
|
|
4883
5163
|
|
|
4884
5164
|
// src/hooks/model/use-delete.ts
|
|
4885
|
-
var
|
|
5165
|
+
var import_react_query29 = require("@tanstack/react-query");
|
|
4886
5166
|
var useDelete = () => {
|
|
4887
|
-
return (0,
|
|
5167
|
+
return (0, import_react_query29.useMutation)({
|
|
4888
5168
|
mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
|
|
4889
5169
|
});
|
|
4890
5170
|
};
|
|
4891
5171
|
var use_delete_default = useDelete;
|
|
4892
5172
|
|
|
4893
5173
|
// src/hooks/model/use-get-all.ts
|
|
4894
|
-
var
|
|
5174
|
+
var import_react_query30 = require("@tanstack/react-query");
|
|
4895
5175
|
var useGetAll = ({ data, queryKey, viewResponse }) => {
|
|
4896
|
-
return (0,
|
|
5176
|
+
return (0, import_react_query30.useQuery)({
|
|
4897
5177
|
queryKey,
|
|
4898
5178
|
queryFn: () => model_service_default.getAll({ data }).then((res) => {
|
|
4899
5179
|
if (res) {
|
|
@@ -4908,9 +5188,9 @@ var useGetAll = ({ data, queryKey, viewResponse }) => {
|
|
|
4908
5188
|
var use_get_all_default = useGetAll;
|
|
4909
5189
|
|
|
4910
5190
|
// src/hooks/model/use-get-conversion-rate.ts
|
|
4911
|
-
var
|
|
5191
|
+
var import_react_query31 = require("@tanstack/react-query");
|
|
4912
5192
|
var useGetConversionRate = () => {
|
|
4913
|
-
return (0,
|
|
5193
|
+
return (0, import_react_query31.useQuery)({
|
|
4914
5194
|
queryKey: ["currency-rate"],
|
|
4915
5195
|
queryFn: () => model_service_default.getConversionRate().then((res) => {
|
|
4916
5196
|
if (res) {
|
|
@@ -4923,9 +5203,9 @@ var useGetConversionRate = () => {
|
|
|
4923
5203
|
var use_get_conversion_rate_default = useGetConversionRate;
|
|
4924
5204
|
|
|
4925
5205
|
// src/hooks/model/use-get-currency.ts
|
|
4926
|
-
var
|
|
5206
|
+
var import_react_query32 = require("@tanstack/react-query");
|
|
4927
5207
|
var useGetCurrency = () => {
|
|
4928
|
-
return (0,
|
|
5208
|
+
return (0, import_react_query32.useQuery)({
|
|
4929
5209
|
queryKey: ["currency"],
|
|
4930
5210
|
queryFn: () => model_service_default.getCurrency().then((res) => {
|
|
4931
5211
|
if (res) {
|
|
@@ -4938,9 +5218,9 @@ var useGetCurrency = () => {
|
|
|
4938
5218
|
var use_get_currency_default = useGetCurrency;
|
|
4939
5219
|
|
|
4940
5220
|
// src/hooks/model/use-get-detail.ts
|
|
4941
|
-
var
|
|
5221
|
+
var import_react_query33 = require("@tanstack/react-query");
|
|
4942
5222
|
var useGetDetail = () => {
|
|
4943
|
-
return (0,
|
|
5223
|
+
return (0, import_react_query33.useMutation)({
|
|
4944
5224
|
mutationFn: ({
|
|
4945
5225
|
model,
|
|
4946
5226
|
ids,
|
|
@@ -4957,9 +5237,9 @@ var useGetDetail = () => {
|
|
|
4957
5237
|
var use_get_detail_default = useGetDetail;
|
|
4958
5238
|
|
|
4959
5239
|
// src/hooks/model/use-get-field-onchange.ts
|
|
4960
|
-
var
|
|
5240
|
+
var import_react_query34 = require("@tanstack/react-query");
|
|
4961
5241
|
var useGetFieldOnChange = ({ model }) => {
|
|
4962
|
-
return (0,
|
|
5242
|
+
return (0, import_react_query34.useQuery)({
|
|
4963
5243
|
queryKey: [`field-onchange-${model}`, model],
|
|
4964
5244
|
queryFn: () => model_service_default.getListFieldsOnchange({
|
|
4965
5245
|
model
|
|
@@ -4975,13 +5255,13 @@ var useGetFieldOnChange = ({ model }) => {
|
|
|
4975
5255
|
var use_get_field_onchange_default = useGetFieldOnChange;
|
|
4976
5256
|
|
|
4977
5257
|
// src/hooks/model/use-get-list-my-bank-account.ts
|
|
4978
|
-
var
|
|
5258
|
+
var import_react_query35 = require("@tanstack/react-query");
|
|
4979
5259
|
var useGetListMyBankAccount = ({
|
|
4980
5260
|
domain,
|
|
4981
5261
|
spectification,
|
|
4982
5262
|
model
|
|
4983
5263
|
}) => {
|
|
4984
|
-
return (0,
|
|
5264
|
+
return (0, import_react_query35.useQuery)({
|
|
4985
5265
|
queryKey: ["bank-account", model, domain],
|
|
4986
5266
|
queryFn: () => model_service_default.getListMyBankAccount({
|
|
4987
5267
|
domain,
|
|
@@ -5133,9 +5413,9 @@ var useOdooDataTransform = () => {
|
|
|
5133
5413
|
var use_odoo_data_transform_default = useOdooDataTransform;
|
|
5134
5414
|
|
|
5135
5415
|
// src/hooks/model/use-onchange-form.ts
|
|
5136
|
-
var
|
|
5416
|
+
var import_react_query36 = require("@tanstack/react-query");
|
|
5137
5417
|
var useOnChangeForm = () => {
|
|
5138
|
-
return (0,
|
|
5418
|
+
return (0, import_react_query36.useMutation)({
|
|
5139
5419
|
mutationFn: ({
|
|
5140
5420
|
ids,
|
|
5141
5421
|
model,
|
|
@@ -5156,9 +5436,9 @@ var useOnChangeForm = () => {
|
|
|
5156
5436
|
var use_onchange_form_default = useOnChangeForm;
|
|
5157
5437
|
|
|
5158
5438
|
// src/hooks/model/use-save.ts
|
|
5159
|
-
var
|
|
5439
|
+
var import_react_query37 = require("@tanstack/react-query");
|
|
5160
5440
|
var useSave = () => {
|
|
5161
|
-
return (0,
|
|
5441
|
+
return (0, import_react_query37.useMutation)({
|
|
5162
5442
|
mutationFn: ({
|
|
5163
5443
|
ids,
|
|
5164
5444
|
model,
|
|
@@ -5172,18 +5452,18 @@ var useSave = () => {
|
|
|
5172
5452
|
var use_save_default = useSave;
|
|
5173
5453
|
|
|
5174
5454
|
// src/hooks/user/use-get-profile.ts
|
|
5175
|
-
var
|
|
5455
|
+
var import_react_query38 = require("@tanstack/react-query");
|
|
5176
5456
|
var useGetProfile = (path) => {
|
|
5177
|
-
return (0,
|
|
5457
|
+
return (0, import_react_query38.useMutation)({
|
|
5178
5458
|
mutationFn: () => user_service_default.getProfile(path)
|
|
5179
5459
|
});
|
|
5180
5460
|
};
|
|
5181
5461
|
var use_get_profile_default = useGetProfile;
|
|
5182
5462
|
|
|
5183
5463
|
// src/hooks/user/use-get-user.ts
|
|
5184
|
-
var
|
|
5464
|
+
var import_react_query39 = require("@tanstack/react-query");
|
|
5185
5465
|
var useGetUser = () => {
|
|
5186
|
-
return (0,
|
|
5466
|
+
return (0, import_react_query39.useMutation)({
|
|
5187
5467
|
mutationFn: ({ id, context }) => user_service_default.getUser({
|
|
5188
5468
|
id,
|
|
5189
5469
|
context
|
|
@@ -5193,9 +5473,9 @@ var useGetUser = () => {
|
|
|
5193
5473
|
var use_get_user_default = useGetUser;
|
|
5194
5474
|
|
|
5195
5475
|
// src/hooks/user/use-switch-locale.ts
|
|
5196
|
-
var
|
|
5476
|
+
var import_react_query40 = require("@tanstack/react-query");
|
|
5197
5477
|
var useSwitchLocale = () => {
|
|
5198
|
-
return (0,
|
|
5478
|
+
return (0, import_react_query40.useMutation)({
|
|
5199
5479
|
mutationFn: ({ data }) => {
|
|
5200
5480
|
return user_service_default.switchUserLocale({
|
|
5201
5481
|
id: data.id,
|
|
@@ -5207,9 +5487,9 @@ var useSwitchLocale = () => {
|
|
|
5207
5487
|
var use_switch_locale_default = useSwitchLocale;
|
|
5208
5488
|
|
|
5209
5489
|
// src/hooks/view/use-button.ts
|
|
5210
|
-
var
|
|
5490
|
+
var import_react_query41 = require("@tanstack/react-query");
|
|
5211
5491
|
var useButton = () => {
|
|
5212
|
-
return (0,
|
|
5492
|
+
return (0, import_react_query41.useMutation)({
|
|
5213
5493
|
mutationFn: ({
|
|
5214
5494
|
model,
|
|
5215
5495
|
ids,
|
|
@@ -5229,9 +5509,9 @@ var useButton = () => {
|
|
|
5229
5509
|
var use_button_default = useButton;
|
|
5230
5510
|
|
|
5231
5511
|
// src/hooks/view/use-duplicate-record.ts
|
|
5232
|
-
var
|
|
5512
|
+
var import_react_query42 = require("@tanstack/react-query");
|
|
5233
5513
|
var useDuplicateRecord = () => {
|
|
5234
|
-
return (0,
|
|
5514
|
+
return (0, import_react_query42.useMutation)({
|
|
5235
5515
|
mutationFn: ({
|
|
5236
5516
|
id,
|
|
5237
5517
|
model,
|
|
@@ -5246,7 +5526,7 @@ var useDuplicateRecord = () => {
|
|
|
5246
5526
|
var use_duplicate_record_default = useDuplicateRecord;
|
|
5247
5527
|
|
|
5248
5528
|
// src/hooks/view/use-get-action-detail.ts
|
|
5249
|
-
var
|
|
5529
|
+
var import_react_query43 = require("@tanstack/react-query");
|
|
5250
5530
|
var useGetActionDetail = ({
|
|
5251
5531
|
aid,
|
|
5252
5532
|
context,
|
|
@@ -5260,7 +5540,7 @@ var useGetActionDetail = ({
|
|
|
5260
5540
|
model: model ?? "",
|
|
5261
5541
|
context
|
|
5262
5542
|
};
|
|
5263
|
-
return (0,
|
|
5543
|
+
return (0, import_react_query43.useQuery)({
|
|
5264
5544
|
queryKey,
|
|
5265
5545
|
queryFn: async () => {
|
|
5266
5546
|
if (aid) {
|
|
@@ -5281,9 +5561,9 @@ var useGetActionDetail = ({
|
|
|
5281
5561
|
var use_get_action_detail_default = useGetActionDetail;
|
|
5282
5562
|
|
|
5283
5563
|
// src/hooks/view/use-get-calendar.ts
|
|
5284
|
-
var
|
|
5564
|
+
var import_react_query44 = require("@tanstack/react-query");
|
|
5285
5565
|
var useGetCalendar = (listDataProps, queryKey, enabled) => {
|
|
5286
|
-
return (0,
|
|
5566
|
+
return (0, import_react_query44.useQuery)({
|
|
5287
5567
|
queryKey,
|
|
5288
5568
|
queryFn: () => model_service_default.getListCalendar({ data: listDataProps }).then((res) => {
|
|
5289
5569
|
if (res) {
|
|
@@ -5299,12 +5579,12 @@ var useGetCalendar = (listDataProps, queryKey, enabled) => {
|
|
|
5299
5579
|
var use_get_calendar_default = useGetCalendar;
|
|
5300
5580
|
|
|
5301
5581
|
// src/hooks/view/use-get-groups.ts
|
|
5302
|
-
var
|
|
5582
|
+
var import_react_query45 = require("@tanstack/react-query");
|
|
5303
5583
|
var useGetGroups = ({
|
|
5304
5584
|
model,
|
|
5305
5585
|
width_context
|
|
5306
5586
|
}) => {
|
|
5307
|
-
return (0,
|
|
5587
|
+
return (0, import_react_query45.useQuery)({
|
|
5308
5588
|
queryKey: [model, width_context],
|
|
5309
5589
|
queryFn: () => kanban_service_default.getGroups({
|
|
5310
5590
|
model,
|
|
@@ -5321,9 +5601,9 @@ var useGetGroups = ({
|
|
|
5321
5601
|
var use_get_groups_default = useGetGroups;
|
|
5322
5602
|
|
|
5323
5603
|
// src/hooks/view/use-get-list-data.ts
|
|
5324
|
-
var
|
|
5604
|
+
var import_react_query46 = require("@tanstack/react-query");
|
|
5325
5605
|
var useGetListData = (listDataProps, queryKey, enabled) => {
|
|
5326
|
-
return (0,
|
|
5606
|
+
return (0, import_react_query46.useQuery)({
|
|
5327
5607
|
queryKey,
|
|
5328
5608
|
queryFn: () => model_service_default.getAll({ data: listDataProps }).then((res) => {
|
|
5329
5609
|
if (res) {
|
|
@@ -5339,9 +5619,9 @@ var useGetListData = (listDataProps, queryKey, enabled) => {
|
|
|
5339
5619
|
var use_get_list_data_default = useGetListData;
|
|
5340
5620
|
|
|
5341
5621
|
// src/hooks/view/use-get-menu.ts
|
|
5342
|
-
var
|
|
5622
|
+
var import_react_query47 = require("@tanstack/react-query");
|
|
5343
5623
|
var useGetMenu = (context, enabled) => {
|
|
5344
|
-
return (0,
|
|
5624
|
+
return (0, import_react_query47.useQuery)({
|
|
5345
5625
|
queryKey: ["menus" /* MENU */, context],
|
|
5346
5626
|
queryFn: () => view_service_default.getMenu(context).then((res) => {
|
|
5347
5627
|
if (res && res?.records && res?.records?.length > 0) {
|
|
@@ -5357,9 +5637,9 @@ var useGetMenu = (context, enabled) => {
|
|
|
5357
5637
|
var use_get_menu_default = useGetMenu;
|
|
5358
5638
|
|
|
5359
5639
|
// src/hooks/view/use-get-print-report.ts
|
|
5360
|
-
var
|
|
5640
|
+
var import_react_query48 = require("@tanstack/react-query");
|
|
5361
5641
|
var useGetPrintReport = () => {
|
|
5362
|
-
return (0,
|
|
5642
|
+
return (0, import_react_query48.useMutation)({
|
|
5363
5643
|
mutationFn: ({ id }) => action_service_default.getPrintReportName({
|
|
5364
5644
|
id
|
|
5365
5645
|
})
|
|
@@ -5368,14 +5648,14 @@ var useGetPrintReport = () => {
|
|
|
5368
5648
|
var use_get_print_report_default = useGetPrintReport;
|
|
5369
5649
|
|
|
5370
5650
|
// src/hooks/view/use-get-progress-bar.ts
|
|
5371
|
-
var
|
|
5651
|
+
var import_react_query49 = require("@tanstack/react-query");
|
|
5372
5652
|
var useGetProGressBar = ({
|
|
5373
5653
|
field,
|
|
5374
5654
|
color,
|
|
5375
5655
|
model,
|
|
5376
5656
|
width_context
|
|
5377
5657
|
}) => {
|
|
5378
|
-
return (0,
|
|
5658
|
+
return (0, import_react_query49.useQuery)({
|
|
5379
5659
|
queryKey: [],
|
|
5380
5660
|
queryFn: () => kanban_service_default.getProgressBar({
|
|
5381
5661
|
field,
|
|
@@ -5394,13 +5674,13 @@ var useGetProGressBar = ({
|
|
|
5394
5674
|
var use_get_progress_bar_default = useGetProGressBar;
|
|
5395
5675
|
|
|
5396
5676
|
// src/hooks/view/use-get-selection.ts
|
|
5397
|
-
var
|
|
5677
|
+
var import_react_query50 = require("@tanstack/react-query");
|
|
5398
5678
|
var useGetSelection = ({
|
|
5399
5679
|
data,
|
|
5400
5680
|
queryKey,
|
|
5401
5681
|
enabled
|
|
5402
5682
|
}) => {
|
|
5403
|
-
return (0,
|
|
5683
|
+
return (0, import_react_query50.useQuery)({
|
|
5404
5684
|
queryKey,
|
|
5405
5685
|
queryFn: () => view_service_default.getSelectionItem({ data }),
|
|
5406
5686
|
enabled,
|
|
@@ -5410,9 +5690,9 @@ var useGetSelection = ({
|
|
|
5410
5690
|
var use_get_selection_default = useGetSelection;
|
|
5411
5691
|
|
|
5412
5692
|
// src/hooks/view/use-get-view.ts
|
|
5413
|
-
var
|
|
5693
|
+
var import_react_query51 = require("@tanstack/react-query");
|
|
5414
5694
|
var useGetView = (viewParams, actData) => {
|
|
5415
|
-
return (0,
|
|
5695
|
+
return (0, import_react_query51.useQuery)({
|
|
5416
5696
|
queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
|
|
5417
5697
|
queryFn: () => view_service_default.getView(viewParams),
|
|
5418
5698
|
enabled: !!actData,
|
|
@@ -5423,9 +5703,9 @@ var useGetView = (viewParams, actData) => {
|
|
|
5423
5703
|
var use_get_view_default = useGetView;
|
|
5424
5704
|
|
|
5425
5705
|
// src/hooks/view/use-load-action.ts
|
|
5426
|
-
var
|
|
5706
|
+
var import_react_query52 = require("@tanstack/react-query");
|
|
5427
5707
|
var useLoadAction = () => {
|
|
5428
|
-
return (0,
|
|
5708
|
+
return (0, import_react_query52.useMutation)({
|
|
5429
5709
|
mutationFn: ({
|
|
5430
5710
|
idAction,
|
|
5431
5711
|
context
|
|
@@ -5440,9 +5720,9 @@ var useLoadAction = () => {
|
|
|
5440
5720
|
var use_load_action_default = useLoadAction;
|
|
5441
5721
|
|
|
5442
5722
|
// src/hooks/view/use-load-message.ts
|
|
5443
|
-
var
|
|
5723
|
+
var import_react_query53 = require("@tanstack/react-query");
|
|
5444
5724
|
var useLoadMessage = () => {
|
|
5445
|
-
return (0,
|
|
5725
|
+
return (0, import_react_query53.useQuery)({
|
|
5446
5726
|
queryKey: [`load-message-failure`],
|
|
5447
5727
|
queryFn: () => view_service_default.loadMessages(),
|
|
5448
5728
|
refetchOnWindowFocus: false
|
|
@@ -5451,9 +5731,9 @@ var useLoadMessage = () => {
|
|
|
5451
5731
|
var use_load_message_default = useLoadMessage;
|
|
5452
5732
|
|
|
5453
5733
|
// src/hooks/view/use-print.ts
|
|
5454
|
-
var
|
|
5734
|
+
var import_react_query54 = require("@tanstack/react-query");
|
|
5455
5735
|
var usePrint = () => {
|
|
5456
|
-
return (0,
|
|
5736
|
+
return (0, import_react_query54.useMutation)({
|
|
5457
5737
|
mutationFn: ({ id, report, db }) => action_service_default.print({
|
|
5458
5738
|
id,
|
|
5459
5739
|
report,
|
|
@@ -5464,9 +5744,9 @@ var usePrint = () => {
|
|
|
5464
5744
|
var use_print_default = usePrint;
|
|
5465
5745
|
|
|
5466
5746
|
// src/hooks/view/use-remove-row.ts
|
|
5467
|
-
var
|
|
5747
|
+
var import_react_query55 = require("@tanstack/react-query");
|
|
5468
5748
|
var useRemoveRow = () => {
|
|
5469
|
-
return (0,
|
|
5749
|
+
return (0, import_react_query55.useMutation)({
|
|
5470
5750
|
mutationFn: ({
|
|
5471
5751
|
model,
|
|
5472
5752
|
ids,
|
|
@@ -5481,9 +5761,9 @@ var useRemoveRow = () => {
|
|
|
5481
5761
|
var use_remove_row_default = useRemoveRow;
|
|
5482
5762
|
|
|
5483
5763
|
// src/hooks/view/use-resequence.ts
|
|
5484
|
-
var
|
|
5764
|
+
var import_react_query56 = require("@tanstack/react-query");
|
|
5485
5765
|
var useGetResequence = (model, resIds, context, offset) => {
|
|
5486
|
-
return (0,
|
|
5766
|
+
return (0, import_react_query56.useQuery)({
|
|
5487
5767
|
queryKey: [],
|
|
5488
5768
|
queryFn: () => view_service_default.getResequence({
|
|
5489
5769
|
model,
|
|
@@ -5498,9 +5778,9 @@ var useGetResequence = (model, resIds, context, offset) => {
|
|
|
5498
5778
|
var use_resequence_default = useGetResequence;
|
|
5499
5779
|
|
|
5500
5780
|
// src/hooks/view/use-run-action.ts
|
|
5501
|
-
var
|
|
5781
|
+
var import_react_query57 = require("@tanstack/react-query");
|
|
5502
5782
|
var useRunAction = () => {
|
|
5503
|
-
return (0,
|
|
5783
|
+
return (0, import_react_query57.useMutation)({
|
|
5504
5784
|
mutationFn: ({
|
|
5505
5785
|
idAction,
|
|
5506
5786
|
context
|
|
@@ -5513,9 +5793,9 @@ var useRunAction = () => {
|
|
|
5513
5793
|
var use_run_action_default = useRunAction;
|
|
5514
5794
|
|
|
5515
5795
|
// src/hooks/view/use-signin-sso.ts
|
|
5516
|
-
var
|
|
5796
|
+
var import_react_query58 = require("@tanstack/react-query");
|
|
5517
5797
|
var useSignInSSO = () => {
|
|
5518
|
-
return (0,
|
|
5798
|
+
return (0, import_react_query58.useMutation)({
|
|
5519
5799
|
mutationFn: ({
|
|
5520
5800
|
redirect_uri,
|
|
5521
5801
|
state,
|
|
@@ -5536,9 +5816,9 @@ var useSignInSSO = () => {
|
|
|
5536
5816
|
var use_signin_sso_default = useSignInSSO;
|
|
5537
5817
|
|
|
5538
5818
|
// src/hooks/view/use-verify-2FA.ts
|
|
5539
|
-
var
|
|
5819
|
+
var import_react_query59 = require("@tanstack/react-query");
|
|
5540
5820
|
var useVerify2FA = () => {
|
|
5541
|
-
return (0,
|
|
5821
|
+
return (0, import_react_query59.useMutation)({
|
|
5542
5822
|
mutationFn: ({
|
|
5543
5823
|
method,
|
|
5544
5824
|
with_context,
|
|
@@ -5559,9 +5839,9 @@ var useVerify2FA = () => {
|
|
|
5559
5839
|
var use_verify_2FA_default = useVerify2FA;
|
|
5560
5840
|
|
|
5561
5841
|
// src/hooks/view/uset-get-2FA-method.ts
|
|
5562
|
-
var
|
|
5842
|
+
var import_react_query60 = require("@tanstack/react-query");
|
|
5563
5843
|
var useGet2FAMethods = () => {
|
|
5564
|
-
return (0,
|
|
5844
|
+
return (0, import_react_query60.useMutation)({
|
|
5565
5845
|
mutationFn: ({
|
|
5566
5846
|
method,
|
|
5567
5847
|
with_context
|
|
@@ -5576,9 +5856,9 @@ var useGet2FAMethods = () => {
|
|
|
5576
5856
|
var uset_get_2FA_method_default = useGet2FAMethods;
|
|
5577
5857
|
|
|
5578
5858
|
// src/hooks/view/use-get-fields-view-security.ts
|
|
5579
|
-
var
|
|
5859
|
+
var import_react_query61 = require("@tanstack/react-query");
|
|
5580
5860
|
var useGetFieldsViewSecurity = () => {
|
|
5581
|
-
return (0,
|
|
5861
|
+
return (0, import_react_query61.useMutation)({
|
|
5582
5862
|
mutationFn: ({
|
|
5583
5863
|
method,
|
|
5584
5864
|
token,
|
|
@@ -5595,9 +5875,9 @@ var useGetFieldsViewSecurity = () => {
|
|
|
5595
5875
|
var use_get_fields_view_security_default = useGetFieldsViewSecurity;
|
|
5596
5876
|
|
|
5597
5877
|
// src/hooks/view/use-grant-access.ts
|
|
5598
|
-
var
|
|
5878
|
+
var import_react_query62 = require("@tanstack/react-query");
|
|
5599
5879
|
var useGrantAccess = () => {
|
|
5600
|
-
return (0,
|
|
5880
|
+
return (0, import_react_query62.useMutation)({
|
|
5601
5881
|
mutationFn: ({
|
|
5602
5882
|
redirect_uri,
|
|
5603
5883
|
state,
|
|
@@ -5616,9 +5896,9 @@ var useGrantAccess = () => {
|
|
|
5616
5896
|
var use_grant_access_default = useGrantAccess;
|
|
5617
5897
|
|
|
5618
5898
|
// src/hooks/view/use-remove-totp-setup.ts
|
|
5619
|
-
var
|
|
5899
|
+
var import_react_query63 = require("@tanstack/react-query");
|
|
5620
5900
|
var useRemoveTotpSetup = () => {
|
|
5621
|
-
return (0,
|
|
5901
|
+
return (0, import_react_query63.useMutation)({
|
|
5622
5902
|
mutationFn: ({ method, token }) => {
|
|
5623
5903
|
return view_service_default.removeTotpSetUp({
|
|
5624
5904
|
method,
|
|
@@ -5630,9 +5910,9 @@ var useRemoveTotpSetup = () => {
|
|
|
5630
5910
|
var use_remove_totp_setup_default = useRemoveTotpSetup;
|
|
5631
5911
|
|
|
5632
5912
|
// src/hooks/view/use-request-setup-totp.ts
|
|
5633
|
-
var
|
|
5913
|
+
var import_react_query64 = require("@tanstack/react-query");
|
|
5634
5914
|
var useRequestSetupTotp = () => {
|
|
5635
|
-
return (0,
|
|
5915
|
+
return (0, import_react_query64.useMutation)({
|
|
5636
5916
|
mutationFn: ({ method, token }) => {
|
|
5637
5917
|
return view_service_default.requestSetupTotp({
|
|
5638
5918
|
method,
|
|
@@ -5644,9 +5924,9 @@ var useRequestSetupTotp = () => {
|
|
|
5644
5924
|
var use_request_setup_totp_default = useRequestSetupTotp;
|
|
5645
5925
|
|
|
5646
5926
|
// src/hooks/view/use-settings-web-read-2fa.ts
|
|
5647
|
-
var
|
|
5927
|
+
var import_react_query65 = require("@tanstack/react-query");
|
|
5648
5928
|
var useSettingsWebRead2fa = () => {
|
|
5649
|
-
return (0,
|
|
5929
|
+
return (0, import_react_query65.useMutation)({
|
|
5650
5930
|
mutationFn: ({
|
|
5651
5931
|
method,
|
|
5652
5932
|
token,
|
|
@@ -5665,9 +5945,9 @@ var useSettingsWebRead2fa = () => {
|
|
|
5665
5945
|
var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
|
|
5666
5946
|
|
|
5667
5947
|
// src/hooks/view/use-verify-totp.ts
|
|
5668
|
-
var
|
|
5948
|
+
var import_react_query66 = require("@tanstack/react-query");
|
|
5669
5949
|
var useVerifyTotp = () => {
|
|
5670
|
-
return (0,
|
|
5950
|
+
return (0, import_react_query66.useMutation)({
|
|
5671
5951
|
mutationFn: ({
|
|
5672
5952
|
method,
|
|
5673
5953
|
action_token,
|
|
@@ -5750,7 +6030,6 @@ var use_verify_totp_default = useVerifyTotp;
|
|
|
5750
6030
|
useUploadFile,
|
|
5751
6031
|
useUploadIdFile,
|
|
5752
6032
|
useUploadImage,
|
|
5753
|
-
useValidateActionToken,
|
|
5754
6033
|
useVerify2FA,
|
|
5755
6034
|
useVerifyTotp
|
|
5756
6035
|
});
|