@next-core/brick-kit 2.122.14 → 2.123.2
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/CHANGELOG.md +27 -0
- package/dist/index.bundle.js +60 -13
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +61 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/interfaces.d.ts +4 -5
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/providers/CustomApi.d.ts +5 -2
- package/dist/types/providers/CustomApi.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/index.esm.js
CHANGED
|
@@ -10,7 +10,7 @@ import i18next, { getFixedT } from 'i18next';
|
|
|
10
10
|
import { parsePath, createBrowserHistory, locationsAreEqual, createPath } from 'history';
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
12
12
|
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, matchPath, scanAppGetMenuInAny, asyncProcessBrick, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
13
|
-
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, pick, orderBy, omit, findLastIndex, noop, isObject as isObject$1, isString } from 'lodash';
|
|
13
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge, isEmpty, pick, orderBy, omit, findLastIndex, noop, isObject as isObject$1, isString } from 'lodash';
|
|
14
14
|
import moment from 'moment';
|
|
15
15
|
import { pipes } from '@next-core/pipes';
|
|
16
16
|
import yaml from 'js-yaml';
|
|
@@ -5882,7 +5882,8 @@ function getApiArgsFromApiProfile(_ref, originalArgs) {
|
|
|
5882
5882
|
serviceName,
|
|
5883
5883
|
responseWrapper,
|
|
5884
5884
|
version,
|
|
5885
|
-
isFileType
|
|
5885
|
+
isFileType,
|
|
5886
|
+
request
|
|
5886
5887
|
} = _ref;
|
|
5887
5888
|
var fileName;
|
|
5888
5889
|
|
|
@@ -5898,14 +5899,16 @@ function getApiArgsFromApiProfile(_ref, originalArgs) {
|
|
|
5898
5899
|
url,
|
|
5899
5900
|
method,
|
|
5900
5901
|
ext_fields,
|
|
5901
|
-
responseWrapper: false
|
|
5902
|
+
responseWrapper: false,
|
|
5903
|
+
request
|
|
5902
5904
|
}, ...args, {
|
|
5903
5905
|
responseType: "blob"
|
|
5904
5906
|
}] : [{
|
|
5905
5907
|
url,
|
|
5906
5908
|
method,
|
|
5907
5909
|
ext_fields,
|
|
5908
|
-
responseWrapper
|
|
5910
|
+
responseWrapper,
|
|
5911
|
+
request
|
|
5909
5912
|
}, ...args];
|
|
5910
5913
|
}
|
|
5911
5914
|
|
|
@@ -5946,7 +5949,8 @@ function getApiProfileFromApiDefinition(provider, api) {
|
|
|
5946
5949
|
serviceName: api.serviceName,
|
|
5947
5950
|
version: api.version,
|
|
5948
5951
|
isFileType: (contract === null || contract === void 0 ? void 0 : (_contract$response = contract.response) === null || _contract$response === void 0 ? void 0 : _contract$response.type) === "file",
|
|
5949
|
-
responseWrapper
|
|
5952
|
+
responseWrapper,
|
|
5953
|
+
request: contract.request
|
|
5950
5954
|
};
|
|
5951
5955
|
}
|
|
5952
5956
|
|
|
@@ -5979,7 +5983,8 @@ function _fetchFlowApiDefinition2() {
|
|
|
5979
5983
|
version: contract.version,
|
|
5980
5984
|
contract: {
|
|
5981
5985
|
endpoint: contract.endpoint,
|
|
5982
|
-
response: contract.response
|
|
5986
|
+
response: contract.response,
|
|
5987
|
+
request: contract.request
|
|
5983
5988
|
}
|
|
5984
5989
|
};
|
|
5985
5990
|
} else {
|
|
@@ -6000,7 +6005,8 @@ function _fetchFlowApiDefinition2() {
|
|
|
6000
6005
|
version: contractData.version,
|
|
6001
6006
|
contract: {
|
|
6002
6007
|
endpoint: contractData.endpoint,
|
|
6003
|
-
response: contractData.response
|
|
6008
|
+
response: contractData.response,
|
|
6009
|
+
request: contractData.request
|
|
6004
6010
|
}
|
|
6005
6011
|
};
|
|
6006
6012
|
}
|
|
@@ -6943,6 +6949,46 @@ function processExtFields(ext_fields) {
|
|
|
6943
6949
|
options
|
|
6944
6950
|
};
|
|
6945
6951
|
}
|
|
6952
|
+
function hasFileType(request) {
|
|
6953
|
+
var flag = false;
|
|
6954
|
+
if (!request) return flag;
|
|
6955
|
+
|
|
6956
|
+
var processFields = fields => {
|
|
6957
|
+
return fields.some(field => {
|
|
6958
|
+
if (["file", "file[]"].includes(field.type)) {
|
|
6959
|
+
return true;
|
|
6960
|
+
}
|
|
6961
|
+
|
|
6962
|
+
if (!isEmpty(field.fields)) {
|
|
6963
|
+
return processFields(field.fields);
|
|
6964
|
+
}
|
|
6965
|
+
});
|
|
6966
|
+
};
|
|
6967
|
+
|
|
6968
|
+
if (request.type === "object" && !isEmpty(request.fields)) {
|
|
6969
|
+
flag = processFields(request.fields);
|
|
6970
|
+
}
|
|
6971
|
+
|
|
6972
|
+
return flag;
|
|
6973
|
+
}
|
|
6974
|
+
function transformFormData(data) {
|
|
6975
|
+
var formData = new FormData();
|
|
6976
|
+
|
|
6977
|
+
for (var [key, value] of Object.entries(data)) {
|
|
6978
|
+
if (Array.isArray(value)) {
|
|
6979
|
+
(function () {
|
|
6980
|
+
var k = "".concat(key, "[]");
|
|
6981
|
+
value.forEach(v => {
|
|
6982
|
+
formData.append(k, v);
|
|
6983
|
+
});
|
|
6984
|
+
})();
|
|
6985
|
+
} else {
|
|
6986
|
+
formData.append(key, value);
|
|
6987
|
+
}
|
|
6988
|
+
}
|
|
6989
|
+
|
|
6990
|
+
return formData;
|
|
6991
|
+
}
|
|
6946
6992
|
function CustomApi(_x) {
|
|
6947
6993
|
return _CustomApi.apply(this, arguments);
|
|
6948
6994
|
}
|
|
@@ -6953,9 +6999,11 @@ function _CustomApi() {
|
|
|
6953
6999
|
url,
|
|
6954
7000
|
method = "GET",
|
|
6955
7001
|
responseWrapper = true,
|
|
6956
|
-
ext_fields = []
|
|
7002
|
+
ext_fields = [],
|
|
7003
|
+
request
|
|
6957
7004
|
} = _ref;
|
|
6958
7005
|
var isSimpleRequest = ["get", "delete", "head"].includes(method.toLowerCase());
|
|
7006
|
+
var response;
|
|
6959
7007
|
|
|
6960
7008
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
6961
7009
|
args[_key2 - 1] = arguments[_key2];
|
|
@@ -6963,17 +7011,16 @@ function _CustomApi() {
|
|
|
6963
7011
|
|
|
6964
7012
|
if (isSimpleRequest) {
|
|
6965
7013
|
var [data, options] = args;
|
|
6966
|
-
|
|
7014
|
+
response = yield http.simpleRequest(method, url, _objectSpread({
|
|
6967
7015
|
params: data
|
|
6968
7016
|
}, options));
|
|
6969
|
-
return responseWrapper ? response.data : response;
|
|
6970
7017
|
} else {
|
|
7018
|
+
var isUploadType = hasFileType(request);
|
|
6971
7019
|
var result = processExtFields(ext_fields, ...args);
|
|
6972
|
-
|
|
6973
|
-
var _response = yield http.requestWithBody(method, url, result.data, result.options);
|
|
6974
|
-
|
|
6975
|
-
return responseWrapper ? _response.data : _response;
|
|
7020
|
+
response = yield http.requestWithBody(method, url, isUploadType ? transformFormData(result.data) : result.data, result.options);
|
|
6976
7021
|
}
|
|
7022
|
+
|
|
7023
|
+
return responseWrapper ? response.data : response;
|
|
6977
7024
|
});
|
|
6978
7025
|
return _CustomApi.apply(this, arguments);
|
|
6979
7026
|
}
|