@raclettejs/core 0.1.10 → 0.1.12
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/CHANGELOG.md +59 -2
- package/dist/cli.js +104 -104
- package/dist/cli.js.map +7 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +7 -0
- package/package.json +32 -31
- package/services/backend/package.json +35 -45
- package/services/backend/src/core/payload/payloadTypes.ts +7 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/routes/route.account.get.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/account/routes/route.account.getAll.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/composition.model.ts +5 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/composition.schema.ts +1 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/composition.service.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/routes/route.composition.get.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/composition/routes/route.composition.getAll.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/helpers/payload.ts +6 -2
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/routes/route.interactionLink.get.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/interactionLink/routes/route.interactionLink.getAll.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/routes/route.project.get.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/project/routes/route.project.getAll.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/index.ts +2 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/routes/route.tag.get.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/routes/route.tag.getAll.ts +6 -2
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/tag/tag.service.ts +22 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/route.user.get.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/route.user.getAll.ts +1 -1
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/routes/route.user.remove.ts +3 -0
- package/services/backend/src/corePlugins/raclette__core/backend/datatypes/user/user.service.ts +1 -2
- package/services/backend/src/corePlugins/raclette__core/frontend/generated-config.ts +12 -12
- package/services/backend/src/domains/index.ts +3 -0
- package/services/backend/src/domains/system/collections.service.ts +119 -0
- package/services/backend/src/domains/system/index.ts +8 -0
- package/services/backend/src/domains/system/routes/index.ts +5 -0
- package/services/backend/src/domains/system/routes/route.collection.getAll.ts +61 -0
- package/services/backend/src/domains/system/routes/route.collection.remove.ts +93 -0
- package/services/backend/src/types/custom-fastify.d.ts +1 -0
- package/services/backend/src/utils/request.utils.ts +28 -1
- package/services/backend/yarn.lock +431 -1180
- package/services/frontend/package.json +29 -40
- package/services/frontend/src/core/constants/ApiClient.ts +6 -1
- package/services/frontend/src/core/lib/data/dataApi.ts +8 -1
- package/services/frontend/src/core/lib/data/fetchDataHandler.ts +58 -27
- package/services/frontend/src/core/lib/data/queryApi.ts +29 -8
- package/services/frontend/src/core/lib/data/responseTypeHandler.ts +27 -4
- package/services/frontend/src/core/lib/data/writeDataHandler.ts +1 -1
- package/services/frontend/src/core/lib/dataHelper.ts +8 -1
- package/services/frontend/src/core/lib/easteregg.ts +1 -1
- package/services/frontend/src/core/lib/eventEmitter.ts +1 -0
- package/services/frontend/src/core/lib/eventWhitelist.ts +11 -1
- package/services/frontend/src/core/lib/logger.ts +11 -3
- package/services/frontend/src/core/lib/userNotifier.ts +17 -17
- package/services/frontend/src/core/main.ts +3 -3
- package/services/frontend/src/core/setup/plugin-system/api/wrappers.ts +18 -1
- package/services/frontend/src/core/setup/plugin-system/registration/index.ts +1 -1
- package/services/frontend/src/core/setup/socketClient.ts +2 -2
- package/services/frontend/src/core/setup/socketEvents.ts +2 -2
- package/services/frontend/src/core/store/reducers/compositions/selectors.ts +2 -2
- package/services/frontend/src/core/store/reducers/data/index.ts +1 -1
- package/services/frontend/src/core/store/reducers/data/reducers.ts +3 -3
- package/services/frontend/src/core/store/reducers/queries/effects.ts +20 -1
- package/services/frontend/src/core/store/reducers/queries/index.ts +1 -0
- package/services/frontend/src/core/store/reducers/queries/reducers.ts +28 -1
- package/services/frontend/src/core/store/reducers/queriesCache/queryCacheHelper.ts +5 -4
- package/services/frontend/src/core/store/reducers/queriesCache/reducers.ts +4 -3
- package/services/frontend/src/core/store/state.ts +1 -1
- package/services/frontend/src/core/types/ApiClient.ts +1 -1
- package/services/frontend/src/core/types/DataApi.ts +4 -0
- package/services/frontend/src/core/types/Queries.ts +1 -0
- package/services/frontend/src/orchestrator/ProductOrchestrator.vue +19 -7
- package/services/frontend/src/orchestrator/WelcomeScreen.vue +39 -41
- package/services/frontend/src/orchestrator/assets/styles/tailwindStyles.css +3 -0
- package/services/frontend/src/orchestrator/assets/styles/themes/dark.ts +2 -2
- package/services/frontend/src/orchestrator/assets/styles/vuetifyStyles.scss +0 -1
- package/services/frontend/src/orchestrator/components/composition/CompositionOverlay.vue +11 -2
- package/services/frontend/src/orchestrator/components/composition/WidgetsLayoutLoader.vue +167 -58
- package/services/frontend/src/orchestrator/components/menu/DevIndicator.vue +122 -7
- package/services/frontend/src/orchestrator/components/menu/UserMenu.vue +38 -20
- package/services/frontend/src/orchestrator/components/snackbar/SnackStack.vue +17 -5
- package/services/frontend/src/orchestrator/composables/useCurrentComposition.ts +32 -4
- package/services/frontend/src/orchestrator/composables/usePageNavigation.ts +5 -1
- package/services/frontend/src/orchestrator/composables/usePluginApi.ts +125 -26
- package/services/frontend/src/orchestrator/composables/useRouteState.ts +0 -1
- package/services/frontend/src/orchestrator/composables/useVueQueryObservableHelper.ts +2 -0
- package/services/frontend/src/orchestrator/composables/useVueWriteOperationHelper.ts +5 -3
- package/services/frontend/src/orchestrator/composables/useWidgets/helperFunctions.ts +4 -1
- package/services/frontend/src/orchestrator/helpers/loginUserNotifications.ts +1 -1
- package/services/frontend/src/orchestrator/helpers/uiHelper.ts +1 -1
- package/services/frontend/src/orchestrator/i18n/de-DE.json +2 -1
- package/services/frontend/src/orchestrator/i18n/en-EU.json +2 -1
- package/services/frontend/src/orchestrator/i18n/sk.json +2 -1
- package/services/frontend/src/orchestrator/i18n/tl-TL.json +1 -1
- package/services/frontend/src/orchestrator/router/routeParserHelper.ts +4 -1
- package/services/frontend/src/orchestrator/router/routeStore.ts +78 -11
- package/services/frontend/tsconfig.app.json +1 -0
- package/services/frontend/yarn.lock +796 -1872
- package/yarn.lock +435 -618
|
@@ -16,57 +16,46 @@
|
|
|
16
16
|
"format": "prettier --write src/"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@date-io/date-fns": "
|
|
19
|
+
"@date-io/date-fns": "3.2.1",
|
|
20
20
|
"@mdi/font": "7.4.47",
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
24
|
-
"@vueuse/
|
|
25
|
-
"
|
|
21
|
+
"@sinclair/typebox": "0.34.41",
|
|
22
|
+
"@tailwindcss/vite": "4.1.13",
|
|
23
|
+
"@tsconfig/node20": "20.1.6",
|
|
24
|
+
"@vueuse/core": "13.9.0",
|
|
25
|
+
"@vueuse/rxjs": "13.9.0",
|
|
26
|
+
"axios": "1.12.2",
|
|
26
27
|
"date-fns": "4.1.0",
|
|
27
28
|
"esm": "3.x",
|
|
28
|
-
"interactjs": "
|
|
29
|
+
"interactjs": "1.10.27",
|
|
29
30
|
"mini-rx-store": "6.1.2",
|
|
30
31
|
"nanoid": "5.1.5",
|
|
31
32
|
"ramda": "0.31.3",
|
|
32
33
|
"rxjs": "7.x",
|
|
33
|
-
"sass": "
|
|
34
|
+
"sass": "1.92.1",
|
|
34
35
|
"socket.io-client": "4.x",
|
|
35
|
-
"tailwindcss": "
|
|
36
|
-
"uuid": "
|
|
37
|
-
"vue": "
|
|
38
|
-
"vue-i18n": "11.1.
|
|
39
|
-
"vue-konva": "^3.2.1",
|
|
36
|
+
"tailwindcss": "4.1.13",
|
|
37
|
+
"uuid": "13.0.0",
|
|
38
|
+
"vue": "3.5.21",
|
|
39
|
+
"vue-i18n": "11.1.12",
|
|
40
40
|
"vue-router": "4.5.1",
|
|
41
|
-
"vuetify": "3.
|
|
41
|
+
"vuetify": "3.10.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/node": "
|
|
45
|
-
"@types/ramda": "
|
|
46
|
-
"@vitejs/plugin-vue": "6.0.
|
|
47
|
-
"@vue/
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"eslint": "^9.34.0",
|
|
51
|
-
"eslint-config-prettier": "^10.1.5",
|
|
52
|
-
"eslint-config-standard": "17.1.0",
|
|
53
|
-
"eslint-plugin-arrowsmith": "^1.1.0",
|
|
54
|
-
"eslint-plugin-cypress": "5.1.0",
|
|
44
|
+
"@types/node": "24.5.1",
|
|
45
|
+
"@types/ramda": "0.31.1",
|
|
46
|
+
"@vitejs/plugin-vue": "6.0.1",
|
|
47
|
+
"@vue/tsconfig": "0.8.1",
|
|
48
|
+
"eslint": "9.35.0",
|
|
49
|
+
"eslint-config-prettier": "10.1.8",
|
|
55
50
|
"eslint-plugin-import": "2.32.0",
|
|
56
|
-
"eslint-plugin-
|
|
57
|
-
"eslint-plugin-
|
|
58
|
-
"eslint-plugin-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"prettier-eslint": "^16.4.2",
|
|
66
|
-
"typescript": "^5.8.3",
|
|
67
|
-
"vite": "7.0.4",
|
|
68
|
-
"vitest": "3.2.4",
|
|
69
|
-
"vue-eslint-parser": "^10.2.0",
|
|
70
|
-
"vue-tsc": "^3.0.1"
|
|
51
|
+
"eslint-plugin-prefer-arrow-functions": "3.8.1",
|
|
52
|
+
"eslint-plugin-tailwindcss": "4.0.0-beta.0",
|
|
53
|
+
"eslint-plugin-vue": "10.4.0",
|
|
54
|
+
"globals": "16.4.0",
|
|
55
|
+
"prettier": "3.6.2",
|
|
56
|
+
"typescript": "5.9.2",
|
|
57
|
+
"vite": "7.1.5",
|
|
58
|
+
"vue-eslint-parser": "10.2.0",
|
|
59
|
+
"vue-tsc": "3.0.7"
|
|
71
60
|
}
|
|
72
61
|
}
|
|
@@ -8,4 +8,9 @@ export const cudOperationTypesList = [
|
|
|
8
8
|
"dataDelete",
|
|
9
9
|
"dataHardDeleted",
|
|
10
10
|
] as const
|
|
11
|
-
export const readOperationTypesList = [
|
|
11
|
+
export const readOperationTypesList = [
|
|
12
|
+
"dataReadModified",
|
|
13
|
+
"dataRead",
|
|
14
|
+
"dataAdd",
|
|
15
|
+
"dataSync",
|
|
16
|
+
]
|
|
@@ -63,10 +63,17 @@ const $writeDataApi = (
|
|
|
63
63
|
return resultData
|
|
64
64
|
},
|
|
65
65
|
// Method to complete the subjects when cleanup is needed
|
|
66
|
-
|
|
66
|
+
remove: () => {
|
|
67
67
|
isLoadingSubject$.complete()
|
|
68
68
|
dataSubject$.complete()
|
|
69
69
|
errorSubject$.complete()
|
|
70
|
+
responseSubject$.complete()
|
|
71
|
+
},
|
|
72
|
+
clear: () => {
|
|
73
|
+
dataSubject$.next({})
|
|
74
|
+
errorSubject$.next({})
|
|
75
|
+
isLoadingSubject$.next(false)
|
|
76
|
+
dataSubject$.next({})
|
|
70
77
|
},
|
|
71
78
|
}
|
|
72
79
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import log from "@racletteCore/lib/logger"
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
promisifyActionResolve,
|
|
4
|
+
markDataAsModified,
|
|
5
|
+
} from "@racletteCore/lib/dataHelper"
|
|
3
6
|
import { $api, $store } from "@racletteCore"
|
|
4
7
|
import {
|
|
5
8
|
pluginReadOperations,
|
|
@@ -10,6 +13,7 @@ import {
|
|
|
10
13
|
getCacheQueryAndHash,
|
|
11
14
|
isParentResultFresh,
|
|
12
15
|
} from "@racletteCore/store/reducers/queriesCache/queryCacheHelper"
|
|
16
|
+
import { $eventbus } from "@racletteCore"
|
|
13
17
|
|
|
14
18
|
// to be replaced with actual open search availability state
|
|
15
19
|
let isOnline = true
|
|
@@ -63,7 +67,6 @@ const itemDispatcher = async (
|
|
|
63
67
|
const { actionId, cacheKey } = actionIdentifier
|
|
64
68
|
const { result, backendQueryParams } = resultObj
|
|
65
69
|
const resolveId = actionId + "_resolve"
|
|
66
|
-
|
|
67
70
|
if (remote) {
|
|
68
71
|
$store.dispatch({
|
|
69
72
|
type: "data/addFromServer",
|
|
@@ -81,7 +84,6 @@ const itemDispatcher = async (
|
|
|
81
84
|
type: "queries/update",
|
|
82
85
|
payload: {
|
|
83
86
|
actionId,
|
|
84
|
-
cacheKey,
|
|
85
87
|
backend: backendQueryParams,
|
|
86
88
|
},
|
|
87
89
|
})
|
|
@@ -124,7 +126,13 @@ const cacheOperations = {
|
|
|
124
126
|
target,
|
|
125
127
|
},
|
|
126
128
|
})
|
|
127
|
-
|
|
129
|
+
await $store.dispatch({
|
|
130
|
+
type: "queries/setCacheKey",
|
|
131
|
+
payload: {
|
|
132
|
+
cacheKey: cachedQuery.hash,
|
|
133
|
+
actionId,
|
|
134
|
+
},
|
|
135
|
+
})
|
|
128
136
|
return { cachedQuery, actionIdentifier }
|
|
129
137
|
},
|
|
130
138
|
|
|
@@ -163,8 +171,12 @@ const finishRemoteQuery = (actionIdentifier, result, params, options) => {
|
|
|
163
171
|
if (!result.data) {
|
|
164
172
|
return
|
|
165
173
|
}
|
|
174
|
+
let resultBody = structuredClone(result.data.body)
|
|
175
|
+
const { type } = result.data
|
|
176
|
+
if (type === "dataReadModified") {
|
|
177
|
+
resultBody = markDataAsModified(resultBody)
|
|
178
|
+
}
|
|
166
179
|
|
|
167
|
-
const resultBody = structuredClone(result.data.body)
|
|
168
180
|
const resultObj = {
|
|
169
181
|
result: [],
|
|
170
182
|
backendQueryParams: {},
|
|
@@ -225,8 +237,20 @@ const handleRemoteRequest = async (
|
|
|
225
237
|
try {
|
|
226
238
|
const response =
|
|
227
239
|
method === "GET"
|
|
228
|
-
? await $api.axios.get(target, config)
|
|
229
|
-
|
|
240
|
+
? await $api.axios.get(target, config).catch((e) => {
|
|
241
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
242
|
+
message: e.response.data.message,
|
|
243
|
+
color: "error",
|
|
244
|
+
})
|
|
245
|
+
throw e
|
|
246
|
+
})
|
|
247
|
+
: await $api.axios.post(target, params, config).catch((e) => {
|
|
248
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
249
|
+
message: e.response.data.message,
|
|
250
|
+
color: "error",
|
|
251
|
+
})
|
|
252
|
+
throw e
|
|
253
|
+
})
|
|
230
254
|
|
|
231
255
|
return {
|
|
232
256
|
response,
|
|
@@ -408,14 +432,16 @@ const executeRoute = async (actionIdentifier, validTarget, params, options) => {
|
|
|
408
432
|
params,
|
|
409
433
|
options,
|
|
410
434
|
controller.signal,
|
|
411
|
-
)
|
|
435
|
+
).catch((e) => {
|
|
436
|
+
log.error(e.error, e.message)
|
|
437
|
+
})
|
|
412
438
|
requestControllerManager.cleanup(actionIdentifier.actionId)
|
|
413
439
|
return result
|
|
414
440
|
} catch (error) {
|
|
415
441
|
requestControllerManager.cleanup(actionIdentifier.actionId)
|
|
416
442
|
|
|
417
443
|
if (error.name === "AbortError" || error.name === "CanceledError") {
|
|
418
|
-
|
|
444
|
+
log.api(
|
|
419
445
|
"HTTP request was cancelled for actionId:",
|
|
420
446
|
actionIdentifier.actionId,
|
|
421
447
|
)
|
|
@@ -438,29 +464,34 @@ const getData = async (actionId, target, params, options) => {
|
|
|
438
464
|
|
|
439
465
|
// Handle plugin routing
|
|
440
466
|
const { validTarget } = await handlePluginReadRoutes(actionId, target, params)
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
)
|
|
449
|
-
// Check cache
|
|
450
|
-
if (cachedQuery?.query) {
|
|
451
|
-
const cacheResult = await cacheOperations.handleCacheHit(
|
|
452
|
-
cachedQuery,
|
|
453
|
-
actionIdentifier,
|
|
467
|
+
if (options?.useCache !== false) {
|
|
468
|
+
// Setup cache
|
|
469
|
+
const { cachedQuery, actionIdentifier } = await cacheOperations.setupCache(
|
|
470
|
+
actionId,
|
|
471
|
+
validTarget,
|
|
472
|
+
params,
|
|
473
|
+
options,
|
|
454
474
|
)
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
475
|
+
// Check cache
|
|
476
|
+
if (cachedQuery?.query) {
|
|
477
|
+
const cacheResult = await cacheOperations.handleCacheHit(
|
|
478
|
+
cachedQuery,
|
|
479
|
+
actionIdentifier,
|
|
480
|
+
)
|
|
481
|
+
if (cacheResult !== null) {
|
|
482
|
+
return {
|
|
483
|
+
response: "cached_" + cachedQuery.hash,
|
|
484
|
+
result: cacheResult,
|
|
485
|
+
}
|
|
459
486
|
}
|
|
460
487
|
}
|
|
488
|
+
|
|
489
|
+
// Execute route
|
|
490
|
+
return executeRoute(actionIdentifier, validTarget, params, options)
|
|
461
491
|
}
|
|
492
|
+
|
|
462
493
|
// Execute route
|
|
463
|
-
return executeRoute(
|
|
494
|
+
return executeRoute({ actionId }, validTarget, params, options)
|
|
464
495
|
}
|
|
465
496
|
|
|
466
497
|
export default getData
|
|
@@ -8,14 +8,16 @@ import type { CustomStoreActionsPayload } from "@racletteCore/types"
|
|
|
8
8
|
import { BehaviorSubject } from "rxjs"
|
|
9
9
|
import { mergeDeepRight, clone } from "ramda"
|
|
10
10
|
|
|
11
|
+
const callbacks = {}
|
|
11
12
|
const queryApis = {}
|
|
12
13
|
|
|
13
14
|
export const $queryApi = (
|
|
14
15
|
actionId: string,
|
|
15
16
|
target = "",
|
|
16
|
-
{ params = {}, options = {} }: CustomStoreActionsPayload = {},
|
|
17
|
+
{ params = {}, options = {}, config = {} }: CustomStoreActionsPayload = {},
|
|
17
18
|
) => {
|
|
18
19
|
if (queryApis[actionId] && !target.length) {
|
|
20
|
+
// Early return existing queryApi
|
|
19
21
|
return queryApis[actionId]
|
|
20
22
|
}
|
|
21
23
|
const errorSubject$ = new BehaviorSubject(null)
|
|
@@ -24,13 +26,22 @@ export const $queryApi = (
|
|
|
24
26
|
// check if we have a query fullfilling the needs of the one requested
|
|
25
27
|
// here. If not we will update the one with this actionId
|
|
26
28
|
let actionType = "queries/add"
|
|
27
|
-
|
|
29
|
+
if (!options.hasOwnProperty("useCache")) {
|
|
30
|
+
options.useCache = true
|
|
31
|
+
}
|
|
32
|
+
if (options.cb) {
|
|
33
|
+
// remove callback function to prevent it from tainting the store reducers
|
|
34
|
+
callbacks[actionId] = options.cb
|
|
35
|
+
delete options.cb
|
|
36
|
+
}
|
|
28
37
|
$store.dispatch({
|
|
29
38
|
type: actionType,
|
|
30
39
|
payload: {
|
|
31
40
|
actionId,
|
|
32
41
|
target,
|
|
33
42
|
params: cleanedParams,
|
|
43
|
+
options,
|
|
44
|
+
config,
|
|
34
45
|
},
|
|
35
46
|
})
|
|
36
47
|
const queryApi = {
|
|
@@ -38,11 +49,21 @@ export const $queryApi = (
|
|
|
38
49
|
response$: responseSubject$.asObservable(),
|
|
39
50
|
query$: $store.select((state) => state.queries[actionId]),
|
|
40
51
|
uuids$: $store.select((state) => state.queries[actionId].uuids),
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
clear: async () => {
|
|
53
|
+
errorSubject$.next({})
|
|
54
|
+
responseSubject$.next({})
|
|
55
|
+
await $store.dispatch({
|
|
56
|
+
type: "queries/updateItems",
|
|
57
|
+
payload: { items: {}, actionId },
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
remove: async () => {
|
|
61
|
+
await $store.dispatch({
|
|
43
62
|
type: "queries/remove",
|
|
44
63
|
payload: { actionId },
|
|
45
64
|
})
|
|
65
|
+
delete callbacks[actionId]
|
|
66
|
+
responseSubject$.complete()
|
|
46
67
|
errorSubject$.complete()
|
|
47
68
|
},
|
|
48
69
|
execute: async (executeParams = {}) => {
|
|
@@ -50,7 +71,7 @@ export const $queryApi = (
|
|
|
50
71
|
errorSubject$.next(null)
|
|
51
72
|
responseSubject$.next({})
|
|
52
73
|
const queryParams = mergeDeepRight(cleanedParams, _executeParams)
|
|
53
|
-
$store.dispatch({
|
|
74
|
+
await $store.dispatch({
|
|
54
75
|
type: "queries/update",
|
|
55
76
|
payload: {
|
|
56
77
|
loading: true,
|
|
@@ -69,10 +90,10 @@ export const $queryApi = (
|
|
|
69
90
|
errorSubject$.next(errorObj)
|
|
70
91
|
})
|
|
71
92
|
responseSubject$.next(resultData?.response)
|
|
72
|
-
if (
|
|
73
|
-
|
|
93
|
+
if (callbacks[actionId] && typeof callbacks[actionId] === "function") {
|
|
94
|
+
callbacks[actionId](resultData)
|
|
74
95
|
}
|
|
75
|
-
if (resultData
|
|
96
|
+
if (resultData?.result) {
|
|
76
97
|
resultData.result = await resultData.result
|
|
77
98
|
}
|
|
78
99
|
return resultData
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
transformOperationResults,
|
|
5
5
|
} from "@racletteCore/lib/dataHelper"
|
|
6
6
|
import * as userNotifier from "@racletteCore/lib/userNotifier"
|
|
7
|
-
import { $store } from "@racletteCore"
|
|
7
|
+
import { $store, markDataAsModified } from "@racletteCore"
|
|
8
8
|
|
|
9
9
|
const handledRequests = {}
|
|
10
10
|
const hasBeenHandled = (requestId, appRequestCode) => {
|
|
@@ -76,16 +76,16 @@ const handler = {
|
|
|
76
76
|
|
|
77
77
|
return data.items
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
dataRead: (
|
|
80
80
|
data,
|
|
81
81
|
isOwnRequest,
|
|
82
|
-
appRequestCode = "
|
|
82
|
+
appRequestCode = "dataRead",
|
|
83
83
|
requestId,
|
|
84
84
|
direct,
|
|
85
85
|
notify,
|
|
86
86
|
isSystemAction,
|
|
87
87
|
) => {
|
|
88
|
-
log.api("
|
|
88
|
+
log.api("dataRead", {
|
|
89
89
|
direct,
|
|
90
90
|
isOwnRequest,
|
|
91
91
|
isSystemAction,
|
|
@@ -97,6 +97,29 @@ const handler = {
|
|
|
97
97
|
$store.dispatch({ type: "data/push", payload: data.items || [] })
|
|
98
98
|
return data.items
|
|
99
99
|
},
|
|
100
|
+
dataReadModified: (
|
|
101
|
+
data,
|
|
102
|
+
isOwnRequest,
|
|
103
|
+
appRequestCode = "dataReadModified",
|
|
104
|
+
requestId,
|
|
105
|
+
direct,
|
|
106
|
+
notify,
|
|
107
|
+
isSystemAction,
|
|
108
|
+
) => {
|
|
109
|
+
const modifiedData = markDataAsModified(data)
|
|
110
|
+
|
|
111
|
+
log.api("dataReadModified", {
|
|
112
|
+
direct,
|
|
113
|
+
isOwnRequest,
|
|
114
|
+
isSystemAction,
|
|
115
|
+
appRequestCode,
|
|
116
|
+
requestId,
|
|
117
|
+
modifiedData,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
$store.dispatch({ type: "data/push", payload: modifiedData.items || [] })
|
|
121
|
+
return data.items
|
|
122
|
+
},
|
|
100
123
|
dataDelete: (
|
|
101
124
|
data,
|
|
102
125
|
isOwnRequest,
|
|
@@ -29,7 +29,7 @@ const createAxiosConfig = (appRequestCode, pluginItemRequestConfig) => {
|
|
|
29
29
|
const reportError = (error) => {
|
|
30
30
|
const message = error?.response?.data?.message || false
|
|
31
31
|
|
|
32
|
-
$eventbus.emit("
|
|
32
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
33
33
|
message,
|
|
34
34
|
i18n: message ? false : "core.error.noConnectionToServer",
|
|
35
35
|
color: "error",
|
|
@@ -35,7 +35,13 @@ const handleDataIdPrefixing = (prefix, id) => {
|
|
|
35
35
|
|
|
36
36
|
return prefix + id
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const markDataAsModified = (data) => {
|
|
39
|
+
const modifiedData = clone(data)
|
|
40
|
+
modifiedData?.items.forEach((item) => {
|
|
41
|
+
item._id = `m_${item._id}`
|
|
42
|
+
})
|
|
43
|
+
return modifiedData
|
|
44
|
+
}
|
|
39
45
|
const debounceHelper = (time = 500) => {
|
|
40
46
|
let debounceTimer = false
|
|
41
47
|
|
|
@@ -437,6 +443,7 @@ const promisifyActionResolve = (resolveId: string, callback?: Function) => {
|
|
|
437
443
|
})
|
|
438
444
|
}
|
|
439
445
|
export {
|
|
446
|
+
markDataAsModified,
|
|
440
447
|
promisifyActionResolve,
|
|
441
448
|
capitalize,
|
|
442
449
|
handleDataIdPrefixing,
|
|
@@ -11,13 +11,23 @@
|
|
|
11
11
|
* - use speaking event names, even though they are longer
|
|
12
12
|
* - distinguish between a information and request (e.g. store_dispatch is a request to the store)
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
14
|
+
const legacyEventWhitelist = [
|
|
15
15
|
"socket_joinRoom",
|
|
16
16
|
"socket_leaveRoom",
|
|
17
17
|
"socket_dataUpdated",
|
|
18
18
|
"ui_setupProject",
|
|
19
19
|
"ui_addToSnackBar",
|
|
20
20
|
]
|
|
21
|
+
const eventWhitelist = legacyEventWhitelist.concat([
|
|
22
|
+
"forms/init",
|
|
23
|
+
"forms/validate",
|
|
24
|
+
"widgets/reset/workingState",
|
|
25
|
+
"ui/addToSnackbar",
|
|
26
|
+
"ui/setupProject",
|
|
27
|
+
"socket/data/update",
|
|
28
|
+
"socket/join/room",
|
|
29
|
+
"socket/leave/room",
|
|
30
|
+
])
|
|
21
31
|
const eventWildcards = [
|
|
22
32
|
"query_deleted",
|
|
23
33
|
"store_actionResolved",
|
|
@@ -217,7 +217,7 @@ class Logger {
|
|
|
217
217
|
|
|
218
218
|
error(
|
|
219
219
|
title: string,
|
|
220
|
-
message?: LogMessage,
|
|
220
|
+
message?: LogMessage | any,
|
|
221
221
|
level: LogLevel = LogLevel.NoLogging,
|
|
222
222
|
): void {
|
|
223
223
|
this.log(message, "error", title, level)
|
|
@@ -247,8 +247,16 @@ class Logger {
|
|
|
247
247
|
* Create a plugin-specific logger
|
|
248
248
|
*/
|
|
249
249
|
plugin(pluginKey: string): PluginLogger {
|
|
250
|
-
return (
|
|
251
|
-
|
|
250
|
+
return (
|
|
251
|
+
title: string,
|
|
252
|
+
message?: LogMessage | any,
|
|
253
|
+
level?: LogLevel,
|
|
254
|
+
): void => {
|
|
255
|
+
if (title === "error") {
|
|
256
|
+
this.error(`plugin ${pluginKey} - ${message.error}`, message)
|
|
257
|
+
} else {
|
|
258
|
+
this.log(message, "plugin", `${pluginKey} - ${title}`, level)
|
|
259
|
+
}
|
|
252
260
|
}
|
|
253
261
|
}
|
|
254
262
|
}
|
|
@@ -35,7 +35,7 @@ const setServerDisconnected = () => {
|
|
|
35
35
|
const dataCreate = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
36
36
|
items.forEach((item) => {
|
|
37
37
|
if (isAnswerToOwnRequest) {
|
|
38
|
-
$eventbus.emit("
|
|
38
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
39
39
|
i18n: "core.dataCreate$displayName$type",
|
|
40
40
|
content: { displayName: item._displayName, type: item._type },
|
|
41
41
|
color: "success",
|
|
@@ -61,7 +61,7 @@ const dataCreate = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
|
61
61
|
const dataUpdate = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
62
62
|
items.forEach((item) => {
|
|
63
63
|
if (isAnswerToOwnRequest) {
|
|
64
|
-
$eventbus.emit("
|
|
64
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
65
65
|
i18n: "core.dataUpdate$displayName$type",
|
|
66
66
|
content: { displayName: item._displayName, type: item._type },
|
|
67
67
|
color: "success",
|
|
@@ -89,7 +89,7 @@ const projectUpdate = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
|
89
89
|
const displayValues = item._source
|
|
90
90
|
|
|
91
91
|
if (isAnswerToOwnRequest) {
|
|
92
|
-
$eventbus.emit("
|
|
92
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
93
93
|
i18n: "core.projectUpdate$shorttitle",
|
|
94
94
|
content: { shorttitle: displayValues.shorttitle },
|
|
95
95
|
color: "success",
|
|
@@ -111,20 +111,20 @@ const projectUpdate = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
|
111
111
|
}
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
-
$eventbus.emit("
|
|
114
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
115
115
|
i18n: "core.reloadPageHint",
|
|
116
116
|
color: "info",
|
|
117
117
|
})
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const projectConfigUpdate = (isAnswerToOwnRequest, isSystemAction, items) =>
|
|
121
|
-
$eventbus.emit("
|
|
121
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
122
122
|
i18n: "core.reloadPageHint",
|
|
123
123
|
color: "info",
|
|
124
124
|
})
|
|
125
125
|
|
|
126
126
|
const userConfigUpdate = (isAnswerToOwnRequest, isSystemAction, items) =>
|
|
127
|
-
$eventbus.emit("
|
|
127
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
128
128
|
i18n: "core.reloadPageHint",
|
|
129
129
|
color: "info",
|
|
130
130
|
})
|
|
@@ -132,7 +132,7 @@ const userConfigUpdate = (isAnswerToOwnRequest, isSystemAction, items) =>
|
|
|
132
132
|
const dataDelete = (isAnswerToOwnRequest, isSystemAction, deletedItems) =>
|
|
133
133
|
deletedItems.forEach((item) => {
|
|
134
134
|
if (isAnswerToOwnRequest) {
|
|
135
|
-
$eventbus.emit("
|
|
135
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
136
136
|
i18n: "core.dataDelete$displayName$type",
|
|
137
137
|
content: { displayName: item._displayName, type: item._type },
|
|
138
138
|
color: "success",
|
|
@@ -157,7 +157,7 @@ const dataDelete = (isAnswerToOwnRequest, isSystemAction, deletedItems) =>
|
|
|
157
157
|
const dataMove = (isAnswerToOwnRequest, isSystemAction, items) => {
|
|
158
158
|
items.forEach((item) => {
|
|
159
159
|
if (isAnswerToOwnRequest) {
|
|
160
|
-
$eventbus.emit("
|
|
160
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
161
161
|
i18n: "core.dataMove$displayName$type",
|
|
162
162
|
content: { displayName: item._displayName, type: item._type },
|
|
163
163
|
color: "success",
|
|
@@ -207,7 +207,7 @@ const checkToken = (payload) => {
|
|
|
207
207
|
},
|
|
208
208
|
color: "green",
|
|
209
209
|
}
|
|
210
|
-
$eventbus.emit("
|
|
210
|
+
$eventbus.emit("ui/addToSnackbar", message)
|
|
211
211
|
$store.dispatch({
|
|
212
212
|
type: "notifications/add",
|
|
213
213
|
payload: {
|
|
@@ -222,7 +222,7 @@ const checkToken = (payload) => {
|
|
|
222
222
|
i18n: "core.authentication." + response.code,
|
|
223
223
|
color: "error",
|
|
224
224
|
}
|
|
225
|
-
$eventbus.emit("
|
|
225
|
+
$eventbus.emit("ui/addToSnackbar", message)
|
|
226
226
|
$store.dispatch({
|
|
227
227
|
type: "notifications/add",
|
|
228
228
|
payload: {
|
|
@@ -245,7 +245,7 @@ const checkToken = (payload) => {
|
|
|
245
245
|
color: "error",
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
$eventbus.emit("
|
|
248
|
+
$eventbus.emit("ui/addToSnackbar", message)
|
|
249
249
|
$store.dispatch({
|
|
250
250
|
type: "notifications/add",
|
|
251
251
|
payload: {
|
|
@@ -257,7 +257,7 @@ const checkToken = (payload) => {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
const newVersionAvailable = () =>
|
|
260
|
-
$eventbus.emit("
|
|
260
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
261
261
|
i18n: "core.versionUpdate",
|
|
262
262
|
color: "info",
|
|
263
263
|
timeout: -1,
|
|
@@ -271,7 +271,7 @@ const dataMergeResponse = (isAnswerToOwnRequest, res) => {
|
|
|
271
271
|
|
|
272
272
|
if (currentOperation.failure) {
|
|
273
273
|
Object.keys(currentOperation.failure).forEach((type) =>
|
|
274
|
-
$eventbus.emit("
|
|
274
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
275
275
|
i18n: "core.dataSync." + operation + ".$docCountOf$docTypeHaveFailed",
|
|
276
276
|
content: {
|
|
277
277
|
docCount: currentOperation.failure[type],
|
|
@@ -283,7 +283,7 @@ const dataMergeResponse = (isAnswerToOwnRequest, res) => {
|
|
|
283
283
|
}
|
|
284
284
|
if (currentOperation.success) {
|
|
285
285
|
Object.keys(currentOperation.success).forEach((type) =>
|
|
286
|
-
$eventbus.emit("
|
|
286
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
287
287
|
i18n:
|
|
288
288
|
"core.dataSync." +
|
|
289
289
|
operation +
|
|
@@ -306,7 +306,7 @@ const dataMergeResponse = (isAnswerToOwnRequest, res) => {
|
|
|
306
306
|
res.totals.failed > 0 &&
|
|
307
307
|
res.totals.succeeded > 0
|
|
308
308
|
) {
|
|
309
|
-
$eventbus.emit("
|
|
309
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
310
310
|
i18n: "core.dataSync.$docCountOf$docTypeHaveFailed$docCount1HaveSucceeded",
|
|
311
311
|
content: {
|
|
312
312
|
docCount: res.totals.failed,
|
|
@@ -321,13 +321,13 @@ const dataMergeResponse = (isAnswerToOwnRequest, res) => {
|
|
|
321
321
|
const add = (message: string | string[], color = "info") => {
|
|
322
322
|
if (Array.isArray(message)) {
|
|
323
323
|
message.forEach((text) =>
|
|
324
|
-
$eventbus.emit("
|
|
324
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
325
325
|
message: text,
|
|
326
326
|
color,
|
|
327
327
|
} satisfies SnackbarMessage),
|
|
328
328
|
)
|
|
329
329
|
} else {
|
|
330
|
-
$eventbus.emit("
|
|
330
|
+
$eventbus.emit("ui/addToSnackbar", {
|
|
331
331
|
message,
|
|
332
332
|
color,
|
|
333
333
|
} satisfies SnackbarMessage)
|