@kineticdata/react 5.1.2 → 6.0.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/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 +121 -80
- package/lib/apis/http.test.js +137 -38
- package/lib/apis/index.js +506 -50
- package/lib/apis/system/index.js +363 -215
- package/lib/apis/task/index.js +294 -227
- package/lib/components/agent/bridge/BridgeForm.js +50 -50
- package/lib/components/agent/bridge/BridgeTable.js +16 -9
- package/lib/components/agent/filestore/FilestoreForm.js +49 -48
- package/lib/components/agent/filestore/FilestoreTable.js +16 -9
- package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
- package/lib/components/agent/handler/AgentHandlerTable.js +17 -10
- 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/ToastContainer.js +170 -0
- 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/common/defaults/Toast.js +26 -0
- package/lib/components/common/defaults/index.js +13 -0
- 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 +25 -18
- package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
- package/lib/components/core/bridge_model/BridgeModelTable.js +17 -10
- 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 +28 -16
- 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 +26 -15
- 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 +47 -33
- package/lib/components/core/form_type/FormTypeForm.js +14 -13
- package/lib/components/core/form_type/FormTypeTable.js +15 -9
- 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 +31 -16
- 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 +34 -44
- package/lib/components/core/log/LogTable.js +42 -34
- 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 +27 -17
- 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 +64 -39
- package/lib/components/core/submission/KappSubmissionTable.js +67 -48
- 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 +27 -16
- 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 +42 -20
- package/lib/components/core/webapi/WebApiForm.js +87 -80
- package/lib/components/core/webapi/WebApiTable.js +28 -17
- package/lib/components/core/webhook/WebhookForm.js +33 -32
- package/lib/components/core/webhook/WebhookTable.js +41 -29
- package/lib/components/core/webhook_job/WebhookJobTable.js +58 -35
- package/lib/components/form/Form.helpers.js +182 -108
- package/lib/components/form/Form.js +467 -524
- package/lib/components/form/Form.models.js +39 -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 +1034 -135
- package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
- package/lib/components/system/SystemCassandraForm.js +98 -0
- package/lib/components/system/SystemElasticSearchForm.js +98 -0
- package/lib/components/system/SystemFilestoreForm.js +36 -28
- package/lib/components/system/SystemForm.js +19 -16
- package/lib/components/system/SystemIngressForm.js +85 -36
- package/lib/components/system/SystemSecurityForm.js +17 -14
- package/lib/components/system/SystemSmtpForm.js +13 -13
- package/lib/components/system/SystemTaskAdapterForm.js +49 -21
- package/lib/components/system/SystemTrustedCertificateForm.js +40 -0
- package/lib/components/system/SystemTrustedCertificatesTable.js +74 -0
- package/lib/components/system/SystemUserForm.js +15 -14
- package/lib/components/system/helpers.js +281 -98
- 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 +112 -68
- package/lib/components/system/spaces/SystemTenantTable.js +12 -8
- package/lib/components/table/Table.js +295 -227
- package/lib/components/table/Table.redux.js +339 -355
- package/lib/components/table/Table.redux.test.js +49 -47
- package/lib/components/table/Table.test.js +146 -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/ColumnControl.js +26 -0
- 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 +43 -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 +50 -27
- 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 +35 -19
- 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 +45 -29
- 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 +29 -18
- package/lib/components/task/triggers/TriggerTable.js +71 -41
- package/lib/components/task/workflows/LinkedWorkflowForm.js +48 -54
- package/lib/components/task/workflows/LinkedWorkflowTable.js +46 -26
- 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 +47 -29
- 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 +87 -38
- package/lib/reducer.js +11 -3
- package/lib/saga.js +42 -38
- package/lib/store.js +59 -35
- package/package.json +17 -29
- package/proxyhelper.js +122 -57
- 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/apis/core/kapps.js
CHANGED
|
@@ -1,88 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.updateKapp = exports.fetchKapps = exports.fetchKapp = exports.deleteKapp = exports.createKapp = void 0;
|
|
8
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
+
var _helpers = require("../../helpers");
|
|
10
|
+
var _http = require("../http");
|
|
11
|
+
var fetchKapps = function fetchKapps() {
|
|
5
12
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
13
|
// Build URL and fetch the space.
|
|
7
|
-
return
|
|
8
|
-
params: paramBuilder(options),
|
|
9
|
-
headers: headerBuilder(options)
|
|
14
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/kapps"), {
|
|
15
|
+
params: (0, _http.paramBuilder)(options),
|
|
16
|
+
headers: (0, _http.headerBuilder)(options)
|
|
10
17
|
}).then(function (response) {
|
|
11
18
|
return {
|
|
12
19
|
kapps: response.data.kapps,
|
|
13
20
|
count: response.data.count,
|
|
14
21
|
nextPageToken: response.data.nextPageToken
|
|
15
22
|
};
|
|
16
|
-
})["catch"](handleErrors);
|
|
23
|
+
})["catch"](_http.handleErrors);
|
|
17
24
|
};
|
|
18
|
-
|
|
25
|
+
exports.fetchKapps = fetchKapps;
|
|
26
|
+
var fetchKapp = function fetchKapp() {
|
|
19
27
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
28
|
var _options$kappSlug = options.kappSlug,
|
|
21
|
-
|
|
29
|
+
kappSlug = _options$kappSlug === void 0 ? _helpers.bundle.kappSlug() : _options$kappSlug;
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
// Build URL and fetch the space.
|
|
32
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/kapps/").concat(kappSlug), {
|
|
33
|
+
params: (0, _http.paramBuilder)(options),
|
|
34
|
+
headers: (0, _http.headerBuilder)(options)
|
|
26
35
|
}).then(function (response) {
|
|
27
36
|
return {
|
|
28
37
|
kapp: response.data.kapp
|
|
29
38
|
};
|
|
30
|
-
})["catch"](handleErrors);
|
|
39
|
+
})["catch"](_http.handleErrors);
|
|
31
40
|
};
|
|
32
|
-
|
|
41
|
+
exports.fetchKapp = fetchKapp;
|
|
42
|
+
var updateKapp = function updateKapp() {
|
|
33
43
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34
44
|
var _options$kappSlug2 = options.kappSlug,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
kappSlug = _options$kappSlug2 === void 0 ? _helpers.bundle.kappSlug() : _options$kappSlug2,
|
|
46
|
+
kapp = options.kapp;
|
|
38
47
|
if (!kappSlug) {
|
|
39
48
|
throw new Error('updateKapp failed! The option "kappSlug" is required.');
|
|
40
49
|
}
|
|
41
|
-
|
|
42
50
|
if (!kapp) {
|
|
43
51
|
throw new Error('updateKapp failed! The option "kapp" is required.');
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
headers: headerBuilder(options)
|
|
53
|
+
return _axios["default"].put("".concat(_helpers.bundle.apiLocation(), "/kapps/").concat(kappSlug), kapp, {
|
|
54
|
+
params: (0, _http.paramBuilder)(options),
|
|
55
|
+
headers: (0, _http.headerBuilder)(options)
|
|
49
56
|
}).then(function (response) {
|
|
50
57
|
return {
|
|
51
58
|
kapp: response.data.kapp
|
|
52
59
|
};
|
|
53
|
-
})["catch"](handleErrors);
|
|
60
|
+
})["catch"](_http.handleErrors);
|
|
54
61
|
};
|
|
55
|
-
|
|
62
|
+
exports.updateKapp = updateKapp;
|
|
63
|
+
var createKapp = function createKapp() {
|
|
56
64
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
65
|
var kapp = options.kapp;
|
|
58
|
-
|
|
59
66
|
if (!kapp) {
|
|
60
67
|
throw new Error('createKapp failed! The option "kapp" is required.');
|
|
61
68
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
headers: headerBuilder(options)
|
|
69
|
+
return _axios["default"].post("".concat(_helpers.bundle.apiLocation(), "/kapps"), kapp, {
|
|
70
|
+
params: (0, _http.paramBuilder)(options),
|
|
71
|
+
headers: (0, _http.headerBuilder)(options)
|
|
66
72
|
}).then(function (response) {
|
|
67
73
|
return {
|
|
68
74
|
kapp: response.data.kapp
|
|
69
75
|
};
|
|
70
|
-
})["catch"](handleErrors);
|
|
76
|
+
})["catch"](_http.handleErrors);
|
|
71
77
|
};
|
|
72
|
-
|
|
78
|
+
exports.createKapp = createKapp;
|
|
79
|
+
var deleteKapp = function deleteKapp() {
|
|
73
80
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
74
81
|
var kappSlug = options.kappSlug;
|
|
75
|
-
|
|
76
82
|
if (!kappSlug) {
|
|
77
83
|
throw new Error('deleteKapp failed! The option "kappSlug" is required.');
|
|
78
84
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
headers: headerBuilder(options)
|
|
85
|
+
return _axios["default"]["delete"]("".concat(_helpers.bundle.apiLocation(), "/kapps/").concat(kappSlug), {
|
|
86
|
+
params: (0, _http.paramBuilder)(options),
|
|
87
|
+
headers: (0, _http.headerBuilder)(options)
|
|
83
88
|
}).then(function (response) {
|
|
84
89
|
return {
|
|
85
90
|
kapp: response.data.kapp
|
|
86
91
|
};
|
|
87
|
-
})["catch"](handleErrors);
|
|
88
|
-
};
|
|
92
|
+
})["catch"](_http.handleErrors);
|
|
93
|
+
};
|
|
94
|
+
exports.deleteKapp = deleteKapp;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import axios from 'axios';
|
|
4
|
-
import createError from 'axios/lib/core/createError';
|
|
5
|
-
import { fetchKapp, fetchKapps, updateKapp } from './kapps';
|
|
6
|
-
import { KappBuilder } from '../../../tests/utils/kapp_builder';
|
|
7
|
-
import { rejectPromiseWith, resolvePromiseWith } from '../../../tests/utils/promises';
|
|
8
|
-
jest.mock('axios'); // Mock out the bundle object from a dependency.
|
|
1
|
+
"use strict";
|
|
9
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/regeneratorRuntime"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
6
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
7
|
+
var _createError = _interopRequireDefault(require("axios/lib/core/createError"));
|
|
8
|
+
var _kapps = require("./kapps");
|
|
9
|
+
var _kapp_builder = require("../../../tests/utils/kapp_builder");
|
|
10
|
+
var _promises = require("../../../tests/utils/promises");
|
|
11
|
+
jest.mock('axios');
|
|
12
|
+
|
|
13
|
+
// Mock out the bundle object from a dependency.
|
|
10
14
|
jest.mock('../../helpers', function () {
|
|
11
15
|
return {
|
|
12
16
|
bundle: {
|
|
@@ -31,20 +35,20 @@ describe('kapps api', function () {
|
|
|
31
35
|
kapps: []
|
|
32
36
|
}
|
|
33
37
|
};
|
|
34
|
-
testKapp = new KappBuilder().stub().withAttribute('Attribute', 'value').build();
|
|
38
|
+
testKapp = new _kapp_builder.KappBuilder().stub().withAttribute('Attribute', 'value').build();
|
|
35
39
|
response.data.kapps.push(testKapp);
|
|
36
|
-
|
|
40
|
+
_axios["default"].get = (0, _promises.resolvePromiseWith)(response);
|
|
37
41
|
});
|
|
38
42
|
test('does not return errors', function () {
|
|
39
43
|
expect.assertions(1);
|
|
40
|
-
return fetchKapps().then(function (_ref) {
|
|
44
|
+
return (0, _kapps.fetchKapps)().then(function (_ref) {
|
|
41
45
|
var serverError = _ref.serverError;
|
|
42
46
|
expect(serverError).toBeUndefined();
|
|
43
47
|
});
|
|
44
48
|
});
|
|
45
49
|
test('returns an array of kapps', function () {
|
|
46
50
|
expect.assertions(2);
|
|
47
|
-
return fetchKapps().then(function (_ref2) {
|
|
51
|
+
return (0, _kapps.fetchKapps)().then(function (_ref2) {
|
|
48
52
|
var kapps = _ref2.kapps;
|
|
49
53
|
expect(kapps).toBeInstanceOf(Array);
|
|
50
54
|
expect(kapps[0]).toMatchObject({
|
|
@@ -55,7 +59,7 @@ describe('kapps api', function () {
|
|
|
55
59
|
});
|
|
56
60
|
test('returns attributes', function () {
|
|
57
61
|
expect.assertions(2);
|
|
58
|
-
return fetchKapps({
|
|
62
|
+
return (0, _kapps.fetchKapps)({
|
|
59
63
|
xlatAttributes: true
|
|
60
64
|
}).then(function (_ref3) {
|
|
61
65
|
var kapps = _ref3.kapps;
|
|
@@ -76,20 +80,20 @@ describe('kapps api', function () {
|
|
|
76
80
|
kapp: {}
|
|
77
81
|
}
|
|
78
82
|
};
|
|
79
|
-
testKapp = new KappBuilder().stub().withAttribute('Attribute', 'value').build();
|
|
83
|
+
testKapp = new _kapp_builder.KappBuilder().stub().withAttribute('Attribute', 'value').build();
|
|
80
84
|
response.data.kapp = testKapp;
|
|
81
|
-
|
|
85
|
+
_axios["default"].get = (0, _promises.resolvePromiseWith)(response);
|
|
82
86
|
});
|
|
83
87
|
test('does not return errors', function () {
|
|
84
88
|
expect.assertions(1);
|
|
85
|
-
return fetchKapp().then(function (_ref4) {
|
|
89
|
+
return (0, _kapps.fetchKapp)().then(function (_ref4) {
|
|
86
90
|
var errors = _ref4.errors;
|
|
87
91
|
expect(errors).toBeUndefined();
|
|
88
92
|
});
|
|
89
93
|
});
|
|
90
94
|
test('returns a kapp', function () {
|
|
91
95
|
expect.assertions(1);
|
|
92
|
-
return fetchKapp().then(function (_ref5) {
|
|
96
|
+
return (0, _kapps.fetchKapp)().then(function (_ref5) {
|
|
93
97
|
var kapp = _ref5.kapp;
|
|
94
98
|
expect(kapp).toMatchObject({
|
|
95
99
|
name: testKapp.name,
|
|
@@ -99,7 +103,7 @@ describe('kapps api', function () {
|
|
|
99
103
|
});
|
|
100
104
|
test('returns attributes', function () {
|
|
101
105
|
expect.assertions(2);
|
|
102
|
-
return fetchKapp({
|
|
106
|
+
return (0, _kapps.fetchKapp)({
|
|
103
107
|
xlatAttributes: true
|
|
104
108
|
}).then(function (_ref6) {
|
|
105
109
|
var kapp = _ref6.kapp;
|
|
@@ -115,13 +119,13 @@ describe('kapps api', function () {
|
|
|
115
119
|
status: 500,
|
|
116
120
|
data: {}
|
|
117
121
|
};
|
|
118
|
-
|
|
122
|
+
_axios["default"].get = (0, _promises.rejectPromiseWith)({
|
|
119
123
|
response: response
|
|
120
124
|
});
|
|
121
125
|
});
|
|
122
126
|
test('does return errors', function () {
|
|
123
127
|
expect.assertions(1);
|
|
124
|
-
return fetchKapp({
|
|
128
|
+
return (0, _kapps.fetchKapp)({
|
|
125
129
|
includes: 'attributes',
|
|
126
130
|
xlatAttributes: true
|
|
127
131
|
}).then(function (_ref7) {
|
|
@@ -133,16 +137,15 @@ describe('kapps api', function () {
|
|
|
133
137
|
});
|
|
134
138
|
describe('updateKapp', function () {
|
|
135
139
|
beforeEach(function () {
|
|
136
|
-
|
|
140
|
+
_axios["default"].put.mockReset();
|
|
137
141
|
});
|
|
138
|
-
test('success', /*#__PURE__*/
|
|
142
|
+
test('success', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
|
|
139
143
|
var _yield$updateKapp, kapp, error;
|
|
140
|
-
|
|
141
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
144
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
|
|
142
145
|
while (1) {
|
|
143
146
|
switch (_context.prev = _context.next) {
|
|
144
147
|
case 0:
|
|
145
|
-
|
|
148
|
+
_axios["default"].put.mockResolvedValue({
|
|
146
149
|
status: 200,
|
|
147
150
|
data: {
|
|
148
151
|
kapp: {
|
|
@@ -155,7 +158,7 @@ describe('kapps api', function () {
|
|
|
155
158
|
}
|
|
156
159
|
});
|
|
157
160
|
_context.next = 3;
|
|
158
|
-
return updateKapp({
|
|
161
|
+
return (0, _kapps.updateKapp)({
|
|
159
162
|
kappSlug: 'catalog',
|
|
160
163
|
kapp: {
|
|
161
164
|
name: 'Test',
|
|
@@ -166,12 +169,11 @@ describe('kapps api', function () {
|
|
|
166
169
|
},
|
|
167
170
|
include: 'attributes'
|
|
168
171
|
});
|
|
169
|
-
|
|
170
172
|
case 3:
|
|
171
173
|
_yield$updateKapp = _context.sent;
|
|
172
174
|
kapp = _yield$updateKapp.kapp;
|
|
173
175
|
error = _yield$updateKapp.error;
|
|
174
|
-
expect(
|
|
176
|
+
expect(_axios["default"].put.mock.calls).toEqual([['kapp/app/api/v1/kapps/catalog', {
|
|
175
177
|
name: 'Test',
|
|
176
178
|
attributes: [{
|
|
177
179
|
name: 'Company Name',
|
|
@@ -193,7 +195,6 @@ describe('kapps api', function () {
|
|
|
193
195
|
}]
|
|
194
196
|
});
|
|
195
197
|
expect(error).toBeUndefined();
|
|
196
|
-
|
|
197
198
|
case 9:
|
|
198
199
|
case "end":
|
|
199
200
|
return _context.stop();
|
|
@@ -201,24 +202,23 @@ describe('kapps api', function () {
|
|
|
201
202
|
}
|
|
202
203
|
}, _callee);
|
|
203
204
|
})));
|
|
204
|
-
test('defaults to bundle.kappSlug() when no kappSlug provided', /*#__PURE__*/
|
|
205
|
-
return
|
|
205
|
+
test('defaults to bundle.kappSlug() when no kappSlug provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2() {
|
|
206
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
|
|
206
207
|
while (1) {
|
|
207
208
|
switch (_context2.prev = _context2.next) {
|
|
208
209
|
case 0:
|
|
209
|
-
|
|
210
|
+
_axios["default"].put.mockResolvedValue({
|
|
210
211
|
status: 200,
|
|
211
212
|
data: {}
|
|
212
213
|
});
|
|
213
214
|
_context2.next = 3;
|
|
214
|
-
return updateKapp({
|
|
215
|
+
return (0, _kapps.updateKapp)({
|
|
215
216
|
kapp: {
|
|
216
217
|
name: 'Test'
|
|
217
218
|
}
|
|
218
219
|
});
|
|
219
|
-
|
|
220
220
|
case 3:
|
|
221
|
-
expect(
|
|
221
|
+
expect(_axios["default"].put.mock.calls).toEqual([['kapp/app/api/v1/kapps/mock-kapp', {
|
|
222
222
|
name: 'Test'
|
|
223
223
|
}, {
|
|
224
224
|
params: {},
|
|
@@ -226,7 +226,6 @@ describe('kapps api', function () {
|
|
|
226
226
|
'X-Kinetic-AuthAssumed': 'true'
|
|
227
227
|
}
|
|
228
228
|
}]]);
|
|
229
|
-
|
|
230
229
|
case 4:
|
|
231
230
|
case "end":
|
|
232
231
|
return _context2.stop();
|
|
@@ -236,27 +235,26 @@ describe('kapps api', function () {
|
|
|
236
235
|
})));
|
|
237
236
|
test('missing kapp', function () {
|
|
238
237
|
expect(function () {
|
|
239
|
-
updateKapp({});
|
|
238
|
+
(0, _kapps.updateKapp)({});
|
|
240
239
|
}).toThrow('updateKapp failed! The option "kapp" is required.');
|
|
241
240
|
});
|
|
242
241
|
test('missing kappSlug', function () {
|
|
243
242
|
// Note that we need to set it to null becuse by default if kappSlug is
|
|
244
243
|
// not passed (undefined) it checks the 'bundle' helper.
|
|
245
244
|
expect(function () {
|
|
246
|
-
updateKapp({
|
|
245
|
+
(0, _kapps.updateKapp)({
|
|
247
246
|
kapp: {},
|
|
248
247
|
kappSlug: null
|
|
249
248
|
});
|
|
250
249
|
}).toThrow('updateKapp failed! The option "kappSlug" is required.');
|
|
251
250
|
});
|
|
252
|
-
test('bad request', /*#__PURE__*/
|
|
251
|
+
test('bad request', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3() {
|
|
253
252
|
var _yield$updateKapp2, kapp, error;
|
|
254
|
-
|
|
255
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
253
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
|
|
256
254
|
while (1) {
|
|
257
255
|
switch (_context3.prev = _context3.next) {
|
|
258
256
|
case 0:
|
|
259
|
-
|
|
257
|
+
_axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 400', null, 400, null, {
|
|
260
258
|
status: 400,
|
|
261
259
|
statusText: 'Bad Request',
|
|
262
260
|
data: {
|
|
@@ -264,12 +262,11 @@ describe('kapps api', function () {
|
|
|
264
262
|
}
|
|
265
263
|
}));
|
|
266
264
|
_context3.next = 3;
|
|
267
|
-
return updateKapp({
|
|
265
|
+
return (0, _kapps.updateKapp)({
|
|
268
266
|
kapp: {
|
|
269
267
|
name: null
|
|
270
268
|
}
|
|
271
269
|
});
|
|
272
|
-
|
|
273
270
|
case 3:
|
|
274
271
|
_yield$updateKapp2 = _context3.sent;
|
|
275
272
|
kapp = _yield$updateKapp2.kapp;
|
|
@@ -281,7 +278,6 @@ describe('kapps api', function () {
|
|
|
281
278
|
badRequest: true,
|
|
282
279
|
message: 'Invalid kapp'
|
|
283
280
|
});
|
|
284
|
-
|
|
285
281
|
case 8:
|
|
286
282
|
case "end":
|
|
287
283
|
return _context3.stop();
|
|
@@ -289,25 +285,23 @@ describe('kapps api', function () {
|
|
|
289
285
|
}
|
|
290
286
|
}, _callee3);
|
|
291
287
|
})));
|
|
292
|
-
test('forbidden', /*#__PURE__*/
|
|
288
|
+
test('forbidden', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4() {
|
|
293
289
|
var _yield$updateKapp3, kapp, error;
|
|
294
|
-
|
|
295
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
290
|
+
return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
|
|
296
291
|
while (1) {
|
|
297
292
|
switch (_context4.prev = _context4.next) {
|
|
298
293
|
case 0:
|
|
299
|
-
|
|
294
|
+
_axios["default"].put.mockRejectedValue((0, _createError["default"])('Request failed with status code 403', null, 403, null, {
|
|
300
295
|
status: 403,
|
|
301
296
|
statusText: 'Forbidden',
|
|
302
297
|
data: {}
|
|
303
298
|
}));
|
|
304
299
|
_context4.next = 3;
|
|
305
|
-
return updateKapp({
|
|
300
|
+
return (0, _kapps.updateKapp)({
|
|
306
301
|
kapp: {
|
|
307
302
|
name: 'Foo'
|
|
308
303
|
}
|
|
309
304
|
});
|
|
310
|
-
|
|
311
305
|
case 3:
|
|
312
306
|
_yield$updateKapp3 = _context4.sent;
|
|
313
307
|
kapp = _yield$updateKapp3.kapp;
|
|
@@ -319,7 +313,6 @@ describe('kapps api', function () {
|
|
|
319
313
|
forbidden: true,
|
|
320
314
|
message: 'Forbidden'
|
|
321
315
|
});
|
|
322
|
-
|
|
323
316
|
case 8:
|
|
324
317
|
case "end":
|
|
325
318
|
return _context4.stop();
|
package/lib/apis/core/logs.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
import { bundle } from '../../helpers';
|
|
3
|
-
import { handleErrors, headerBuilder } from '../http';
|
|
1
|
+
"use strict";
|
|
4
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.fetchLogsVersion = exports.fetchLogs = void 0;
|
|
8
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
+
var _helpers = require("../../helpers");
|
|
10
|
+
var _http = require("../http");
|
|
5
11
|
var parseNDLog = function parseNDLog(logLine) {
|
|
6
12
|
try {
|
|
7
13
|
return JSON.parse(logLine);
|
|
8
14
|
} catch (e) {
|
|
9
15
|
console.warn('Failed to parse ND log line: ', logLine);
|
|
10
16
|
}
|
|
11
|
-
|
|
12
17
|
return {};
|
|
13
18
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return axios.get("".concat(bundle.spaceLocation(), "/app/loghub/api/v1/version"), {}).then(function (response) {
|
|
19
|
+
var fetchLogsVersion = function fetchLogsVersion() {
|
|
20
|
+
return _axios["default"].get("".concat(_helpers.bundle.spaceLocation(), "/app/loghub/api/v1/version"), {}).then(function (response) {
|
|
17
21
|
return response.data;
|
|
18
22
|
})["catch"](function (response) {
|
|
19
23
|
return {
|
|
@@ -21,19 +25,21 @@ export var fetchLogsVersion = function fetchLogsVersion() {
|
|
|
21
25
|
};
|
|
22
26
|
});
|
|
23
27
|
};
|
|
24
|
-
|
|
28
|
+
exports.fetchLogsVersion = fetchLogsVersion;
|
|
29
|
+
var fetchLogs = function fetchLogs() {
|
|
25
30
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
31
|
var format = options.format || 'ndjson';
|
|
27
|
-
return
|
|
32
|
+
return _axios["default"].get("".concat(_helpers.bundle.spaceLocation(), "/app/loghub/api/v1/logs"), {
|
|
28
33
|
params: {
|
|
29
34
|
limit: options.limit || 500,
|
|
30
35
|
format: format,
|
|
31
36
|
q: options.q,
|
|
32
37
|
pageToken: options.nextPageToken,
|
|
33
38
|
start: options.start,
|
|
34
|
-
end: options.end
|
|
39
|
+
end: options.end,
|
|
40
|
+
tail: options.tail
|
|
35
41
|
},
|
|
36
|
-
headers: headerBuilder(options)
|
|
42
|
+
headers: (0, _http.headerBuilder)(options)
|
|
37
43
|
}).then(function (response) {
|
|
38
44
|
if (typeof response.data === 'object') {
|
|
39
45
|
return {
|
|
@@ -45,12 +51,10 @@ export var fetchLogs = function fetchLogs() {
|
|
|
45
51
|
error: response.data
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
|
-
|
|
49
54
|
var logs = response.data.split('\n').filter(function (ll) {
|
|
50
55
|
return ll !== '';
|
|
51
56
|
}).map(parseNDLog);
|
|
52
57
|
var last = logs[logs.length - 1];
|
|
53
|
-
|
|
54
58
|
if (last.metadata) {
|
|
55
59
|
logs.pop();
|
|
56
60
|
return {
|
|
@@ -58,9 +62,9 @@ export var fetchLogs = function fetchLogs() {
|
|
|
58
62
|
nextPageToken: last.metadata.nextPageToken
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
|
-
|
|
62
65
|
return {
|
|
63
66
|
logs: logs
|
|
64
67
|
};
|
|
65
|
-
})["catch"](handleErrors);
|
|
66
|
-
};
|
|
68
|
+
})["catch"](_http.handleErrors);
|
|
69
|
+
};
|
|
70
|
+
exports.fetchLogs = fetchLogs;
|
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.deleteMembership = exports.createMembership = void 0;
|
|
8
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
+
var _helpers = require("../../helpers");
|
|
10
|
+
var _http = require("../http");
|
|
11
|
+
var createMembership = function createMembership() {
|
|
5
12
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
13
|
var team = options.team,
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
user = options.user;
|
|
9
15
|
if (!team) {
|
|
10
16
|
throw new Error('createMembership failed! The option "team" is required.');
|
|
11
17
|
}
|
|
12
|
-
|
|
13
18
|
if (!user) {
|
|
14
19
|
throw new Error('createMembership failed! The option "user" is required.');
|
|
15
20
|
}
|
|
16
|
-
|
|
17
|
-
return axios.post("".concat(bundle.apiLocation(), "/memberships"), {
|
|
21
|
+
return _axios["default"].post("".concat(_helpers.bundle.apiLocation(), "/memberships"), {
|
|
18
22
|
team: team,
|
|
19
23
|
user: user
|
|
20
24
|
}, {
|
|
21
|
-
params: paramBuilder(options)
|
|
25
|
+
params: (0, _http.paramBuilder)(options)
|
|
22
26
|
}).then(function (response) {
|
|
23
27
|
return {
|
|
24
28
|
membership: response.data.membership
|
|
25
29
|
};
|
|
26
|
-
})["catch"](handleErrors);
|
|
30
|
+
})["catch"](_http.handleErrors);
|
|
27
31
|
};
|
|
28
|
-
|
|
32
|
+
exports.createMembership = createMembership;
|
|
33
|
+
var deleteMembership = function deleteMembership() {
|
|
29
34
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
35
|
var teamSlug = options.teamSlug,
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
username = options.username;
|
|
33
37
|
if (!teamSlug) {
|
|
34
38
|
throw new Error('deleteMembership failed! The option "teamSlug" is required.');
|
|
35
39
|
}
|
|
36
|
-
|
|
37
40
|
if (!username) {
|
|
38
41
|
throw new Error('deleteMembership failed! The option "username" is required.');
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
return _axios["default"]["delete"]("".concat(_helpers.bundle.apiLocation(), "/memberships/").concat(teamSlug, "_").concat(username), {
|
|
44
|
+
params: (0, _http.paramBuilder)(options)
|
|
45
|
+
})["catch"](_http.handleErrors);
|
|
46
|
+
};
|
|
47
|
+
exports.deleteMembership = deleteMembership;
|
package/lib/apis/core/meta.js
CHANGED
|
@@ -1,35 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.fetchTimezones = exports.fetchSpaceWebhookEvents = exports.fetchSpaMeta = exports.fetchLocales = exports.fetchKappWebhookEvents = void 0;
|
|
8
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
9
|
+
var _helpers = require("../../helpers");
|
|
10
|
+
var _http = require("../http");
|
|
11
|
+
var fetchLocales = function fetchLocales() {
|
|
12
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/meta/locales"));
|
|
6
13
|
};
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
exports.fetchLocales = fetchLocales;
|
|
15
|
+
var fetchTimezones = function fetchTimezones() {
|
|
16
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/meta/timezones"));
|
|
9
17
|
};
|
|
10
|
-
|
|
18
|
+
exports.fetchTimezones = fetchTimezones;
|
|
19
|
+
var fetchSpaceWebhookEvents = function fetchSpaceWebhookEvents() {
|
|
11
20
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
-
return
|
|
13
|
-
headers: headerBuilder(options)
|
|
21
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/meta/webhooks/events/space"), {
|
|
22
|
+
headers: (0, _http.headerBuilder)(options)
|
|
14
23
|
}).then(function (response) {
|
|
15
24
|
return response.data;
|
|
16
|
-
})["catch"](handleErrors);
|
|
25
|
+
})["catch"](_http.handleErrors);
|
|
17
26
|
};
|
|
18
|
-
|
|
27
|
+
exports.fetchSpaceWebhookEvents = fetchSpaceWebhookEvents;
|
|
28
|
+
var fetchKappWebhookEvents = function fetchKappWebhookEvents() {
|
|
19
29
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
|
-
return
|
|
21
|
-
headers: headerBuilder(options)
|
|
30
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/meta/webhooks/events/kapp"), {
|
|
31
|
+
headers: (0, _http.headerBuilder)(options)
|
|
22
32
|
}).then(function (response) {
|
|
23
33
|
return response.data;
|
|
24
|
-
})["catch"](handleErrors);
|
|
34
|
+
})["catch"](_http.handleErrors);
|
|
25
35
|
};
|
|
26
|
-
|
|
27
|
-
|
|
36
|
+
exports.fetchKappWebhookEvents = fetchKappWebhookEvents;
|
|
37
|
+
var fetchSpaMeta = function fetchSpaMeta() {
|
|
38
|
+
return _axios["default"].get("".concat(_helpers.bundle.apiLocation(), "/meta/spa"), {
|
|
28
39
|
__bypassInitInterceptor: true,
|
|
29
40
|
headers: {
|
|
30
41
|
'X-Kinetic-ForcePreflight': 'ice-cream-cone'
|
|
31
42
|
}
|
|
32
43
|
}).then(function (response) {
|
|
33
44
|
return response.data;
|
|
34
|
-
})["catch"](handleErrors);
|
|
35
|
-
};
|
|
45
|
+
})["catch"](_http.handleErrors);
|
|
46
|
+
};
|
|
47
|
+
exports.fetchSpaMeta = fetchSpaMeta;
|