@kineticdata/react 5.1.2 → 6.0.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/assets/task/icons/drag-handle.svg +3 -0
- package/assets/task/icons/plus_small.svg +2 -4
- package/lib/apis/agent/adapters.js +16 -12
- package/lib/apis/agent/bridges.js +54 -41
- package/lib/apis/agent/handlers.js +51 -38
- package/lib/apis/core/activity.js +19 -11
- package/lib/apis/core/attributeDefinitions.js +54 -46
- package/lib/apis/core/attributeDefinitions.test.js +47 -55
- package/lib/apis/core/authentication.js +58 -63
- package/lib/apis/core/backgroundJobs.js +38 -30
- package/lib/apis/core/bridgeModelAttributeMappings.js +42 -34
- package/lib/apis/core/bridgeModelAttributes.js +47 -37
- package/lib/apis/core/bridgeModelMappings.js +42 -34
- package/lib/apis/core/bridgeModelQualificationMappings.js +42 -34
- package/lib/apis/core/bridgeModelQualifications.js +42 -34
- package/lib/apis/core/bridgeModels.js +56 -46
- package/lib/apis/core/bridgeModels.test.js +64 -80
- package/lib/apis/core/bridgedresources.js +64 -72
- package/lib/apis/core/bridgedresources.test.js +33 -30
- package/lib/apis/core/categories.js +59 -52
- package/lib/apis/core/categories.test.js +36 -33
- package/lib/apis/core/fileResources.js +41 -33
- package/lib/apis/core/filestores.js +42 -34
- package/lib/apis/core/formTypes.js +50 -44
- package/lib/apis/core/forms.js +53 -49
- package/lib/apis/core/forms.test.js +60 -74
- package/lib/apis/core/kapps.js +45 -39
- package/lib/apis/core/kapps.test.js +45 -52
- package/lib/apis/core/logs.js +20 -16
- package/lib/apis/core/memberships.js +23 -20
- package/lib/apis/core/meta.js +31 -19
- package/lib/apis/core/notices.js +17 -9
- package/lib/apis/core/oauthClients.js +49 -45
- package/lib/apis/core/platformComponents.js +73 -57
- package/lib/apis/core/platformItems.js +22 -13
- package/lib/apis/core/profile.js +28 -21
- package/lib/apis/core/profile.test.js +20 -17
- package/lib/apis/core/securityPolicyDefinitions.js +48 -41
- package/lib/apis/core/securityPolicyDefinitions.test.js +50 -60
- package/lib/apis/core/space.js +23 -16
- package/lib/apis/core/space.test.js +31 -38
- package/lib/apis/core/submissions.js +213 -186
- package/lib/apis/core/submissions.test.js +39 -36
- package/lib/apis/core/teams.js +51 -44
- package/lib/apis/core/teams.test.js +42 -39
- package/lib/apis/core/translations.js +123 -130
- package/lib/apis/core/translations.test.js +278 -368
- package/lib/apis/core/users.js +56 -49
- package/lib/apis/core/users.test.js +42 -39
- package/lib/apis/core/version.js +20 -11
- package/lib/apis/core/webApis.js +42 -34
- package/lib/apis/core/webhooks.js +48 -41
- package/lib/apis/core/webhooks.test.js +50 -60
- package/lib/apis/core/webhooksJobs.js +30 -26
- package/lib/apis/core/workflows.js +52 -44
- package/lib/apis/http.js +89 -80
- package/lib/apis/http.test.js +37 -38
- package/lib/apis/index.js +506 -50
- package/lib/apis/system/index.js +228 -211
- package/lib/apis/task/index.js +280 -227
- package/lib/components/agent/bridge/BridgeForm.js +50 -50
- package/lib/components/agent/bridge/BridgeTable.js +12 -8
- package/lib/components/agent/filestore/FilestoreForm.js +49 -48
- package/lib/components/agent/filestore/FilestoreTable.js +12 -8
- package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
- package/lib/components/agent/handler/AgentHandlerTable.js +12 -8
- package/lib/components/common/AttributeSelect.js +15 -9
- package/lib/components/common/BridgeSelect.js +48 -43
- package/lib/components/common/ComponentConfigContext.js +9 -2
- package/lib/components/common/ContentEditable.js +36 -60
- package/lib/components/common/FormSelect.js +70 -58
- package/lib/components/common/NodeSelect.js +23 -19
- package/lib/components/common/Scroller.js +24 -23
- package/lib/components/common/StaticSelect.js +57 -50
- package/lib/components/common/TableInput.js +54 -57
- package/lib/components/common/TeamSelect.js +42 -39
- package/lib/components/common/Typeahead.js +121 -138
- package/lib/components/common/UserSelect.js +42 -41
- package/lib/components/common/authentication/AuthInterceptor.js +15 -19
- package/lib/components/common/authentication/AuthInterceptor.test.js +46 -64
- package/lib/components/common/authentication/AuthenticationContainer.js +350 -454
- package/lib/components/common/authentication/RequestInterceptor.js +16 -19
- package/lib/components/common/code_input/CodeInput.js +92 -122
- package/lib/components/common/code_input/draftHelpers.js +96 -90
- package/lib/components/common/code_input/languageHelpers.js +49 -47
- package/lib/components/common/code_input/languageHelpers.test.js +21 -16
- package/lib/components/core/CoreFormModal.js +26 -24
- package/lib/components/core/CoreModal.js +37 -31
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +24 -23
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +18 -15
- package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
- package/lib/components/core/bridge_model/BridgeModelTable.js +12 -8
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +17 -16
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +25 -21
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +20 -20
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +27 -22
- package/lib/components/core/category/CategoryForm.js +22 -22
- package/lib/components/core/category/CategoryTable.js +15 -10
- package/lib/components/core/core_form/CoreForm.js +209 -285
- package/lib/components/core/core_form/CoreForm.test.js +12 -10
- package/lib/components/core/core_form/defaults/index.js +52 -44
- package/lib/components/core/core_form/globals.js +14 -5
- package/lib/components/core/field_definition/FieldDefinitionForm.js +23 -21
- package/lib/components/core/field_definition/FieldDefinitionTable.js +15 -10
- package/lib/components/core/file_resource/FileResourceForm.js +38 -37
- package/lib/components/core/file_resource/FileResourceTable.js +16 -12
- package/lib/components/core/form/FormForm.js +56 -61
- package/lib/components/core/form/FormTable.js +25 -22
- package/lib/components/core/form_type/FormTypeForm.js +14 -13
- package/lib/components/core/form_type/FormTypeTable.js +12 -8
- package/lib/components/core/i18n/I18n.js +54 -61
- package/lib/components/core/i18n/I18nContext.js +9 -2
- package/lib/components/core/i18n/I18nProvider.js +40 -43
- package/lib/components/core/i18n/Moment.js +40 -50
- package/lib/components/core/index_definition/IndexDefinitionForm.js +23 -24
- package/lib/components/core/index_definition/IndexDefinitionTable.js +19 -11
- package/lib/components/core/index_job/IndexJobTable.js +20 -15
- package/lib/components/core/kapp/KappForm.js +57 -58
- package/lib/components/core/kapp/KappTable.js +17 -12
- package/lib/components/core/log/LogTable.js +35 -33
- package/lib/components/core/oauth_client/OAuthClientForm.js +17 -17
- package/lib/components/core/oauth_client/OAuthClientTable.js +12 -8
- package/lib/components/core/platform_component/AgentComponentForm.js +15 -15
- package/lib/components/core/platform_component/AgentComponentTable.js +10 -5
- package/lib/components/core/platform_component/TaskComponentForm.js +14 -14
- package/lib/components/core/profile/ProfileForm.js +40 -39
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +28 -25
- package/lib/components/core/security_definition/SecurityDefinitionTable.js +18 -13
- package/lib/components/core/space/SpaceForm.js +79 -90
- package/lib/components/core/submission/DatastoreSubmissionFilters.js +39 -40
- package/lib/components/core/submission/DatastoreSubmissionTable.js +37 -34
- package/lib/components/core/submission/FormSubmissionFilters.js +79 -75
- package/lib/components/core/submission/FormSubmissionTable.js +27 -20
- package/lib/components/core/submission/KappSubmissionTable.js +30 -29
- package/lib/components/core/submission/SubmissionForm.js +126 -55
- package/lib/components/core/submission/SubmissionTable.js +24 -20
- package/lib/components/core/submission/helpers.js +37 -33
- package/lib/components/core/submission/helpers.test.js +69 -20
- package/lib/components/core/team/TeamForm.js +24 -21
- package/lib/components/core/team/TeamTable.js +16 -11
- package/lib/components/core/translation/ContextForm.js +13 -10
- package/lib/components/core/translation/ContextTable.js +13 -10
- package/lib/components/core/translation/EntryForm.js +27 -24
- package/lib/components/core/translation/EntryTable.js +19 -16
- package/lib/components/core/translation/LocaleForm.js +16 -13
- package/lib/components/core/translation/LocaleTable.js +12 -8
- package/lib/components/core/user/UserForm.js +38 -37
- package/lib/components/core/user/UserTable.js +19 -15
- package/lib/components/core/webapi/WebApiForm.js +49 -61
- package/lib/components/core/webapi/WebApiTable.js +14 -10
- package/lib/components/core/webhook/WebhookForm.js +33 -32
- package/lib/components/core/webhook/WebhookTable.js +22 -20
- package/lib/components/core/webhook_job/WebhookJobTable.js +19 -16
- package/lib/components/form/Form.helpers.js +102 -90
- package/lib/components/form/Form.js +467 -524
- package/lib/components/form/Form.models.js +38 -24
- package/lib/components/form/FormState.js +8 -5
- package/lib/components/form/KitchenSinkForm.js +135 -4
- package/lib/components/form/defaults/AttributesField.js +48 -59
- package/lib/components/form/defaults/CheckboxField.js +14 -6
- package/lib/components/form/defaults/CodeField.js +15 -7
- package/lib/components/form/defaults/FormButtons.js +12 -4
- package/lib/components/form/defaults/FormError.js +12 -4
- package/lib/components/form/defaults/FormField.js +15 -7
- package/lib/components/form/defaults/FormLayout.js +12 -4
- package/lib/components/form/defaults/FormMultiField.js +15 -7
- package/lib/components/form/defaults/PasswordField.js +14 -6
- package/lib/components/form/defaults/RadioField.js +15 -7
- package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +17 -9
- package/lib/components/form/defaults/SelectField.js +16 -8
- package/lib/components/form/defaults/SelectMultiField.js +15 -7
- package/lib/components/form/defaults/TableField.js +14 -6
- package/lib/components/form/defaults/TeamField.js +15 -7
- package/lib/components/form/defaults/TeamMultiField.js +15 -7
- package/lib/components/form/defaults/TextField.js +14 -6
- package/lib/components/form/defaults/TextMultiField.js +26 -28
- package/lib/components/form/defaults/UserField.js +15 -7
- package/lib/components/form/defaults/UserMultiField.js +15 -7
- package/lib/components/form/defaults/index.js +48 -41
- package/lib/components/form/tests/Form.test.js +568 -864
- package/lib/components/form/tests/components.js +15 -25
- package/lib/components/form/tests/helpers.test.js +35 -33
- package/lib/components/index.js +981 -135
- package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
- package/lib/components/system/SystemFilestoreForm.js +28 -25
- package/lib/components/system/SystemForm.js +19 -16
- package/lib/components/system/SystemIngressForm.js +10 -9
- package/lib/components/system/SystemSecurityForm.js +17 -14
- package/lib/components/system/SystemSmtpForm.js +13 -13
- package/lib/components/system/SystemTaskAdapterForm.js +21 -17
- package/lib/components/system/SystemUserForm.js +15 -14
- package/lib/components/system/helpers.js +62 -60
- package/lib/components/system/helpers.test.js +16 -12
- package/lib/components/system/spaces/SystemSpaceForm.js +25 -24
- package/lib/components/system/spaces/SystemTenantForm.js +43 -40
- package/lib/components/system/spaces/SystemTenantTable.js +12 -8
- package/lib/components/table/Table.js +211 -224
- package/lib/components/table/Table.redux.js +292 -329
- package/lib/components/table/Table.redux.test.js +49 -47
- package/lib/components/table/Table.test.js +107 -132
- package/lib/components/table/defaults/BodyCell.js +12 -6
- package/lib/components/table/defaults/BodyRow.js +10 -4
- package/lib/components/table/defaults/BooleanFilter.js +17 -11
- package/lib/components/table/defaults/EmptyBodyRow.js +12 -6
- package/lib/components/table/defaults/FilterLayout.js +17 -11
- package/lib/components/table/defaults/Footer.js +11 -5
- package/lib/components/table/defaults/FooterCell.js +10 -4
- package/lib/components/table/defaults/FooterRow.js +10 -4
- package/lib/components/table/defaults/Header.js +10 -4
- package/lib/components/table/defaults/HeaderCell.js +16 -10
- package/lib/components/table/defaults/HeaderRow.js +10 -4
- package/lib/components/table/defaults/PaginationControl.js +18 -9
- package/lib/components/table/defaults/TableBody.js +10 -4
- package/lib/components/table/defaults/TableLayout.js +12 -6
- package/lib/components/table/defaults/TextFilter.js +16 -10
- package/lib/components/table/defaults/index.js +41 -33
- package/lib/components/task/builder/Connector.js +100 -111
- package/lib/components/task/builder/ConnectorForm.js +17 -11
- package/lib/components/task/builder/Node.js +101 -83
- package/lib/components/task/builder/NodeForm.js +30 -27
- package/lib/components/task/builder/NodeParametersForm.js +27 -24
- package/lib/components/task/builder/SvgCanvas.js +67 -96
- package/lib/components/task/builder/SvgText.js +19 -134
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +27 -22
- package/lib/components/task/builder/TreeBuilder.js +140 -115
- package/lib/components/task/builder/builder.redux.js +311 -326
- package/lib/components/task/builder/constants.js +94 -45
- package/lib/components/task/builder/helpers.js +184 -173
- package/lib/components/task/builder/helpers.test.js +20 -18
- package/lib/components/task/builder/models.js +121 -98
- package/lib/components/task/category/TaskCategoryForm.js +31 -29
- package/lib/components/task/category/TaskCategoryTable.js +12 -8
- package/lib/components/task/common/UsageTable.js +16 -12
- package/lib/components/task/engine/EngineSettingsForm.js +13 -11
- package/lib/components/task/errors/RunErrorTable.js +17 -13
- package/lib/components/task/errors/SystemErrorsTable.js +13 -9
- package/lib/components/task/handlers/HandlerForm.js +55 -55
- package/lib/components/task/handlers/HandlerTable.js +12 -8
- package/lib/components/task/handlers/MissingHandlerTable.js +12 -8
- package/lib/components/task/policy_rule/PolicyRuleForm.js +33 -32
- package/lib/components/task/policy_rule/PolicyRuleTable.js +12 -8
- package/lib/components/task/runs/CreateManualTriggerForm.js +17 -15
- package/lib/components/task/runs/RunTable.js +23 -20
- package/lib/components/task/runs/RunTaskTable.js +10 -6
- package/lib/components/task/sources/SourceForm.js +47 -47
- package/lib/components/task/sources/SourceTable.js +14 -11
- package/lib/components/task/triggers/TriggerTable.js +21 -18
- package/lib/components/task/workflows/LinkedWorkflowForm.js +48 -54
- package/lib/components/task/workflows/LinkedWorkflowTable.js +14 -10
- package/lib/components/task/workflows/MissingRoutineTable.js +12 -8
- package/lib/components/task/workflows/WorkflowForm.js +49 -44
- package/lib/components/task/workflows/WorkflowTable.js +17 -14
- package/lib/helpers/SearchBuilder.js +73 -127
- package/lib/helpers/SearchBuilder.test.js +184 -175
- package/lib/helpers/index.js +116 -74
- package/lib/index.js +86 -38
- package/lib/reducer.js +11 -3
- package/lib/saga.js +42 -38
- package/lib/store.js +59 -35
- package/package.json +3 -28
- package/proxyhelper.js +105 -46
- package/assets/discussions/images/avi_128.png +0 -0
- package/assets/discussions/images/excel_128.png +0 -0
- package/assets/discussions/images/html_128.png +0 -0
- package/assets/discussions/images/illustrator_128.png +0 -0
- package/assets/discussions/images/indesign_128.png +0 -0
- package/assets/discussions/images/movie_128.png +0 -0
- package/assets/discussions/images/mpeg_128.png +0 -0
- package/assets/discussions/images/pdf_128.png +0 -0
- package/assets/discussions/images/photoshop_128.png +0 -0
- package/assets/discussions/images/powerpoint_128.png +0 -0
- package/assets/discussions/images/txt_128.png +0 -0
- package/assets/discussions/images/unknown_128.png +0 -0
- package/assets/discussions/images/word_128.png +0 -0
- package/assets/discussions/styles/_discussion.scss +0 -506
- package/lib/apis/discussions/index.js +0 -395
- package/lib/apis/socket/index.js +0 -77
- package/lib/apis/socket/socket.js +0 -350
- package/lib/apis/socket/socket.test.js +0 -90
- package/lib/apis/socket/timer.js +0 -45
- package/lib/apis/socket/timer.test.js +0 -51
- package/lib/apis/socket/topic.js +0 -185
- package/lib/apis/topics/index.js +0 -19
- package/lib/components/discussions/ChatInputForm.js +0 -424
- package/lib/components/discussions/DateBanner.js +0 -10
- package/lib/components/discussions/Discussion.js +0 -202
- package/lib/components/discussions/DiscussionForm.js +0 -227
- package/lib/components/discussions/InvitationForm.js +0 -107
- package/lib/components/discussions/MessageHistory.js +0 -110
- package/lib/components/discussions/MessagesByDate.js +0 -40
- package/lib/components/discussions/MessagesList.js +0 -30
- package/lib/components/discussions/MoreMessagesBanner.js +0 -26
- package/lib/components/discussions/ScrollHelper.js +0 -84
- package/lib/components/discussions/SystemMessage.js +0 -88
- package/lib/components/discussions/SystemMessageGroup.js +0 -15
- package/lib/components/discussions/UserMessage.js +0 -163
- package/lib/components/discussions/UserMessageGroup.js +0 -34
- package/lib/components/discussions/redux.js +0 -178
- package/lib/components/discussions/sagas.js +0 -500
- package/lib/helpers/discussions/canManage.js +0 -30
- package/lib/helpers/discussions/canManage.test.js +0 -69
- package/lib/helpers/discussions/generateSystemMessageContent.js +0 -131
- package/lib/helpers/discussions/generateSystemMessageContent.test.js +0 -450
- package/lib/models/discussions.js +0 -76
- package/lib/models/index.js +0 -1
package/lib/helpers/index.js
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
K: true,
|
|
9
|
+
bundle: true,
|
|
10
|
+
splitTeamName: true,
|
|
11
|
+
partitionListBy: true,
|
|
12
|
+
generateKey: true,
|
|
13
|
+
slugify: true,
|
|
14
|
+
buildDefinitionId: true,
|
|
15
|
+
buildBindings: true,
|
|
16
|
+
buildAgentPath: true,
|
|
17
|
+
handleFormErrors: true,
|
|
18
|
+
INDEX_STATIC_PARTS: true,
|
|
19
|
+
TIMELINES: true,
|
|
20
|
+
MAX_PART_LENGTH: true
|
|
21
|
+
};
|
|
22
|
+
exports.splitTeamName = exports.slugify = exports.partitionListBy = exports.handleFormErrors = exports.generateKey = exports.bundle = exports.buildDefinitionId = exports.buildBindings = exports.buildAgentPath = exports.TIMELINES = exports.MAX_PART_LENGTH = exports.K = exports.INDEX_STATIC_PARTS = void 0;
|
|
23
|
+
var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toArray"));
|
|
24
|
+
var _immutable = require("immutable");
|
|
25
|
+
var _SearchBuilder = require("./SearchBuilder");
|
|
26
|
+
Object.keys(_SearchBuilder).forEach(function (key) {
|
|
27
|
+
if (key === "default" || key === "__esModule") return;
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
+
if (key in exports && exports[key] === _SearchBuilder[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _SearchBuilder[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var K = typeof window !== "undefined" ? window.K : function () {};
|
|
38
|
+
// platform consoles and other apps may not load app head content that
|
|
4
39
|
// instantiates the bundle object used by some of these helpers so we create a
|
|
5
40
|
// mock version here
|
|
6
|
-
|
|
7
|
-
|
|
41
|
+
exports.K = K;
|
|
42
|
+
var bundle = typeof window !== "undefined" && window.bundle ? window.bundle : {
|
|
8
43
|
apiLocation: function apiLocation() {
|
|
9
44
|
return "".concat(process.env.REACT_APP_API_HOST || '', "/app/api/v1");
|
|
10
45
|
},
|
|
@@ -14,61 +49,68 @@ export var bundle = typeof window !== "undefined" && window.bundle ? window.bund
|
|
|
14
49
|
kappSlug: function kappSlug() {
|
|
15
50
|
return '';
|
|
16
51
|
}
|
|
17
|
-
};
|
|
52
|
+
};
|
|
53
|
+
// when running the bundle in dev mode there will already be a bundle object but
|
|
18
54
|
// we want to prefix the locations with the REACT_APP_API_HOST value
|
|
19
|
-
|
|
55
|
+
exports.bundle = bundle;
|
|
20
56
|
if (typeof window !== "undefined" && window.bundle && process.env.REACT_APP_API_HOST) {
|
|
21
57
|
var spaceLocation = window.bundle.spaceLocation();
|
|
22
58
|
var apiLocation = window.bundle.apiLocation();
|
|
23
|
-
|
|
24
59
|
window.bundle.spaceLocation = function () {
|
|
25
60
|
return process.env.REACT_APP_API_HOST + spaceLocation;
|
|
26
61
|
};
|
|
27
|
-
|
|
28
62
|
window.bundle.apiLocation = function () {
|
|
29
63
|
return process.env.REACT_APP_API_HOST + apiLocation;
|
|
30
64
|
};
|
|
31
65
|
}
|
|
32
|
-
|
|
33
|
-
export var splitTeamName = function splitTeamName(team) {
|
|
66
|
+
var splitTeamName = function splitTeamName(team) {
|
|
34
67
|
var _team$get$split$rever = team.get('name').split('::').reverse(),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
68
|
+
_team$get$split$rever2 = (0, _toArray2["default"])(_team$get$split$rever),
|
|
69
|
+
local = _team$get$split$rever2[0],
|
|
70
|
+
parents = _team$get$split$rever2.slice(1);
|
|
39
71
|
return [parents.reverse().join('::'), local];
|
|
40
|
-
};
|
|
41
|
-
// returns a different value.
|
|
72
|
+
};
|
|
42
73
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
// Applies fn to each value in list, splitting it into a new list each time fn
|
|
75
|
+
// returns a different value.
|
|
76
|
+
exports.splitTeamName = splitTeamName;
|
|
77
|
+
var partitionListBy = function partitionListBy(fn, list) {
|
|
78
|
+
return list.isEmpty() ? (0, _immutable.List)() : list.rest().reduce(function (reduction, current) {
|
|
79
|
+
return fn(reduction.last().last(), current) ? reduction.push((0, _immutable.List)([current])) : reduction.update(reduction.size - 1, function (list) {
|
|
46
80
|
return list.push(current);
|
|
47
81
|
});
|
|
48
|
-
}, List([List([list.first()])]));
|
|
82
|
+
}, (0, _immutable.List)([(0, _immutable.List)([list.first()])]));
|
|
49
83
|
};
|
|
50
|
-
|
|
84
|
+
exports.partitionListBy = partitionListBy;
|
|
85
|
+
var generateKey = function generateKey() {
|
|
51
86
|
var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
|
|
52
87
|
var result = '';
|
|
53
|
-
|
|
54
88
|
while (result.length < length) {
|
|
55
89
|
result = result + Math.floor(Math.random() * 16).toString(16).toUpperCase();
|
|
56
90
|
}
|
|
57
|
-
|
|
58
91
|
return result;
|
|
59
92
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
|
|
93
|
+
exports.generateKey = generateKey;
|
|
94
|
+
var slugify = function slugify(text) {
|
|
95
|
+
return text.trim()
|
|
96
|
+
// Convert uppercase to lowercase
|
|
97
|
+
.toLowerCase()
|
|
98
|
+
// Replace spaces with -
|
|
99
|
+
.replace(/\s+/g, '-')
|
|
100
|
+
// Remove all non-word chars
|
|
64
101
|
.replace(/[^A-Za-z0-9\u0080-\u00FF-]+/g, '');
|
|
65
102
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.
|
|
69
|
-
|
|
103
|
+
exports.slugify = slugify;
|
|
104
|
+
var buildDefinitionId = function buildDefinitionId(text) {
|
|
105
|
+
return text.trim()
|
|
106
|
+
// Convert uppercase to lowercase
|
|
107
|
+
.toLowerCase()
|
|
108
|
+
// Replace spaces with _
|
|
109
|
+
.replace(/\s+/g, '_')
|
|
110
|
+
// Remove unwanted chars
|
|
70
111
|
.replace(/[^A-Za-z0-9_]+/g, '');
|
|
71
112
|
};
|
|
113
|
+
exports.buildDefinitionId = buildDefinitionId;
|
|
72
114
|
var FILE_STATIC_BINDINGS = [['Folder', 'folder'], ['Name', 'name'], ['Path', 'path']];
|
|
73
115
|
var SUBMISSION_STATIC_BINDINGS = [['Anonymous', 'anonymous'], ['Closed At', 'closedAt'], ['Closed By', 'closedBy'], ['Core State', 'coreState'], ['Created At', 'createdAt'], ['Created By', 'createdBy'], ['Current Page', 'currentPage'], ['Id', 'id'], ['Session Token', 'sessionToken'], ['Submitted At', 'submittedAt'], ['Submitted By', 'submittedBy'], ['Type', 'type'], ['Updated At', 'updatedAt'], ['Updated By', 'updatedBy']];
|
|
74
116
|
var TEAM_STATIC_BINDINGS = [['Name', 'name'], ['Slug', 'slug']];
|
|
@@ -77,72 +119,69 @@ var FORM_STATIC_BINDINGS = [['Name', 'name'], ['Slug', 'slug']];
|
|
|
77
119
|
var KAPP_STATIC_BINDINGS = [['Name', 'name'], ['Slug', 'slug']];
|
|
78
120
|
var SPACE_STATIC_BINDINGS = [['Name', 'name'], ['Slug', 'slug']];
|
|
79
121
|
var IDENTITY_STATIC_BINDINGS = [['Username', 'username'], ['Display Name', 'displayName'], ['Email Address', 'email'], ['Groups', 'groups'], ['Session Token', 'sessionToken'], ['Is Anonymous?', 'anonymous'], ['Is Authenticated?', 'authenticated'], ['Is Space Admin?', 'spaceAdmin']];
|
|
80
|
-
|
|
81
122
|
var bindifyProfile = function bindifyProfile(fnName, staticMap, attributes, profileAttributes) {
|
|
82
123
|
var attributeTag = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Attribute';
|
|
83
124
|
var profileAttributeTag = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'Profile Attribute';
|
|
84
125
|
var attributesMap = attributes.map(function (value, label) {
|
|
85
|
-
return Map({
|
|
126
|
+
return (0, _immutable.Map)({
|
|
86
127
|
value: "".concat(fnName, "('attribute:").concat(label, "')"),
|
|
87
128
|
tags: [attributeTag]
|
|
88
129
|
});
|
|
89
130
|
});
|
|
90
131
|
var profileAttributesMap = profileAttributes.map(function (value, label) {
|
|
91
|
-
return Map({
|
|
132
|
+
return (0, _immutable.Map)({
|
|
92
133
|
value: "".concat(fnName, "('profileAttribute:").concat(label, "')"),
|
|
93
134
|
tags: [profileAttributeTag]
|
|
94
135
|
});
|
|
95
136
|
});
|
|
96
|
-
var combinedMap = OrderedMap(staticMap).merge(attributesMap).merge(profileAttributesMap);
|
|
137
|
+
var combinedMap = (0, _immutable.OrderedMap)(staticMap).merge(attributesMap).merge(profileAttributesMap);
|
|
97
138
|
return combinedMap.map(function (value) {
|
|
98
|
-
return Map({
|
|
99
|
-
value: Map.isMap(value) ? value.get('value') : "".concat(fnName, "('").concat(value, "')"),
|
|
139
|
+
return (0, _immutable.Map)({
|
|
140
|
+
value: _immutable.Map.isMap(value) ? value.get('value') : "".concat(fnName, "('").concat(value, "')"),
|
|
100
141
|
tags: []
|
|
101
142
|
});
|
|
102
143
|
});
|
|
103
144
|
};
|
|
104
|
-
|
|
105
145
|
var bindify = function bindify(fnName, staticMap) {
|
|
106
|
-
var attributeDefinitions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : List();
|
|
146
|
+
var attributeDefinitions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (0, _immutable.List)();
|
|
107
147
|
var attributeTag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Attribute';
|
|
108
148
|
return attributeDefinitions.reduce(function (reduction, attrDef) {
|
|
109
|
-
return reduction.set(attrDef.get('name'), Map({
|
|
149
|
+
return reduction.set(attrDef.get('name'), (0, _immutable.Map)({
|
|
110
150
|
value: "".concat(fnName, "('attribute:").concat(attrDef.get('name'), "')"),
|
|
111
151
|
tags: [attributeTag]
|
|
112
152
|
}));
|
|
113
|
-
}, OrderedMap(staticMap).map(function (value) {
|
|
114
|
-
return Map({
|
|
153
|
+
}, (0, _immutable.OrderedMap)(staticMap).map(function (value) {
|
|
154
|
+
return (0, _immutable.Map)({
|
|
115
155
|
value: "".concat(fnName, "('").concat(value, "')"),
|
|
116
156
|
tags: []
|
|
117
157
|
});
|
|
118
158
|
}));
|
|
119
159
|
};
|
|
120
|
-
|
|
121
|
-
export var buildBindings = function buildBindings(_ref) {
|
|
160
|
+
var buildBindings = function buildBindings(_ref) {
|
|
122
161
|
var space = _ref.space,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return OrderedMap([['Identity', Map({
|
|
128
|
-
children: profile && bindifyProfile('identity', IDENTITY_STATIC_BINDINGS, get(profile, 'attributesMap'), get(profile, 'profileAttributesMap'))
|
|
129
|
-
})], ['File Resource', Map({
|
|
162
|
+
kapp = _ref.kapp,
|
|
163
|
+
form = _ref.form,
|
|
164
|
+
scope = _ref.scope,
|
|
165
|
+
profile = _ref.profile;
|
|
166
|
+
return (0, _immutable.OrderedMap)([['Identity', (0, _immutable.Map)({
|
|
167
|
+
children: profile && bindifyProfile('identity', IDENTITY_STATIC_BINDINGS, (0, _immutable.get)(profile, 'attributesMap'), (0, _immutable.get)(profile, 'profileAttributesMap'))
|
|
168
|
+
})], ['File Resource', (0, _immutable.Map)({
|
|
130
169
|
children: ['File Resource'].includes(scope) && bindify('file', FILE_STATIC_BINDINGS)
|
|
131
|
-
})], ['Form', Map({
|
|
132
|
-
children: ['Datastore Form', 'Datastore Submission', 'Form', 'Submission'].includes(scope) && bindify('form', FORM_STATIC_BINDINGS, scope.startsWith('Datastore') ? get(space, 'datastoreFormAttributeDefinitions') : get(kapp, 'formAttributeDefinitions'))
|
|
133
|
-
})], ['Kapp', Map({
|
|
134
|
-
children: ['Kapp', 'Form', 'Submission'].includes(scope) && bindify('kapp', KAPP_STATIC_BINDINGS, get(kapp, 'kappAttributeDefinitions'))
|
|
135
|
-
})], ['Space', Map({
|
|
136
|
-
children: bindify('space', SPACE_STATIC_BINDINGS, get(space, 'spaceAttributeDefinitions'))
|
|
137
|
-
})], ['Submission', Map({
|
|
170
|
+
})], ['Form', (0, _immutable.Map)({
|
|
171
|
+
children: ['Datastore Form', 'Datastore Submission', 'Form', 'Submission'].includes(scope) && bindify('form', FORM_STATIC_BINDINGS, scope.startsWith('Datastore') ? (0, _immutable.get)(space, 'datastoreFormAttributeDefinitions') : (0, _immutable.get)(kapp, 'formAttributeDefinitions'))
|
|
172
|
+
})], ['Kapp', (0, _immutable.Map)({
|
|
173
|
+
children: ['Kapp', 'Form', 'Submission'].includes(scope) && bindify('kapp', KAPP_STATIC_BINDINGS, (0, _immutable.get)(kapp, 'kappAttributeDefinitions'))
|
|
174
|
+
})], ['Space', (0, _immutable.Map)({
|
|
175
|
+
children: bindify('space', SPACE_STATIC_BINDINGS, (0, _immutable.get)(space, 'spaceAttributeDefinitions'))
|
|
176
|
+
})], ['Submission', (0, _immutable.Map)({
|
|
138
177
|
children: ['Submission', 'Datastore Submission'].includes(scope) && bindify('submission', SUBMISSION_STATIC_BINDINGS)
|
|
139
|
-
})], ['Team', Map({
|
|
140
|
-
children: scope === 'Team' && bindify('team', TEAM_STATIC_BINDINGS, get(space, 'teamAttributeDefinitions'))
|
|
141
|
-
})], ['User', Map({
|
|
142
|
-
children: scope === 'User' && bindify('user', USER_STATIC_BINDINGS, get(space, 'userAttributeDefinitions'))
|
|
143
|
-
})], ['Values', Map({
|
|
144
|
-
children: ['Submission', 'Datastore Submission'].includes(scope) && (form || kapp) && OrderedMap((form ? form.get('fields') : kapp.get('fields')).map(function (field) {
|
|
145
|
-
return [field.get('name'), Map({
|
|
178
|
+
})], ['Team', (0, _immutable.Map)({
|
|
179
|
+
children: scope === 'Team' && bindify('team', TEAM_STATIC_BINDINGS, (0, _immutable.get)(space, 'teamAttributeDefinitions'))
|
|
180
|
+
})], ['User', (0, _immutable.Map)({
|
|
181
|
+
children: scope === 'User' && bindify('user', USER_STATIC_BINDINGS, (0, _immutable.get)(space, 'userAttributeDefinitions'))
|
|
182
|
+
})], ['Values', (0, _immutable.Map)({
|
|
183
|
+
children: ['Submission', 'Datastore Submission'].includes(scope) && (form || kapp) && (0, _immutable.OrderedMap)((form ? form.get('fields') : kapp.get('fields')).map(function (field) {
|
|
184
|
+
return [field.get('name'), (0, _immutable.Map)({
|
|
146
185
|
value: "values('".concat(field.get('name'), "')"),
|
|
147
186
|
tags: []
|
|
148
187
|
})];
|
|
@@ -151,21 +190,24 @@ export var buildBindings = function buildBindings(_ref) {
|
|
|
151
190
|
return o.get('children') && !o.get('children').isEmpty() || o.has('value');
|
|
152
191
|
});
|
|
153
192
|
};
|
|
154
|
-
|
|
193
|
+
exports.buildBindings = buildBindings;
|
|
194
|
+
var buildAgentPath = function buildAgentPath(options) {
|
|
155
195
|
return "".concat(bundle.spaceLocation(), "/app/components/agents/").concat(options.agentSlug ? options.agentSlug : 'system');
|
|
156
196
|
};
|
|
157
|
-
|
|
158
|
-
|
|
197
|
+
exports.buildAgentPath = buildAgentPath;
|
|
198
|
+
var handleFormErrors = function handleFormErrors(key) {
|
|
159
199
|
return function (result) {
|
|
160
200
|
var error = result.error;
|
|
161
|
-
|
|
162
201
|
if (error) {
|
|
163
202
|
throw error.statusCode === 400 && error.message || 'There was an error while saving.';
|
|
164
203
|
}
|
|
165
|
-
|
|
166
204
|
return key ? result[key] : result;
|
|
167
205
|
};
|
|
168
206
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
207
|
+
exports.handleFormErrors = handleFormErrors;
|
|
208
|
+
var INDEX_STATIC_PARTS = ['closedBy', 'coreState', 'createdBy', 'handle', 'submittedBy', 'type', 'updatedBy'].sort();
|
|
209
|
+
exports.INDEX_STATIC_PARTS = INDEX_STATIC_PARTS;
|
|
210
|
+
var TIMELINES = ['createdAt', 'updatedAt', 'submittedAt', 'closedAt'].sort();
|
|
211
|
+
exports.TIMELINES = TIMELINES;
|
|
212
|
+
var MAX_PART_LENGTH = 10;
|
|
213
|
+
exports.MAX_PART_LENGTH = MAX_PART_LENGTH;
|
package/lib/index.js
CHANGED
|
@@ -1,50 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
authInterceptor: true,
|
|
9
|
+
KineticLib: true,
|
|
10
|
+
history: true
|
|
11
|
+
};
|
|
12
|
+
exports.history = exports.authInterceptor = exports.KineticLib = void 0;
|
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
|
14
|
+
var _reactRedux = require("react-redux");
|
|
15
|
+
var _history = require("history");
|
|
16
|
+
var _immutable = require("immutable");
|
|
17
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
18
|
+
var _store = require("./store");
|
|
19
|
+
var _components = require("./components");
|
|
20
|
+
Object.keys(_components).forEach(function (key) {
|
|
21
|
+
if (key === "default" || key === "__esModule") return;
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
+
if (key in exports && exports[key] === _components[key]) return;
|
|
24
|
+
Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _components[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var _globals = require("./components/core/core_form/globals");
|
|
32
|
+
var _defaults = require("./components/form/defaults");
|
|
33
|
+
var _defaults2 = require("./components/table/defaults");
|
|
34
|
+
var _ComponentConfigContext = require("./components/common/ComponentConfigContext");
|
|
35
|
+
var _AuthenticationContainer = require("./components/common/authentication/AuthenticationContainer");
|
|
36
|
+
var _AuthInterceptor = _interopRequireDefault(require("./components/common/authentication/AuthInterceptor"));
|
|
37
|
+
var _RequestInterceptor = _interopRequireDefault(require("./components/common/authentication/RequestInterceptor"));
|
|
38
|
+
var _apis = require("./apis");
|
|
39
|
+
Object.keys(_apis).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _apis[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _apis[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _helpers = require("./helpers");
|
|
51
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
54
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
55
|
+
Object.defineProperty(exports, key, {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _helpers[key];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
var requestInterceptor = new _RequestInterceptor["default"](_store.store);
|
|
63
|
+
var authInterceptor = new _AuthInterceptor["default"](_store.store,
|
|
64
|
+
// callback to invoke when we get a 401 response
|
|
21
65
|
function () {
|
|
22
|
-
return action('TIMEOUT');
|
|
23
|
-
},
|
|
66
|
+
return (0, _store.action)('TIMEOUT');
|
|
67
|
+
},
|
|
68
|
+
// how to detect if the user has re-authenticated
|
|
24
69
|
function (state) {
|
|
25
70
|
return !!state.getIn(['session', 'token']);
|
|
26
|
-
},
|
|
71
|
+
},
|
|
72
|
+
// how to detect if the user has cancelled the re-authentication process
|
|
27
73
|
function (state) {
|
|
28
74
|
return !state.getIn(['session', 'loggedIn']);
|
|
29
75
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
76
|
+
exports.authInterceptor = authInterceptor;
|
|
77
|
+
_axios["default"].defaults.withCredentials = true;
|
|
78
|
+
_axios["default"].interceptors.request.use(requestInterceptor.handleFulfilled);
|
|
79
|
+
_axios["default"].interceptors.response.use(null, authInterceptor.handleRejected);
|
|
80
|
+
(0, _store.commitStore)();
|
|
81
|
+
var KineticLib = function KineticLib(props) {
|
|
82
|
+
return /*#__PURE__*/_react["default"].createElement(_reactRedux.Provider, {
|
|
83
|
+
store: _store.store,
|
|
84
|
+
context: _store.context
|
|
85
|
+
}, /*#__PURE__*/_react["default"].createElement(_components.I18nProvider, {
|
|
39
86
|
locale: props.locale
|
|
40
|
-
}, /*#__PURE__*/
|
|
87
|
+
}, /*#__PURE__*/_react["default"].createElement(_globals.GlobalsProvider, {
|
|
41
88
|
globals: props.globals
|
|
42
|
-
}, /*#__PURE__*/
|
|
43
|
-
value: DefaultFieldConfig.merge(DefaultTableConfig).merge(remove(props.components || {}, 'fields')).merge(props.components && props.components.fields)
|
|
44
|
-
}, typeof props.children === 'function' ? /*#__PURE__*/
|
|
45
|
-
noSocket: props.noSocket,
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement(_ComponentConfigContext.ComponentConfigContext.Provider, {
|
|
90
|
+
value: _defaults.DefaultFieldConfig.merge(_defaults2.DefaultTableConfig).merge((0, _immutable.remove)(props.components || {}, 'fields')).merge(props.components && props.components.fields)
|
|
91
|
+
}, typeof props.children === 'function' ? /*#__PURE__*/_react["default"].createElement(_AuthenticationContainer.AuthenticationContainer, {
|
|
46
92
|
skipInit: props.skipInit,
|
|
47
93
|
system: props.system
|
|
48
94
|
}, props.children) : props.children))));
|
|
49
95
|
};
|
|
50
|
-
|
|
96
|
+
exports.KineticLib = KineticLib;
|
|
97
|
+
var history = typeof window !== 'undefined' && window.bundle ? (0, _history.createHashHistory)() : null;
|
|
98
|
+
exports.history = history;
|
package/lib/reducer.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.regHandlers = exports.reducer = void 0;
|
|
1
7
|
var handlers = {};
|
|
2
|
-
|
|
8
|
+
var regHandlers = function regHandlers(newHandlers) {
|
|
3
9
|
Object.assign(handlers, newHandlers);
|
|
4
10
|
};
|
|
5
|
-
|
|
11
|
+
exports.regHandlers = regHandlers;
|
|
12
|
+
var reducer = function reducer(state, action) {
|
|
6
13
|
return handlers[action.type] ? handlers[action.type](state, action) : state;
|
|
7
|
-
};
|
|
14
|
+
};
|
|
15
|
+
exports.reducer = reducer;
|
package/lib/saga.js
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import createSagaMiddleware from 'redux-saga';
|
|
4
|
-
import * as effects from 'redux-saga/effects';
|
|
5
|
-
import { IO } from '@redux-saga/symbols'; // The list of saga effects that we support using as a single argument to the
|
|
6
|
-
// regSaga function.
|
|
1
|
+
"use strict";
|
|
7
2
|
|
|
8
|
-
var
|
|
9
|
-
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.sagaMiddleware = exports.runSaga = exports.regSaga = exports.commitSagas = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
|
11
|
+
var _reduxSaga = _interopRequireDefault(require("redux-saga"));
|
|
12
|
+
var effects = _interopRequireWildcard(require("redux-saga/effects"));
|
|
13
|
+
var _symbols = require("@redux-saga/symbols");
|
|
14
|
+
// The list of saga effects that we support using as a single argument to the
|
|
15
|
+
// regSaga function.
|
|
16
|
+
var supportedEffects = [effects.takeEvery('NOOP', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
17
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
10
18
|
while (1) {
|
|
11
19
|
switch (_context.prev = _context.next) {
|
|
12
20
|
case 0:
|
|
@@ -15,8 +23,8 @@ var supportedEffects = [effects.takeEvery('NOOP', /*#__PURE__*/_regeneratorRunti
|
|
|
15
23
|
}
|
|
16
24
|
}
|
|
17
25
|
}, _callee);
|
|
18
|
-
})).payload.fn, effects.takeLatest('NOOP', /*#__PURE__*/
|
|
19
|
-
return
|
|
26
|
+
})).payload.fn, effects.takeLatest('NOOP', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
|
27
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
20
28
|
while (1) {
|
|
21
29
|
switch (_context2.prev = _context2.next) {
|
|
22
30
|
case 0:
|
|
@@ -25,8 +33,8 @@ var supportedEffects = [effects.takeEvery('NOOP', /*#__PURE__*/_regeneratorRunti
|
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
}, _callee2);
|
|
28
|
-
})).payload.fn, effects.takeLeading('NOOP', /*#__PURE__*/
|
|
29
|
-
return
|
|
36
|
+
})).payload.fn, effects.takeLeading('NOOP', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
|
37
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
|
30
38
|
while (1) {
|
|
31
39
|
switch (_context3.prev = _context3.next) {
|
|
32
40
|
case 0:
|
|
@@ -35,8 +43,8 @@ var supportedEffects = [effects.takeEvery('NOOP', /*#__PURE__*/_regeneratorRunti
|
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
}, _callee3);
|
|
38
|
-
})).payload.fn, effects.throttle(0, 'NOOP', /*#__PURE__*/
|
|
39
|
-
return
|
|
46
|
+
})).payload.fn, effects.throttle(0, 'NOOP', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
|
47
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
|
|
40
48
|
while (1) {
|
|
41
49
|
switch (_context4.prev = _context4.next) {
|
|
42
50
|
case 0:
|
|
@@ -45,8 +53,8 @@ var supportedEffects = [effects.takeEvery('NOOP', /*#__PURE__*/_regeneratorRunti
|
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
}, _callee4);
|
|
48
|
-
})).payload.fn, effects.debounce(0, 'NOOP', /*#__PURE__*/
|
|
49
|
-
return
|
|
56
|
+
})).payload.fn, effects.debounce(0, 'NOOP', /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee5() {
|
|
57
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context5) {
|
|
50
58
|
while (1) {
|
|
51
59
|
switch (_context5.prev = _context5.next) {
|
|
52
60
|
case 0:
|
|
@@ -56,14 +64,12 @@ var supportedEffects = [effects.takeEvery('NOOP', /*#__PURE__*/_regeneratorRunti
|
|
|
56
64
|
}
|
|
57
65
|
}, _callee5);
|
|
58
66
|
})).payload.fn];
|
|
59
|
-
|
|
60
67
|
var parseSagaEffect = function parseSagaEffect(sagaEffect) {
|
|
61
|
-
if (sagaEffect[IO]) {
|
|
68
|
+
if (sagaEffect[_symbols.IO]) {
|
|
62
69
|
if (supportedEffects.includes(sagaEffect.payload.fn)) {
|
|
63
70
|
var args = sagaEffect.payload.args;
|
|
64
71
|
var name = typeof args[0] === 'number' ? args[1] : args[0];
|
|
65
72
|
var genFn = typeof args[0] === 'number' ? args[2] : args[1];
|
|
66
|
-
|
|
67
73
|
if (typeof name === 'string') {
|
|
68
74
|
return {
|
|
69
75
|
name: name,
|
|
@@ -79,34 +85,32 @@ var parseSagaEffect = function parseSagaEffect(sagaEffect) {
|
|
|
79
85
|
throw new Error('regSaga called with single value that is not not a saga effect');
|
|
80
86
|
}
|
|
81
87
|
};
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
var sagaMiddleware = (0, _reduxSaga["default"])();
|
|
89
|
+
exports.sagaMiddleware = sagaMiddleware;
|
|
84
90
|
var generatorFns = {};
|
|
85
91
|
var runningTasks = {};
|
|
86
92
|
var pendingTasks = {};
|
|
93
|
+
|
|
87
94
|
/**
|
|
88
95
|
* Takes either a single argument which should be a saga effect that we can
|
|
89
96
|
* extract from which we can extract the name automatically. Or a pair of
|
|
90
97
|
* arguments, the name and the saga generator function.
|
|
91
98
|
*/
|
|
92
|
-
|
|
93
|
-
export var regSaga = function regSaga(arg0, arg1) {
|
|
99
|
+
var regSaga = function regSaga(arg0, arg1) {
|
|
94
100
|
if (arg1) {
|
|
95
101
|
pendingTasks[arg0] = arg1;
|
|
96
102
|
generatorFns[arg0] = arg1;
|
|
97
103
|
} else {
|
|
98
104
|
var _parseSagaEffect = parseSagaEffect(arg0),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
105
|
+
name = _parseSagaEffect.name,
|
|
106
|
+
genFn = _parseSagaEffect.genFn;
|
|
107
|
+
pendingTasks[name] = /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee6() {
|
|
108
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee6$(_context6) {
|
|
104
109
|
while (1) {
|
|
105
110
|
switch (_context6.prev = _context6.next) {
|
|
106
111
|
case 0:
|
|
107
112
|
_context6.next = 2;
|
|
108
113
|
return arg0;
|
|
109
|
-
|
|
110
114
|
case 2:
|
|
111
115
|
case "end":
|
|
112
116
|
return _context6.stop();
|
|
@@ -117,24 +121,24 @@ export var regSaga = function regSaga(arg0, arg1) {
|
|
|
117
121
|
generatorFns[name] = genFn;
|
|
118
122
|
}
|
|
119
123
|
};
|
|
120
|
-
|
|
124
|
+
exports.regSaga = regSaga;
|
|
125
|
+
var commitSagas = function commitSagas() {
|
|
121
126
|
Object.entries(pendingTasks).forEach(function (_ref) {
|
|
122
|
-
var _ref2 =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
128
|
+
name = _ref2[0],
|
|
129
|
+
saga = _ref2[1];
|
|
126
130
|
if (runningTasks[name] && runningTasks[name].isRunning()) {
|
|
127
131
|
runningTasks[name].cancel();
|
|
128
132
|
}
|
|
129
|
-
|
|
130
133
|
runningTasks[name] = sagaMiddleware.run(saga);
|
|
131
134
|
delete pendingTasks[name];
|
|
132
135
|
});
|
|
133
136
|
};
|
|
134
|
-
|
|
137
|
+
exports.commitSagas = commitSagas;
|
|
138
|
+
var runSaga = function runSaga(name) {
|
|
135
139
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
136
140
|
args[_key - 1] = arguments[_key];
|
|
137
141
|
}
|
|
138
|
-
|
|
139
142
|
return generatorFns[name].apply(generatorFns, args);
|
|
140
|
-
};
|
|
143
|
+
};
|
|
144
|
+
exports.runSaga = runSaga;
|