@darajs/core 1.3.2 → 1.4.1
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.1-py3-none-any.whl} +0 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- 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 +5963 -6653
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionHandler, DownloadVariableImpl } from '../types/core';
|
|
2
2
|
/**
|
|
3
3
|
* Frontend handler for DownloadVariable action
|
|
4
|
-
* Retrieves the variable value and downloads the variable as either a csv or xl file
|
|
4
|
+
* Retrieves the variable value and downloads the variable as either a csv, json or xl file
|
|
5
5
|
*/
|
|
6
|
-
declare const DownloadVariable:
|
|
6
|
+
declare const DownloadVariable: ActionHandler<DownloadVariableImpl>;
|
|
7
7
|
export default DownloadVariable;
|
|
8
8
|
//# sourceMappingURL=download-variable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-variable.d.ts","sourceRoot":"","sources":["../../js/actions/download-variable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"download-variable.d.ts","sourceRoot":"","sources":["../../js/actions/download-variable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAmHnE;;;GAGG;AACH,QAAA,MAAM,gBAAgB,EAAE,aAAa,CAAC,oBAAoB,CAoCzD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,16 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
9
|
};
|
|
12
10
|
import * as xl from 'exceljs';
|
|
13
11
|
import { saveAs } from 'file-saver';
|
|
14
|
-
import {
|
|
15
|
-
import { useNotifications } from '@darajs/ui-notifications';
|
|
16
|
-
import { Status } from '@darajs/ui-utils';
|
|
17
|
-
import { useVariableValue } from '../shared/interactivity';
|
|
18
|
-
function isPromise(p) {
|
|
19
|
-
if (typeof p === 'object' && typeof p.then === 'function') {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
12
|
+
import { getVariableValue } from '../shared/interactivity/use-variable-value';
|
|
24
13
|
const createMatrixFromArrayOfObjects = (content) => {
|
|
25
14
|
const headings = [];
|
|
26
15
|
const indexes = {};
|
|
@@ -111,44 +100,41 @@ const createMatrixFromValue = (val) => {
|
|
|
111
100
|
};
|
|
112
101
|
/**
|
|
113
102
|
* Frontend handler for DownloadVariable action
|
|
114
|
-
* Retrieves the variable value and downloads the variable as either a csv or xl file
|
|
103
|
+
* Retrieves the variable value and downloads the variable as either a csv, json or xl file
|
|
115
104
|
*/
|
|
116
|
-
const DownloadVariable = (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
105
|
+
const DownloadVariable = (ctx, actionImpl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
+
let value = getVariableValue(actionImpl.variable, true, {
|
|
107
|
+
client: ctx.wsClient,
|
|
108
|
+
search: ctx.location.search,
|
|
109
|
+
snapshot: ctx.snapshot,
|
|
110
|
+
taskContext: ctx.taskCtx,
|
|
111
|
+
token: ctx.sessionToken,
|
|
112
|
+
});
|
|
113
|
+
if (value instanceof Promise) {
|
|
114
|
+
value = yield value;
|
|
115
|
+
}
|
|
116
|
+
// strip the __index__ column from data vars
|
|
117
|
+
if (actionImpl.variable.__typename === 'DataVariable' || actionImpl.variable.__typename === 'DerivedDataVariable') {
|
|
118
|
+
for (const row of value) {
|
|
119
|
+
if ('__index__' in row) {
|
|
120
|
+
delete row.__index__;
|
|
128
121
|
}
|
|
129
122
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return Promise.resolve();
|
|
136
|
-
}
|
|
137
|
-
const matrix = createMatrixFromValue(val);
|
|
138
|
-
if (!matrix) {
|
|
139
|
-
pushNotification({
|
|
140
|
-
key: action.uid,
|
|
141
|
-
message: 'Try again or contact the application owner',
|
|
142
|
-
status: Status.ERROR,
|
|
143
|
-
title: 'Error downloading file',
|
|
144
|
-
});
|
|
145
|
-
return Promise.resolve();
|
|
146
|
-
}
|
|
147
|
-
const notExcel = !action.type || action.type !== 'xlsx';
|
|
148
|
-
const blob = notExcel ? createCsvFromMatrix(matrix) : yield createXLFromMatrix(fileName, matrix);
|
|
123
|
+
}
|
|
124
|
+
const fileName = actionImpl.file_name || 'Data';
|
|
125
|
+
const fileNameWithExt = `${fileName}.${actionImpl.type}`;
|
|
126
|
+
if (actionImpl.type === 'json') {
|
|
127
|
+
const blob = createJsonBlob(value);
|
|
149
128
|
saveAs(blob, fileNameWithExt);
|
|
150
129
|
return Promise.resolve();
|
|
151
|
-
}
|
|
152
|
-
|
|
130
|
+
}
|
|
131
|
+
const matrix = createMatrixFromValue(value);
|
|
132
|
+
if (!matrix) {
|
|
133
|
+
throw new Error('Unable to create matrix from value');
|
|
134
|
+
}
|
|
135
|
+
const notExcel = !actionImpl.type || actionImpl.type !== 'xlsx';
|
|
136
|
+
const blob = notExcel ? createCsvFromMatrix(matrix) : yield createXLFromMatrix(fileName, matrix);
|
|
137
|
+
saveAs(blob, fileNameWithExt);
|
|
138
|
+
});
|
|
153
139
|
export default DownloadVariable;
|
|
154
140
|
//# sourceMappingURL=download-variable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download-variable.js","sourceRoot":"","sources":["../../js/actions/download-variable.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"download-variable.js","sourceRoot":"","sources":["../../js/actions/download-variable.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAG7E,MAAM,8BAA8B,GAAG,CAAC,OAAmC,EAAW,EAAE;IACpF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;gBACvB,QAAQ,CAAC,IAAI,CAA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|
2
2
|
export { default as ResetVariables } from './reset-variables';
|
|
3
|
-
export { default as SideEffect } from './side-effect';
|
|
4
3
|
export { default as TriggerVariable } from './trigger-variable';
|
|
5
4
|
export { default as UpdateVariable } from './update-variable';
|
|
6
5
|
export { default as DownloadVariable } from './download-variable';
|
|
7
|
-
export { default as DownloadContent } from './download-content';
|
|
8
6
|
export { default as Notify } from './notify';
|
|
9
|
-
export { default as Logout } from './logout';
|
|
10
|
-
export { useActionContext } from './utils';
|
|
11
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/actions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/actions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/actions/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
export { default as NavigateTo } from './navigate-to';
|
|
2
2
|
export { default as ResetVariables } from './reset-variables';
|
|
3
|
-
export { default as SideEffect } from './side-effect';
|
|
4
3
|
export { default as TriggerVariable } from './trigger-variable';
|
|
5
4
|
export { default as UpdateVariable } from './update-variable';
|
|
6
5
|
export { default as DownloadVariable } from './download-variable';
|
|
7
|
-
export { default as DownloadContent } from './download-content';
|
|
8
6
|
export { default as Notify } from './notify';
|
|
9
|
-
export { default as Logout } from './logout';
|
|
10
|
-
export { useActionContext } from './utils';
|
|
11
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/actions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/actions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionHandler, NavigateToImpl } from '../types/core';
|
|
2
2
|
/**
|
|
3
3
|
* Front-end handler for NavigateTo action.
|
|
4
|
-
* Navigates to a specified URL
|
|
4
|
+
* Navigates to a specified URL.
|
|
5
5
|
*/
|
|
6
|
-
declare const NavigateTo:
|
|
6
|
+
declare const NavigateTo: ActionHandler<NavigateToImpl>;
|
|
7
7
|
export default NavigateTo;
|
|
8
8
|
//# sourceMappingURL=navigate-to.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate-to.d.ts","sourceRoot":"","sources":["../../js/actions/navigate-to.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigate-to.d.ts","sourceRoot":"","sources":["../../js/actions/navigate-to.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAwB7D;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,aAAa,CAAC,cAAc,CAY7C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,26 +1,13 @@
|
|
|
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
|
-
import { useNotifications } from '@darajs/ui-notifications';
|
|
14
|
-
import { Status } from '@darajs/ui-utils';
|
|
15
|
-
import { resolveValue } from '../shared/interactivity/resolve-value';
|
|
16
|
-
import useVariableValue from '../shared/interactivity/use-variable-value';
|
|
17
|
-
import { normalizeRequest } from '../shared/utils/normalization';
|
|
18
1
|
/**
|
|
19
2
|
* Check whether the passed url is a valid url
|
|
20
3
|
*
|
|
21
4
|
* @param url the url to check
|
|
22
5
|
*/
|
|
23
6
|
function isValidHttpUrl(url) {
|
|
7
|
+
// Check if the url starts with a slash, which is a valid relative url
|
|
8
|
+
if (url.startsWith('/')) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
24
11
|
let newUrl;
|
|
25
12
|
try {
|
|
26
13
|
newUrl = new URL(url);
|
|
@@ -32,47 +19,19 @@ function isValidHttpUrl(url) {
|
|
|
32
19
|
}
|
|
33
20
|
/**
|
|
34
21
|
* Front-end handler for NavigateTo action.
|
|
35
|
-
* Navigates to a specified URL
|
|
22
|
+
* Navigates to a specified URL.
|
|
36
23
|
*/
|
|
37
|
-
const NavigateTo = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
url = action.url
|
|
49
|
-
? action.url
|
|
50
|
-
: yield fetchAction(action.uid, { extras: normalizedExtras, inputs: { value } });
|
|
51
|
-
}
|
|
52
|
-
catch (_c) {
|
|
53
|
-
// Recover from server error - notify about the action and don't do anything as we don't know where to navigate
|
|
54
|
-
pushNotification({
|
|
55
|
-
key: action.uid,
|
|
56
|
-
message: 'Try again or contact the application owner',
|
|
57
|
-
status: Status.ERROR,
|
|
58
|
-
title: 'Error executing action',
|
|
59
|
-
});
|
|
60
|
-
return Promise.resolve();
|
|
61
|
-
}
|
|
62
|
-
const isValidUrl = isValidHttpUrl(url);
|
|
63
|
-
if (isValidUrl || action.new_tab) {
|
|
64
|
-
// If the url is not valid then add the session token to it as it's an internal download request
|
|
65
|
-
if (!isValidUrl) {
|
|
66
|
-
url = url.includes('?')
|
|
67
|
-
? `${url}&session_token=${String(sessionToken)}`
|
|
68
|
-
: `${url}?session_token=${String(sessionToken)}`;
|
|
69
|
-
}
|
|
70
|
-
window.open(url, action.new_tab ? '_blank' : undefined);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
history.push(url);
|
|
74
|
-
}
|
|
75
|
-
}), [action, sessionToken]);
|
|
24
|
+
const NavigateTo = (ctx, actionImpl) => {
|
|
25
|
+
const isValidUrl = isValidHttpUrl(actionImpl.url);
|
|
26
|
+
if (!isValidUrl) {
|
|
27
|
+
throw new Error(`Invalid URL: ${actionImpl.url}`);
|
|
28
|
+
}
|
|
29
|
+
if (actionImpl.new_tab) {
|
|
30
|
+
window.open(actionImpl.url, actionImpl.new_tab ? '_blank' : undefined);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
ctx.history.push(actionImpl.url);
|
|
34
|
+
}
|
|
76
35
|
};
|
|
77
36
|
export default NavigateTo;
|
|
78
37
|
//# sourceMappingURL=navigate-to.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate-to.js","sourceRoot":"","sources":["../../js/actions/navigate-to.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigate-to.js","sourceRoot":"","sources":["../../js/actions/navigate-to.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,SAAS,cAAc,CAAC,GAAW;IAC/B,sEAAsE;IACtE,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC;KACf;IAED,IAAI,MAAM,CAAC;IAEX,IAAI;QACA,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;KACzB;IAAC,WAAM;QACJ,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,GAAkC,CAAC,GAAG,EAAE,UAAU,EAAQ,EAAE;IACxE,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAElD,IAAI,CAAC,UAAU,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,gBAAgB,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;KACrD;IAED,IAAI,UAAU,CAAC,OAAO,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;KAC1E;SAAM;QACH,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KACpC;AACL,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/actions/notify.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
* Frontend handler for Notify action
|
|
4
|
-
* Pushes a notification with the data given in the action
|
|
5
|
-
*/
|
|
6
|
-
declare const Notify: ActionHook<never, NotifyInstance>;
|
|
1
|
+
import { ActionHandler, NotifyImpl } from '../types/core';
|
|
2
|
+
declare const Notify: ActionHandler<NotifyImpl>;
|
|
7
3
|
export default Notify;
|
|
8
4
|
//# sourceMappingURL=notify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../js/actions/notify.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../js/actions/notify.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzD,QAAA,MAAM,MAAM,EAAE,aAAa,CAAC,UAAU,CAOrC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/actions/notify.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const Notify = (action) => {
|
|
10
|
-
const { pushNotification } = useNotifications();
|
|
11
|
-
return useCallback(() => new Promise((resolve) => {
|
|
12
|
-
pushNotification(action);
|
|
13
|
-
resolve();
|
|
14
|
-
}), [action]);
|
|
1
|
+
const Notify = (ctx, actionImpl) => {
|
|
2
|
+
var _a;
|
|
3
|
+
ctx.notificationCtx.pushNotification({
|
|
4
|
+
key: (_a = actionImpl.key) !== null && _a !== void 0 ? _a : actionImpl.title,
|
|
5
|
+
message: actionImpl.message,
|
|
6
|
+
status: actionImpl.status,
|
|
7
|
+
title: actionImpl.title,
|
|
8
|
+
});
|
|
15
9
|
};
|
|
16
10
|
export default Notify;
|
|
17
11
|
//# sourceMappingURL=notify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../js/actions/notify.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../js/actions/notify.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAA8B,CAAC,GAAG,EAAE,UAAU,EAAQ,EAAE;;IAChE,GAAG,CAAC,eAAe,CAAC,gBAAgB,CAAC;QACjC,GAAG,EAAE,MAAA,UAAU,CAAC,GAAG,mCAAI,UAAU,CAAC,KAAK;QACvC,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,KAAK,EAAE,UAAU,CAAC,KAAK;KAC1B,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionHandler, ResetVariablesImpl } from '../types/core';
|
|
2
2
|
/**
|
|
3
3
|
* Front-end handler for ResetVariables action.
|
|
4
4
|
* Sequentially resets variables to their default values (or forces a recalculation for DerivedVariables)
|
|
5
5
|
*/
|
|
6
|
-
declare const ResetVariables:
|
|
6
|
+
declare const ResetVariables: ActionHandler<ResetVariablesImpl>;
|
|
7
7
|
export default ResetVariables;
|
|
8
8
|
//# sourceMappingURL=reset-variables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-variables.d.ts","sourceRoot":"","sources":["../../js/actions/reset-variables.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reset-variables.d.ts","sourceRoot":"","sources":["../../js/actions/reset-variables.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGjE;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE,aAAa,CAAC,kBAAkB,CA4BrD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useCallback } from 'react';
|
|
11
|
-
import { useResetVariables } from '../shared/interactivity';
|
|
1
|
+
import { getOrRegisterPlainVariable } from '../shared/interactivity/plain-variable';
|
|
2
|
+
import { getOrRegisterTrigger } from '../shared/interactivity/triggers';
|
|
3
|
+
import { getOrRegisterUrlVariable } from '../shared/interactivity/url-variable';
|
|
4
|
+
import { isDataVariable, isDerivedDataVariable, isDerivedVariable, isUrlVariable, isVariable } from '../types/utils';
|
|
12
5
|
/**
|
|
13
6
|
* Front-end handler for ResetVariables action.
|
|
14
7
|
* Sequentially resets variables to their default values (or forces a recalculation for DerivedVariables)
|
|
15
8
|
*/
|
|
16
|
-
const ResetVariables = (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const ResetVariables = (ctx, actionImpl) => {
|
|
10
|
+
actionImpl.variables.filter(isVariable).forEach((variable) => {
|
|
11
|
+
// For DVs, trigger their recalculation
|
|
12
|
+
if (isDerivedVariable(variable) || isDerivedDataVariable(variable)) {
|
|
13
|
+
const triggerAtom = getOrRegisterTrigger(variable);
|
|
14
|
+
ctx.set(triggerAtom, (triggerIndexValue) => ({
|
|
15
|
+
force: true,
|
|
16
|
+
inc: triggerIndexValue.inc + 1,
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
else if (isUrlVariable(variable)) {
|
|
20
|
+
// For UrlVariables, we use set instead of reset to update the URL as well; otherwise just the atom is reset
|
|
21
|
+
const urlAtom = getOrRegisterUrlVariable(variable);
|
|
22
|
+
ctx.set(urlAtom, variable.default);
|
|
23
|
+
}
|
|
24
|
+
else if (isDataVariable(variable)) {
|
|
25
|
+
// for data variables this is a noop
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// For plain variables reset them to default values
|
|
29
|
+
const plainAtom = getOrRegisterPlainVariable(variable, ctx.wsClient, ctx.taskCtx, ctx.location.search, ctx.sessionToken);
|
|
30
|
+
ctx.reset(plainAtom);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
22
33
|
};
|
|
23
34
|
export default ResetVariables;
|
|
24
35
|
//# sourceMappingURL=reset-variables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-variables.js","sourceRoot":"","sources":["../../js/actions/reset-variables.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reset-variables.js","sourceRoot":"","sources":["../../js/actions/reset-variables.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEpH;;;GAGG;AACH,MAAM,cAAc,GAAsC,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;IAC1E,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACzD,uCAAuC;QACvC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;YAChE,MAAM,WAAW,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;YAEnD,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;gBACzC,KAAK,EAAE,IAAI;gBACX,GAAG,EAAE,iBAAiB,CAAC,GAAG,GAAG,CAAC;aACjC,CAAC,CAAC,CAAC;SACP;aAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;YAChC,4GAA4G;YAC5G,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;YACnD,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;SACtC;aAAM,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE;YACjC,oCAAoC;SACvC;aAAM;YACH,mDAAmD;YACnD,MAAM,SAAS,GAAG,0BAA0B,CACxC,QAAQ,EACR,GAAG,CAAC,QAAQ,EACZ,GAAG,CAAC,OAAO,EACX,GAAG,CAAC,QAAQ,CAAC,MAAM,EACnB,GAAG,CAAC,YAAY,CACnB,CAAC;YACF,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;SACxB;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionHandler, TriggerVariableImpl } from '../types/core';
|
|
2
2
|
/**
|
|
3
3
|
* Front-end handler for TriggerVariable action.
|
|
4
4
|
* Forces the recalculation of a particular DerivedVariable.
|
|
5
5
|
*/
|
|
6
|
-
declare const TriggerVariable:
|
|
6
|
+
declare const TriggerVariable: ActionHandler<TriggerVariableImpl>;
|
|
7
7
|
export default TriggerVariable;
|
|
8
8
|
//# sourceMappingURL=trigger-variable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-variable.d.ts","sourceRoot":"","sources":["../../js/actions/trigger-variable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger-variable.d.ts","sourceRoot":"","sources":["../../js/actions/trigger-variable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAElE;;;GAGG;AACH,QAAA,MAAM,eAAe,EAAE,aAAa,CAAC,mBAAmB,CAOvD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useCallback } from 'react';
|
|
11
|
-
import { useTriggerVariable } from '../shared/interactivity';
|
|
1
|
+
import { getOrRegisterTrigger } from '../shared/interactivity/triggers';
|
|
12
2
|
/**
|
|
13
3
|
* Front-end handler for TriggerVariable action.
|
|
14
4
|
* Forces the recalculation of a particular DerivedVariable.
|
|
15
5
|
*/
|
|
16
|
-
const TriggerVariable = (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}), [trigger]);
|
|
6
|
+
const TriggerVariable = (ctx, actionImpl) => {
|
|
7
|
+
const triggerAtom = getOrRegisterTrigger(actionImpl.variable);
|
|
8
|
+
ctx.set(triggerAtom, (triggerIndexValue) => ({
|
|
9
|
+
force: actionImpl.force,
|
|
10
|
+
inc: triggerIndexValue.inc + 1,
|
|
11
|
+
}));
|
|
23
12
|
};
|
|
24
13
|
export default TriggerVariable;
|
|
25
14
|
//# sourceMappingURL=trigger-variable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-variable.js","sourceRoot":"","sources":["../../js/actions/trigger-variable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger-variable.js","sourceRoot":"","sources":["../../js/actions/trigger-variable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE;;;GAGG;AACH,MAAM,eAAe,GAAuC,CAAC,GAAG,EAAE,UAAU,EAAQ,EAAE;IAClF,MAAM,WAAW,GAAG,oBAAoB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE9D,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACzC,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,GAAG,EAAE,iBAAiB,CAAC,GAAG,GAAG,CAAC;KACjC,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionHandler, UpdateVariableImpl } from '../types/core';
|
|
2
2
|
/**
|
|
3
3
|
* Front-end handler for UpdateVariable action.
|
|
4
|
-
* Calls the backend to calculate a new value for a variable based on the value passed into the action and optional
|
|
5
|
-
* extra variables. Then updates the value stored on the frontend with the value returned by the backend.
|
|
6
4
|
*/
|
|
7
|
-
declare const UpdateVariable:
|
|
5
|
+
declare const UpdateVariable: ActionHandler<UpdateVariableImpl>;
|
|
8
6
|
export default UpdateVariable;
|
|
9
7
|
//# sourceMappingURL=update-variable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-variable.d.ts","sourceRoot":"","sources":["../../js/actions/update-variable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-variable.d.ts","sourceRoot":"","sources":["../../js/actions/update-variable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAYjE;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,aAAa,CAAC,kBAAkB,CAYrD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|