@darajs/core 1.3.2 → 1.4.0
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/actions/download-variable.d.ts +3 -3
- package/dist/actions/download-variable.d.ts.map +1 -1
- package/dist/actions/download-variable.js +32 -46
- package/dist/actions/download-variable.js.map +1 -1
- package/dist/actions/index.d.ts +0 -4
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +0 -4
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/navigate-to.d.ts +3 -3
- package/dist/actions/navigate-to.d.ts.map +1 -1
- package/dist/actions/navigate-to.js +16 -57
- package/dist/actions/navigate-to.js.map +1 -1
- package/dist/actions/notify.d.ts +2 -6
- package/dist/actions/notify.d.ts.map +1 -1
- package/dist/actions/notify.js +8 -14
- package/dist/actions/notify.js.map +1 -1
- package/dist/actions/reset-variables.d.ts +2 -2
- package/dist/actions/reset-variables.d.ts.map +1 -1
- package/dist/actions/reset-variables.js +28 -17
- package/dist/actions/reset-variables.js.map +1 -1
- package/dist/actions/trigger-variable.d.ts +2 -2
- package/dist/actions/trigger-variable.d.ts.map +1 -1
- package/dist/actions/trigger-variable.js +7 -18
- package/dist/actions/trigger-variable.js.map +1 -1
- package/dist/actions/update-variable.d.ts +2 -4
- package/dist/actions/update-variable.d.ts.map +1 -1
- package/dist/actions/update-variable.js +17 -83
- package/dist/actions/update-variable.js.map +1 -1
- package/dist/api/websocket.d.ts +22 -2
- package/dist/api/websocket.d.ts.map +1 -1
- package/dist/api/websocket.js +11 -0
- package/dist/api/websocket.js.map +1 -1
- package/dist/auth/auth-wrapper.js +1 -1
- package/dist/auth/auth-wrapper.js.map +1 -1
- package/dist/components/router-content/router-content.d.ts.map +1 -1
- package/dist/components/router-content/router-content.js +1 -1
- package/dist/components/router-content/router-content.js.map +1 -1
- package/dist/{dara_core-1.3.2-py3-none-any.whl → dara_core-1.4.0-py3-none-any.whl} +0 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/interactivity/index.d.ts +2 -4
- package/dist/shared/interactivity/index.d.ts.map +1 -1
- package/dist/shared/interactivity/index.js +2 -3
- package/dist/shared/interactivity/index.js.map +1 -1
- package/dist/shared/interactivity/store.d.ts +8 -0
- package/dist/shared/interactivity/store.d.ts.map +1 -1
- package/dist/shared/interactivity/store.js +19 -0
- package/dist/shared/interactivity/store.js.map +1 -1
- package/dist/shared/interactivity/use-variable-value.d.ts +19 -7
- package/dist/shared/interactivity/use-variable-value.d.ts.map +1 -1
- package/dist/shared/interactivity/use-variable-value.js +54 -40
- package/dist/shared/interactivity/use-variable-value.js.map +1 -1
- package/dist/shared/private-route/private-route.d.ts +3 -7
- package/dist/shared/private-route/private-route.d.ts.map +1 -1
- package/dist/shared/private-route/private-route.js +12 -22
- package/dist/shared/private-route/private-route.js.map +1 -1
- package/dist/shared/utils/use-action-registry.d.ts +2 -2
- package/dist/shared/utils/use-action-registry.d.ts.map +1 -1
- package/dist/shared/utils/use-action-registry.js +6 -6
- package/dist/shared/utils/use-action-registry.js.map +1 -1
- package/dist/shared/utils/use-action.d.ts +14 -2
- package/dist/shared/utils/use-action.d.ts.map +1 -1
- package/dist/shared/utils/use-action.js +249 -55
- package/dist/shared/utils/use-action.js.map +1 -1
- package/dist/types/core.d.ts +80 -51
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/utils.d.ts +7 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +8 -0
- package/dist/types/utils.js.map +1 -1
- package/dist/umd/dara.core.umd.js +5955 -6669
- package/package.json +6 -6
- package/dist/actions/download-content.d.ts +0 -8
- package/dist/actions/download-content.d.ts.map +0 -1
- package/dist/actions/download-content.js +0 -47
- package/dist/actions/download-content.js.map +0 -1
- package/dist/actions/logout.d.ts +0 -8
- package/dist/actions/logout.d.ts.map +0 -1
- package/dist/actions/logout.js +0 -25
- package/dist/actions/logout.js.map +0 -1
- package/dist/actions/side-effect.d.ts +0 -8
- package/dist/actions/side-effect.d.ts.map +0 -1
- package/dist/actions/side-effect.js +0 -45
- package/dist/actions/side-effect.js.map +0 -1
- package/dist/actions/utils.d.ts +0 -9
- package/dist/actions/utils.d.ts.map +0 -1
- package/dist/actions/utils.js +0 -38
- package/dist/actions/utils.js.map +0 -1
- package/dist/shared/interactivity/use-reset-variables.d.ts +0 -8
- package/dist/shared/interactivity/use-reset-variables.d.ts.map +0 -1
- package/dist/shared/interactivity/use-reset-variables.js +0 -46
- package/dist/shared/interactivity/use-reset-variables.js.map +0 -1
- package/dist/shared/interactivity/use-trigger-variable.d.ts +0 -9
- package/dist/shared/interactivity/use-trigger-variable.d.ts.map +0 -1
- package/dist/shared/interactivity/use-trigger-variable.js +0 -18
- package/dist/shared/interactivity/use-trigger-variable.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darajs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Dara Framework core",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"prettier": "@darajs/prettier-config",
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@babel/core": "^7.
|
|
35
|
-
"@babel/preset-env": "^7.
|
|
36
|
-
"@babel/preset-react": "^7.
|
|
37
|
-
"@babel/preset-typescript": "^7.
|
|
34
|
+
"@babel/core": "^7.23.0",
|
|
35
|
+
"@babel/preset-env": "^7.23.0",
|
|
36
|
+
"@babel/preset-react": "^7.22.15",
|
|
37
|
+
"@babel/preset-typescript": "^7.23.0",
|
|
38
38
|
"@darajs/eslint-config": "~1.2.1",
|
|
39
39
|
"@darajs/prettier-config": "~1.2.1",
|
|
40
40
|
"@darajs/stylelint-config": "~1.2.1",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"publishConfig": {
|
|
114
114
|
"access": "public"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "f930bd16d1021734b40832709c15d0719109654d"
|
|
117
117
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionHook, DownloadContentInstance } from '../types/core';
|
|
2
|
-
/**
|
|
3
|
-
* Frontend handler for DownloadContent action
|
|
4
|
-
* Retrieves the download code and opens a new window for the content to be downloaded
|
|
5
|
-
*/
|
|
6
|
-
declare const DownloadContent: ActionHook<string, DownloadContentInstance>;
|
|
7
|
-
export default DownloadContent;
|
|
8
|
-
//# sourceMappingURL=download-content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download-content.d.ts","sourceRoot":"","sources":["../../js/actions/download-content.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEnE;;;GAGG;AACH,QAAA,MAAM,eAAe,EAAE,UAAU,CAAC,MAAM,EAAE,uBAAuB,CAwBhE,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
import { useCallback } from 'react';
|
|
13
|
-
import { useNotifications } from '@darajs/ui-notifications';
|
|
14
|
-
import { Status } from '@darajs/ui-utils';
|
|
15
|
-
import { useVariableValue } from '../shared/interactivity';
|
|
16
|
-
import { resolveValue } from '../shared/interactivity/resolve-value';
|
|
17
|
-
import { normalizeRequest } from '../shared/utils/normalization';
|
|
18
|
-
/**
|
|
19
|
-
* Frontend handler for DownloadContent action
|
|
20
|
-
* Retrieves the download code and opens a new window for the content to be downloaded
|
|
21
|
-
*/
|
|
22
|
-
const DownloadContent = (action, { fetchAction }) => {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
const extras = (_b = (_a = action.extras) === null || _a === void 0 ? void 0 : _a.map((variable) => useVariableValue(variable))) !== null && _b !== void 0 ? _b : [];
|
|
25
|
-
const { pushNotification } = useNotifications();
|
|
26
|
-
return useCallback((value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
const resolvedExtras = extras.map((extra) => resolveValue(extra, false));
|
|
28
|
-
const normalizedExtras = normalizeRequest(resolvedExtras, action.extras);
|
|
29
|
-
try {
|
|
30
|
-
// First, fetch one-time download code
|
|
31
|
-
const downloadCode = yield fetchAction(action.uid, { extras: normalizedExtras, inputs: { value } });
|
|
32
|
-
// Open download url in new tab
|
|
33
|
-
window.open(`/api/core/download?code=${downloadCode}`, '_blank');
|
|
34
|
-
}
|
|
35
|
-
catch (_c) {
|
|
36
|
-
// Recover from server error - notify
|
|
37
|
-
pushNotification({
|
|
38
|
-
key: action.uid,
|
|
39
|
-
message: 'Try again or contact the application owner',
|
|
40
|
-
status: Status.ERROR,
|
|
41
|
-
title: 'Error downloading content',
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}), []);
|
|
45
|
-
};
|
|
46
|
-
export default DownloadContent;
|
|
47
|
-
//# sourceMappingURL=download-content.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download-content.js","sourceRoot":"","sources":["../../js/actions/download-content.tsx"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,gDAAgD;;;;;;;;;;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE;;;GAGG;AACH,MAAM,eAAe,GAAgD,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;;IAC7F,MAAM,MAAM,GAAG,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,mCAAI,EAAE,CAAC;IAClF,MAAM,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEhD,OAAO,WAAW,CAAC,CAAO,KAAU,EAAE,EAAE;QACpC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACzE,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAEzE,IAAI;YACA,sCAAsC;YACtC,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YAEpG,+BAA+B;YAC/B,MAAM,CAAC,IAAI,CAAC,2BAA2B,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;SACpE;QAAC,WAAM;YACJ,qCAAqC;YACrC,gBAAgB,CAAC;gBACb,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,OAAO,EAAE,4CAA4C;gBACrD,MAAM,EAAE,MAAM,CAAC,KAAK;gBACpB,KAAK,EAAE,2BAA2B;aACrC,CAAC,CAAC;SACN;IACL,CAAC,CAAA,EAAE,EAAE,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/actions/logout.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../js/actions/logout.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D;;;GAGG;AACH,QAAA,MAAM,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,cAAc,CAO7C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/actions/logout.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
import { useCallback } from 'react';
|
|
12
|
-
import { useHistory } from 'react-router-dom';
|
|
13
|
-
/**
|
|
14
|
-
* Front-end handler for Logout action.
|
|
15
|
-
* Navigates to '/logout'.
|
|
16
|
-
*/
|
|
17
|
-
const Logout = () => {
|
|
18
|
-
const history = useHistory();
|
|
19
|
-
return useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
history.push('/logout');
|
|
21
|
-
return Promise.resolve();
|
|
22
|
-
}), []);
|
|
23
|
-
};
|
|
24
|
-
export default Logout;
|
|
25
|
-
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../js/actions/logout.tsx"],"names":[],"mappings":"AAAA,gDAAgD;;;;;;;;;;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C;;;GAGG;AACH,MAAM,MAAM,GAAsC,GAAG,EAAE;IACnD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,OAAO,WAAW,CAAC,GAAwB,EAAE;QACzC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAA,EAAE,EAAE,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionHook, SideEffectInstance } from '../types/core';
|
|
2
|
-
/**
|
|
3
|
-
* Front-end handler for SideEffect action.
|
|
4
|
-
* Calls the backend to execute an arbitrary function.
|
|
5
|
-
*/
|
|
6
|
-
declare const SideEffect: ActionHook<void, SideEffectInstance>;
|
|
7
|
-
export default SideEffect;
|
|
8
|
-
//# sourceMappingURL=side-effect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"side-effect.d.ts","sourceRoot":"","sources":["../../js/actions/side-effect.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9D;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,kBAAkB,CA6BpD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
import { useCallback } from 'react';
|
|
12
|
-
import { useNotifications } from '@darajs/ui-notifications';
|
|
13
|
-
import { Status } from '@darajs/ui-utils';
|
|
14
|
-
import { resolveValue, useVariableValue } from '../shared/interactivity';
|
|
15
|
-
import { normalizeRequest } from '../shared/utils/normalization';
|
|
16
|
-
/**
|
|
17
|
-
* Front-end handler for SideEffect action.
|
|
18
|
-
* Calls the backend to execute an arbitrary function.
|
|
19
|
-
*/
|
|
20
|
-
const SideEffect = (action, { fetchAction }) => {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
|
-
const extras = (_b = (_a = action.extras) === null || _a === void 0 ? void 0 : _a.map((variable) => useVariableValue(variable))) !== null && _b !== void 0 ? _b : [];
|
|
24
|
-
const { pushNotification } = useNotifications();
|
|
25
|
-
return useCallback((value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
const resolvedExtras = extras.map((extra) => resolveValue(extra, false));
|
|
27
|
-
const normalizedExtras = normalizeRequest(resolvedExtras, action.extras);
|
|
28
|
-
const resultPromise = fetchAction(action.uid, { extras: normalizedExtras, inputs: { value } }).catch(() => {
|
|
29
|
-
// Recover from server error - notify about the error
|
|
30
|
-
pushNotification({
|
|
31
|
-
key: action.uid,
|
|
32
|
-
message: 'Try again or contact the application owner',
|
|
33
|
-
status: Status.ERROR,
|
|
34
|
-
title: 'Error executing action',
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
// only wait for side effect to complete if block flag is set
|
|
38
|
-
if (action.block) {
|
|
39
|
-
yield resultPromise;
|
|
40
|
-
}
|
|
41
|
-
return Promise.resolve();
|
|
42
|
-
}), [action]);
|
|
43
|
-
};
|
|
44
|
-
export default SideEffect;
|
|
45
|
-
//# sourceMappingURL=side-effect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"side-effect.js","sourceRoot":"","sources":["../../js/actions/side-effect.tsx"],"names":[],"mappings":"AAAA,gDAAgD;;;;;;;;;;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE;;;GAGG;AACH,MAAM,UAAU,GAAyC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;;IACjF,sDAAsD;IACtD,MAAM,MAAM,GAAG,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,mCAAI,EAAE,CAAC;IAClF,MAAM,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEhD,OAAO,WAAW,CACd,CAAO,KAAU,EAAiB,EAAE;QAChC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACzE,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAEzE,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YACtG,qDAAqD;YACrD,gBAAgB,CAAC;gBACb,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,OAAO,EAAE,4CAA4C;gBACrD,MAAM,EAAE,MAAM,CAAC,KAAK;gBACpB,KAAK,EAAE,wBAAwB;aAClC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,6DAA6D;QAC7D,IAAI,MAAM,CAAC,KAAK,EAAE;YACd,MAAM,aAAa,CAAC;SACvB;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC,CAAA,EACD,CAAC,MAAM,CAAC,CACX,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/actions/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ActionContext } from '../types/core';
|
|
2
|
-
/**
|
|
3
|
-
* Helper hook that exposes an action context object with:
|
|
4
|
-
* - a function to fetch the derived parameter for an action from the backend
|
|
5
|
-
* - the session token
|
|
6
|
-
* - the websocket client instance
|
|
7
|
-
*/
|
|
8
|
-
export declare function useActionContext<T>(): ActionContext<T>;
|
|
9
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../js/actions/utils.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAsBtD"}
|
package/dist/actions/utils.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/prefer-default-export */
|
|
2
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
import { useCallback, useContext } from 'react';
|
|
13
|
-
import { HTTP_METHOD, validateResponse } from '@darajs/ui-utils';
|
|
14
|
-
import { request } from '../api/http';
|
|
15
|
-
import { useSessionToken } from '../auth/auth-context';
|
|
16
|
-
import { WebSocketCtx } from '../shared/context';
|
|
17
|
-
/**
|
|
18
|
-
* Helper hook that exposes an action context object with:
|
|
19
|
-
* - a function to fetch the derived parameter for an action from the backend
|
|
20
|
-
* - the session token
|
|
21
|
-
* - the websocket client instance
|
|
22
|
-
*/
|
|
23
|
-
export function useActionContext() {
|
|
24
|
-
const { client: wsClient } = useContext(WebSocketCtx);
|
|
25
|
-
const token = useSessionToken();
|
|
26
|
-
const fetchAction = useCallback((uid, body) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const ws_channel = yield wsClient.getChannel();
|
|
28
|
-
const res = yield request(`/api/core/action/${uid}`, { body: JSON.stringify(Object.assign(Object.assign({}, body), { ws_channel })), method: HTTP_METHOD.POST }, token);
|
|
29
|
-
yield validateResponse(res, `Failed to fetch the derived action value with uid: ${uid}`);
|
|
30
|
-
return res.json();
|
|
31
|
-
}), []);
|
|
32
|
-
return {
|
|
33
|
-
fetchAction,
|
|
34
|
-
sessionToken: token,
|
|
35
|
-
wsClient,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../js/actions/utils.tsx"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,gDAAgD;;;;;;;;;;AAEhD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC5B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,MAAM,WAAW,GAAG,WAAW,CAAC,CAAO,GAAW,EAAE,IAA0B,EAAc,EAAE;QAC1F,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,MAAM,OAAO,CACrB,oBAAoB,GAAG,EAAE,EACzB,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,iCAAM,IAAI,KAAE,UAAU,IAAG,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,EAC3E,KAAK,CACR,CAAC;QAEF,MAAM,gBAAgB,CAAC,GAAG,EAAE,sDAAsD,GAAG,EAAE,CAAC,CAAC;QAEzF,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC,CAAA,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACH,WAAW;QACX,YAAY,EAAE,KAAK;QACnB,QAAQ;KACX,CAAC;AACN,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Variable } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* A helper hook that returns a function to reset a list of variables to their default values
|
|
4
|
-
*
|
|
5
|
-
* @param variables list of variables to reset
|
|
6
|
-
*/
|
|
7
|
-
export default function useResetVariables(variables: Variable<any>[]): () => void;
|
|
8
|
-
//# sourceMappingURL=use-reset-variables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-reset-variables.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/use-reset-variables.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAuF,MAAM,SAAS,CAAC;AAIxH;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,IAAI,CAkChF"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { useHistory, useLocation } from 'react-router-dom';
|
|
3
|
-
import { useRecoilCallback } from 'recoil';
|
|
4
|
-
// eslint-disable-next-line import/no-cycle
|
|
5
|
-
import { useSessionToken } from '../../auth/auth-context';
|
|
6
|
-
import { WebSocketCtx, useTaskContext } from '../../shared/context';
|
|
7
|
-
import { isDataVariable, isDerivedDataVariable, isDerivedVariable, isUrlVariable, isVariable } from '../../types';
|
|
8
|
-
import { getOrRegisterPlainVariable, getOrRegisterTrigger, getOrRegisterUrlVariable } from './internal';
|
|
9
|
-
/**
|
|
10
|
-
* A helper hook that returns a function to reset a list of variables to their default values
|
|
11
|
-
*
|
|
12
|
-
* @param variables list of variables to reset
|
|
13
|
-
*/
|
|
14
|
-
export default function useResetVariables(variables) {
|
|
15
|
-
const taskContext = useTaskContext();
|
|
16
|
-
const { client } = useContext(WebSocketCtx);
|
|
17
|
-
const { search } = useLocation();
|
|
18
|
-
const token = useSessionToken();
|
|
19
|
-
const history = useHistory();
|
|
20
|
-
return useRecoilCallback(({ reset, set }) => () => {
|
|
21
|
-
variables.filter(isVariable).forEach((variable) => {
|
|
22
|
-
// For DVs, trigger their recalculation
|
|
23
|
-
if (isDerivedVariable(variable) || isDerivedDataVariable(variable)) {
|
|
24
|
-
const triggerAtom = getOrRegisterTrigger(variable);
|
|
25
|
-
set(triggerAtom, (triggerIndexValue) => ({
|
|
26
|
-
force: true,
|
|
27
|
-
inc: triggerIndexValue.inc + 1,
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
else if (isUrlVariable(variable)) {
|
|
31
|
-
// For UrlVariables, we use set instead of reset to update the URL as well; otherwise just the atom is reset
|
|
32
|
-
const urlAtom = getOrRegisterUrlVariable(variable);
|
|
33
|
-
set(urlAtom, variable.default);
|
|
34
|
-
}
|
|
35
|
-
else if (isDataVariable(variable)) {
|
|
36
|
-
// for data variables this is a noop
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// For plain variables reset them to default values
|
|
40
|
-
const plainAtom = getOrRegisterPlainVariable(variable, client, taskContext, search, token);
|
|
41
|
-
reset(plainAtom);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}, [variables, history]);
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=use-reset-variables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-reset-variables.js","sourceRoot":"","sources":["../../../js/shared/interactivity/use-reset-variables.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,2CAA2C;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAY,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAExH,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAExG;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,SAA0B;IAChE,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,OAAO,iBAAiB,CACpB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CACf,GAAG,EAAE;QACD,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC9C,uCAAuC;YACvC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;gBAChE,MAAM,WAAW,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;gBAEnD,GAAG,CAAC,WAAW,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;oBACrC,KAAK,EAAE,IAAI;oBACX,GAAG,EAAE,iBAAiB,CAAC,GAAG,GAAG,CAAC;iBACjC,CAAC,CAAC,CAAC;aACP;iBAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;gBAChC,4GAA4G;gBAC5G,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;gBACnD,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;aAClC;iBAAM,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE;gBACjC,oCAAoC;aACvC;iBAAM;gBACH,mDAAmD;gBACnD,MAAM,SAAS,GAAG,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC3F,KAAK,CAAC,SAAS,CAAC,CAAC;aACpB;QACL,CAAC,CAAC,CAAC;IACP,CAAC,EACL,CAAC,SAAS,EAAE,OAAO,CAAC,CACvB,CAAC;AACN,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DerivedDataVariable, DerivedVariable } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* A helper hook that returns a function to trigger a calculation for a given variable.
|
|
4
|
-
*
|
|
5
|
-
* @param variable variable to use
|
|
6
|
-
* @param force whether to force the recalculation irrespective of the caching setting
|
|
7
|
-
*/
|
|
8
|
-
export default function useTriggerVariable(variable: DerivedVariable | DerivedDataVariable, force: boolean): () => void;
|
|
9
|
-
//# sourceMappingURL=use-trigger-variable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-trigger-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/use-trigger-variable.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACtC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,EAC/C,KAAK,EAAE,OAAO,GACf,MAAM,IAAI,CAaZ"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useRecoilCallback } from 'recoil';
|
|
2
|
-
import { getOrRegisterTrigger } from './internal';
|
|
3
|
-
/**
|
|
4
|
-
* A helper hook that returns a function to trigger a calculation for a given variable.
|
|
5
|
-
*
|
|
6
|
-
* @param variable variable to use
|
|
7
|
-
* @param force whether to force the recalculation irrespective of the caching setting
|
|
8
|
-
*/
|
|
9
|
-
export default function useTriggerVariable(variable, force) {
|
|
10
|
-
return useRecoilCallback(({ set }) => () => {
|
|
11
|
-
const triggerAtom = getOrRegisterTrigger(variable);
|
|
12
|
-
set(triggerAtom, (triggerIndexValue) => ({
|
|
13
|
-
force,
|
|
14
|
-
inc: triggerIndexValue.inc + 1,
|
|
15
|
-
}));
|
|
16
|
-
}, [variable.uid, force]);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=use-trigger-variable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-trigger-variable.js","sourceRoot":"","sources":["../../../js/shared/interactivity/use-trigger-variable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAK3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACtC,QAA+C,EAC/C,KAAc;IAEd,OAAO,iBAAiB,CACpB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CACR,GAAG,EAAE;QACD,MAAM,WAAW,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAEnD,GAAG,CAAC,WAAW,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;YACrC,KAAK;YACL,GAAG,EAAE,iBAAiB,CAAC,GAAG,GAAG,CAAC;SACjC,CAAC,CAAC,CAAC;IACR,CAAC,EACL,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CACxB,CAAC;AACN,CAAC"}
|