@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
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import { bundle } from '../../helpers';
|
|
5
|
-
import { List } from 'immutable';
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
* The default number of messages retrieved per page.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export var DEFAULT_MESSAGE_LIMIT = 25;
|
|
12
|
-
/**
|
|
13
|
-
* @private
|
|
14
|
-
* The default number of discussions retrieved per page.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export var DEFAULT_DISCUSSION_LIMIT = 10;
|
|
18
|
-
|
|
19
|
-
var isExistingAttachment = function isExistingAttachment(attachment) {
|
|
20
|
-
return attachment.type === 'attachment';
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var baseUrl = function baseUrl() {
|
|
24
|
-
return "".concat(bundle.spaceLocation(), "/app/discussions");
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Send a message to a discussion.
|
|
28
|
-
*
|
|
29
|
-
* @param {object} params message parameters
|
|
30
|
-
* @param {string} params.id the discussion id to send the message to.
|
|
31
|
-
* @param {string} params.message message text to send.
|
|
32
|
-
* @param {string} params.parentId the id of the parent message.
|
|
33
|
-
* @param {array} params.attachment an array of File objects to attach.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export var sendMessage = function sendMessage(params) {
|
|
38
|
-
var message = _objectSpread({
|
|
39
|
-
content: [{
|
|
40
|
-
type: 'text',
|
|
41
|
-
value: params.message
|
|
42
|
-
}]
|
|
43
|
-
}, params.parentId ? {
|
|
44
|
-
parent: {
|
|
45
|
-
id: params.parentId
|
|
46
|
-
}
|
|
47
|
-
} : {});
|
|
48
|
-
|
|
49
|
-
if (params.attachment) {
|
|
50
|
-
var formData = new FormData();
|
|
51
|
-
formData.append('message', JSON.stringify(message));
|
|
52
|
-
params.attachment.forEach(function (attachment) {
|
|
53
|
-
formData.append('attachments', attachment);
|
|
54
|
-
});
|
|
55
|
-
axios.request({
|
|
56
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(params.id, "/messages"),
|
|
57
|
-
method: 'post',
|
|
58
|
-
headers: {
|
|
59
|
-
'Content-Type': 'multipart/form-data'
|
|
60
|
-
},
|
|
61
|
-
data: formData
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
return axios.request({
|
|
65
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(params.id, "/messages"),
|
|
66
|
-
method: 'post',
|
|
67
|
-
data: message
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
export var updateMessage = function updateMessage(params) {
|
|
72
|
-
var attachments = params.attachment || [];
|
|
73
|
-
var message = {
|
|
74
|
-
content: [{
|
|
75
|
-
type: 'text',
|
|
76
|
-
value: params.message
|
|
77
|
-
}].concat(_toConsumableArray(attachments.filter(isExistingAttachment)))
|
|
78
|
-
};
|
|
79
|
-
var newAttachments = attachments.filter(function (a) {
|
|
80
|
-
return !isExistingAttachment(a);
|
|
81
|
-
});
|
|
82
|
-
var formData = new FormData();
|
|
83
|
-
formData.append('message', JSON.stringify(message));
|
|
84
|
-
newAttachments.forEach(function (attachment) {
|
|
85
|
-
formData.append('attachments', attachment);
|
|
86
|
-
});
|
|
87
|
-
axios.request({
|
|
88
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(params.discussionId, "/messages/").concat(params.id),
|
|
89
|
-
method: 'post',
|
|
90
|
-
headers: {
|
|
91
|
-
'Content-Type': 'multipart/form-data'
|
|
92
|
-
},
|
|
93
|
-
data: formData
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
export var fetchMessages = function fetchMessages(id, pageToken) {
|
|
97
|
-
return axios.request({
|
|
98
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id, "/messages"),
|
|
99
|
-
method: 'get',
|
|
100
|
-
params: {
|
|
101
|
-
pageToken: pageToken,
|
|
102
|
-
limit: DEFAULT_MESSAGE_LIMIT
|
|
103
|
-
}
|
|
104
|
-
}).then(function (response) {
|
|
105
|
-
return response.data;
|
|
106
|
-
})["catch"](function (response) {
|
|
107
|
-
return {
|
|
108
|
-
error: response
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
export var fetchMessage = function fetchMessage(_ref) {
|
|
113
|
-
var discussionId = _ref.discussionId,
|
|
114
|
-
id = _ref.id;
|
|
115
|
-
return axios.request({
|
|
116
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(discussionId, "/messages/").concat(id),
|
|
117
|
-
method: 'get'
|
|
118
|
-
}).then(function (response) {
|
|
119
|
-
return response.data;
|
|
120
|
-
})["catch"](function (response) {
|
|
121
|
-
return {
|
|
122
|
-
error: response
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
export var fetchMessageHistory = function fetchMessageHistory(_ref2) {
|
|
127
|
-
var discussionId = _ref2.discussionId,
|
|
128
|
-
id = _ref2.id;
|
|
129
|
-
return axios.request({
|
|
130
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(discussionId, "/messages/").concat(id, "/versions"),
|
|
131
|
-
method: 'get'
|
|
132
|
-
}).then(function (response) {
|
|
133
|
-
return response.data;
|
|
134
|
-
})["catch"](function (response) {
|
|
135
|
-
return {
|
|
136
|
-
error: response
|
|
137
|
-
};
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Fetch a discussion by `id`.
|
|
142
|
-
* @param {object} params fetch parameters
|
|
143
|
-
* @param {string} params.id the discussion id
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
export var fetchDiscussion = function fetchDiscussion(_ref3) {
|
|
147
|
-
var id = _ref3.id;
|
|
148
|
-
return axios.request({
|
|
149
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id),
|
|
150
|
-
method: 'get'
|
|
151
|
-
}).then(function (response) {
|
|
152
|
-
return response.data;
|
|
153
|
-
})["catch"](function (response) {
|
|
154
|
-
return {
|
|
155
|
-
error: response
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Fetch discussions based upon parameters.
|
|
161
|
-
*
|
|
162
|
-
* @param {object} params fetch parameters
|
|
163
|
-
* @param {string} params.pageToken next page token for paginated results
|
|
164
|
-
* @param {object} params.relatedItem search for discussions based upon related item
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
export var fetchDiscussions = function fetchDiscussions(_ref4) {
|
|
168
|
-
var pageToken = _ref4.pageToken,
|
|
169
|
-
title = _ref4.title,
|
|
170
|
-
_ref4$relatedItem = _ref4.relatedItem,
|
|
171
|
-
relatedItem = _ref4$relatedItem === void 0 ? {} : _ref4$relatedItem,
|
|
172
|
-
isArchived = _ref4.isArchived,
|
|
173
|
-
limit = _ref4.limit,
|
|
174
|
-
start = _ref4.start,
|
|
175
|
-
end = _ref4.end;
|
|
176
|
-
var type = relatedItem.type,
|
|
177
|
-
key = relatedItem.key;
|
|
178
|
-
return axios.get("".concat(baseUrl(), "/api/v1/discussions"), {
|
|
179
|
-
params: {
|
|
180
|
-
title: title && title.length > 0 ? title : null,
|
|
181
|
-
limit: limit || DEFAULT_DISCUSSION_LIMIT,
|
|
182
|
-
type: type,
|
|
183
|
-
key: key,
|
|
184
|
-
pageToken: pageToken,
|
|
185
|
-
archived: isArchived ? true : undefined,
|
|
186
|
-
start: start,
|
|
187
|
-
end: end
|
|
188
|
-
}
|
|
189
|
-
}).then(function (response) {
|
|
190
|
-
return response.data;
|
|
191
|
-
})["catch"](function (response) {
|
|
192
|
-
return {
|
|
193
|
-
error: response
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
export var createDiscussion = function createDiscussion(_ref5) {
|
|
198
|
-
var title = _ref5.title,
|
|
199
|
-
description = _ref5.description,
|
|
200
|
-
_ref5$isPrivate = _ref5.isPrivate,
|
|
201
|
-
isPrivate = _ref5$isPrivate === void 0 ? false : _ref5$isPrivate,
|
|
202
|
-
owningUsers = _ref5.owningUsers,
|
|
203
|
-
owningTeams = _ref5.owningTeams,
|
|
204
|
-
joinPolicy = _ref5.joinPolicy;
|
|
205
|
-
return axios.request({
|
|
206
|
-
method: 'post',
|
|
207
|
-
url: "".concat(baseUrl(), "/api/v1/discussions"),
|
|
208
|
-
data: {
|
|
209
|
-
title: title,
|
|
210
|
-
description: description,
|
|
211
|
-
isArchived: false,
|
|
212
|
-
owningUsers: owningUsers,
|
|
213
|
-
owningTeams: owningTeams,
|
|
214
|
-
isPrivate: isPrivate,
|
|
215
|
-
joinPolicy: joinPolicy
|
|
216
|
-
}
|
|
217
|
-
}).then(function (response) {
|
|
218
|
-
return response.data;
|
|
219
|
-
})["catch"](function (response) {
|
|
220
|
-
return {
|
|
221
|
-
error: response
|
|
222
|
-
};
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
export var updateDiscussion = function updateDiscussion(id, data) {
|
|
226
|
-
return axios.request({
|
|
227
|
-
method: 'put',
|
|
228
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id),
|
|
229
|
-
data: data
|
|
230
|
-
}).then(function (response) {
|
|
231
|
-
return response.data;
|
|
232
|
-
})["catch"](function (response) {
|
|
233
|
-
return {
|
|
234
|
-
error: response
|
|
235
|
-
};
|
|
236
|
-
});
|
|
237
|
-
};
|
|
238
|
-
export var fetchInvites = function fetchInvites(id) {
|
|
239
|
-
return axios.request({
|
|
240
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id, "/invitations"),
|
|
241
|
-
method: 'get'
|
|
242
|
-
}).then(function (response) {
|
|
243
|
-
return response.data;
|
|
244
|
-
})["catch"](function (response) {
|
|
245
|
-
return {
|
|
246
|
-
error: response
|
|
247
|
-
};
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
export var createInvite = function createInvite(_ref6) {
|
|
251
|
-
var discussionId = _ref6.discussionId,
|
|
252
|
-
type = _ref6.type,
|
|
253
|
-
value = _ref6.value,
|
|
254
|
-
message = _ref6.message;
|
|
255
|
-
return axios.request({
|
|
256
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(discussionId, "/invitations"),
|
|
257
|
-
method: 'post',
|
|
258
|
-
data: type === 'email' ? {
|
|
259
|
-
email: value,
|
|
260
|
-
message: message
|
|
261
|
-
} : {
|
|
262
|
-
user: {
|
|
263
|
-
username: value
|
|
264
|
-
},
|
|
265
|
-
message: message
|
|
266
|
-
}
|
|
267
|
-
}).then(function (response) {
|
|
268
|
-
return response.data;
|
|
269
|
-
})["catch"](function (response) {
|
|
270
|
-
return {
|
|
271
|
-
error: response
|
|
272
|
-
};
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
export var resendInvite = function resendInvite(_ref7) {
|
|
276
|
-
var discussionId = _ref7.discussionId,
|
|
277
|
-
email = _ref7.email,
|
|
278
|
-
username = _ref7.username;
|
|
279
|
-
return axios.request({
|
|
280
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(discussionId, "/invitations/").concat(email || username),
|
|
281
|
-
method: 'put',
|
|
282
|
-
params: _objectSpread({}, email ? {
|
|
283
|
-
email: ''
|
|
284
|
-
} : {}),
|
|
285
|
-
data: {}
|
|
286
|
-
}).then(function (response) {
|
|
287
|
-
return response.data;
|
|
288
|
-
})["catch"](function (response) {
|
|
289
|
-
return {
|
|
290
|
-
error: response
|
|
291
|
-
};
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
export var removeInvite = function removeInvite(_ref8) {
|
|
295
|
-
var discussionId = _ref8.discussionId,
|
|
296
|
-
email = _ref8.email,
|
|
297
|
-
username = _ref8.username;
|
|
298
|
-
return axios.request({
|
|
299
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(discussionId, "/invitations/").concat(email || username),
|
|
300
|
-
method: 'delete',
|
|
301
|
-
params: _objectSpread({}, email ? {
|
|
302
|
-
email: ''
|
|
303
|
-
} : {})
|
|
304
|
-
}).then(function (response) {
|
|
305
|
-
return response.data;
|
|
306
|
-
})["catch"](function (response) {
|
|
307
|
-
return {
|
|
308
|
-
error: response
|
|
309
|
-
};
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
export var fetchParticipants = function fetchParticipants(id) {
|
|
313
|
-
return axios.request({
|
|
314
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id, "/participants"),
|
|
315
|
-
method: 'get'
|
|
316
|
-
}).then(function (response) {
|
|
317
|
-
return response.data;
|
|
318
|
-
})["catch"](function (response) {
|
|
319
|
-
return {
|
|
320
|
-
error: response
|
|
321
|
-
};
|
|
322
|
-
});
|
|
323
|
-
};
|
|
324
|
-
export var removeParticipant = function removeParticipant(id, username) {
|
|
325
|
-
return axios.request({
|
|
326
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id, "/participants/").concat(username),
|
|
327
|
-
method: 'delete'
|
|
328
|
-
}).then(function (response) {
|
|
329
|
-
return response.data;
|
|
330
|
-
})["catch"](function (response) {
|
|
331
|
-
return {
|
|
332
|
-
error: response
|
|
333
|
-
};
|
|
334
|
-
});
|
|
335
|
-
};
|
|
336
|
-
export var updateParticipant = function updateParticipant(id, username, data) {
|
|
337
|
-
return axios.request({
|
|
338
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id, "/participants/").concat(username),
|
|
339
|
-
method: 'put',
|
|
340
|
-
data: data
|
|
341
|
-
}).then(function (response) {
|
|
342
|
-
return response.data;
|
|
343
|
-
})["catch"](function (response) {
|
|
344
|
-
return {
|
|
345
|
-
error: response
|
|
346
|
-
};
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
|
-
export var createRelatedItem = function createRelatedItem(id, relatedItem) {
|
|
350
|
-
return axios.request({
|
|
351
|
-
url: "".concat(baseUrl(), "/api/v1/discussions/").concat(id, "/relatedItems"),
|
|
352
|
-
method: 'post',
|
|
353
|
-
data: relatedItem
|
|
354
|
-
}).then(function (response) {
|
|
355
|
-
return response.data;
|
|
356
|
-
})["catch"](function (response) {
|
|
357
|
-
return {
|
|
358
|
-
error: response
|
|
359
|
-
};
|
|
360
|
-
});
|
|
361
|
-
};
|
|
362
|
-
export var sendInvites = function sendInvites(discussion, values) {
|
|
363
|
-
var participants = discussion.participants || List();
|
|
364
|
-
var invitations = discussion.invitations || List();
|
|
365
|
-
var existingUsernames = participants.concat(invitations).filter(function (involvement) {
|
|
366
|
-
return involvement.user;
|
|
367
|
-
}).map(function (involvement) {
|
|
368
|
-
return involvement.user.username;
|
|
369
|
-
});
|
|
370
|
-
var existingEmails = invitations.map(function (invitation) {
|
|
371
|
-
return invitation.email;
|
|
372
|
-
});
|
|
373
|
-
return Promise.all(values.get('invitees').map(function (item) {
|
|
374
|
-
return {
|
|
375
|
-
discussionId: discussion.id,
|
|
376
|
-
type: item.get('username') ? 'username' : 'email',
|
|
377
|
-
value: item.get('username') ? item.get('username') : item.get('email'),
|
|
378
|
-
message: values.get('message')
|
|
379
|
-
};
|
|
380
|
-
}).filter(function (args) {
|
|
381
|
-
return args.type === 'username' ? !existingUsernames.contains(args.value) : !existingEmails.contains(args.value);
|
|
382
|
-
}).map(createInvite));
|
|
383
|
-
};
|
|
384
|
-
export var fetchDiscussionsVersion = function fetchDiscussionsVersion() {
|
|
385
|
-
return axios.request({
|
|
386
|
-
url: "".concat(baseUrl(), "/api/v1/version"),
|
|
387
|
-
method: 'get'
|
|
388
|
-
}).then(function (response) {
|
|
389
|
-
return response.data;
|
|
390
|
-
})["catch"](function (response) {
|
|
391
|
-
return {
|
|
392
|
-
error: response
|
|
393
|
-
};
|
|
394
|
-
});
|
|
395
|
-
};
|
package/lib/apis/socket/index.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
-
import { call, takeEvery } from 'redux-saga/effects';
|
|
3
|
-
import { Socket, SOCKET_STATUS } from './socket';
|
|
4
|
-
import { dispatch, dispatcher, regHandlers } from '../../store';
|
|
5
|
-
import { bundle } from '../../helpers';
|
|
6
|
-
import { regSaga } from '../../saga';
|
|
7
|
-
import { authInterceptor } from '../../index';
|
|
8
|
-
regHandlers({
|
|
9
|
-
SET_SOCKET_STATUS: function SET_SOCKET_STATUS(state, action) {
|
|
10
|
-
return state.set('socketStatus', action.payload);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
dispatch('SET_SOCKET_STATUS', SOCKET_STATUS.CLOSED);
|
|
14
|
-
|
|
15
|
-
var createWsUri = function createWsUri() {
|
|
16
|
-
if (process.env.REACT_APP_API_HOST) {
|
|
17
|
-
// if there is an api host env variable (dev mode) then we can replace the
|
|
18
|
-
// 'http' in that string with 'ws' to build the path
|
|
19
|
-
return "".concat(process.env.REACT_APP_API_HOST.replace('http', 'ws'), "/app/topics/socket");
|
|
20
|
-
} else {
|
|
21
|
-
// otherwise (prod mode) we usually use paths that are root relative, but
|
|
22
|
-
// the websocket path needs to include the protocol, so we determine whether
|
|
23
|
-
// or not the current page is using https and get the host from the current
|
|
24
|
-
// page to build the appropriate websocket uri
|
|
25
|
-
var protocol = window.location.protocol !== 'http:' ? 'wss' : 'ws';
|
|
26
|
-
var host = window.location.host;
|
|
27
|
-
var path = "".concat(bundle.spaceLocation(), "/app/topics/socket");
|
|
28
|
-
return "".concat(protocol, "://").concat(host).concat(path);
|
|
29
|
-
}
|
|
30
|
-
}; // This handles situations where the socket goes to 'unidenfitied' which means
|
|
31
|
-
// the token we're using to reconnect is no longer valid.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
regSaga(takeEvery('SET_SOCKET_STATUS', /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
35
|
-
var payload;
|
|
36
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
37
|
-
while (1) {
|
|
38
|
-
switch (_context.prev = _context.next) {
|
|
39
|
-
case 0:
|
|
40
|
-
payload = _ref.payload;
|
|
41
|
-
|
|
42
|
-
if (!(payload === SOCKET_STATUS.UNIDENTIFIED)) {
|
|
43
|
-
_context.next = 10;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
_context.prev = 2;
|
|
48
|
-
_context.next = 5;
|
|
49
|
-
return call(authInterceptor.authenticate);
|
|
50
|
-
|
|
51
|
-
case 5:
|
|
52
|
-
_context.next = 10;
|
|
53
|
-
break;
|
|
54
|
-
|
|
55
|
-
case 7:
|
|
56
|
-
_context.prev = 7;
|
|
57
|
-
_context.t0 = _context["catch"](2);
|
|
58
|
-
console.warn('There was a problem attempting to authenticate and reconnect.', _context.t0);
|
|
59
|
-
|
|
60
|
-
case 10:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee, null, [[2, 7]]);
|
|
66
|
-
})));
|
|
67
|
-
export var socket = new Socket().on('status', dispatcher('SET_SOCKET_STATUS'));
|
|
68
|
-
export var socketIdentify = function socketIdentify(token) {
|
|
69
|
-
return new Promise(function (resolve) {
|
|
70
|
-
socket.on('status', function (status) {
|
|
71
|
-
if (status === SOCKET_STATUS.IDENTIFIED) {
|
|
72
|
-
resolve();
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
socket.connect(token, createWsUri());
|
|
76
|
-
});
|
|
77
|
-
};
|