vap1 0.8.0 → 0.8.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/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"vap1","version":"0.8.0","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
1
+ {"name":"vap1","version":"0.8.1","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
package/utils/Ajax.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { PlainObject } from '../basetype';
2
2
  import type { Result } from './_AjaxUtil';
3
- export { SESSION, SESSION_TIME, CLEAR, WAIT } from './_AjaxUtil';
3
+ export { SESSION, SESSION_TIME, CLEAR, WAIT, getMicroHeader } from './_AjaxUtil';
4
4
  /**
5
5
  * CATCH 方法可以捕获通用的错误并,省去 try/catch 语法
6
6
  */
package/utils/Ajax.js CHANGED
@@ -66,7 +66,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
66
66
  return (mod && mod.__esModule) ? mod : { "default": mod };
67
67
  };
68
68
  Object.defineProperty(exports, "__esModule", { value: true });
69
- exports.WHEN = exports.PUT = exports.DELETE = exports.PATCH = exports.POST = exports.GET = exports.FETCH = exports.CATCH = exports.WAIT = exports.CLEAR = exports.SESSION_TIME = exports.SESSION = void 0;
69
+ exports.WHEN = exports.PUT = exports.DELETE = exports.PATCH = exports.POST = exports.GET = exports.FETCH = exports.CATCH = exports.getMicroHeader = exports.WAIT = exports.CLEAR = exports.SESSION_TIME = exports.SESSION = void 0;
70
70
  var lodash_1 = __importDefault(require("lodash"));
71
71
  var Global_1 = require("./Global");
72
72
  var _Support_1 = require("./_Support");
@@ -76,6 +76,7 @@ Object.defineProperty(exports, "SESSION", { enumerable: true, get: function () {
76
76
  Object.defineProperty(exports, "SESSION_TIME", { enumerable: true, get: function () { return _AjaxUtil_2.SESSION_TIME; } });
77
77
  Object.defineProperty(exports, "CLEAR", { enumerable: true, get: function () { return _AjaxUtil_2.CLEAR; } });
78
78
  Object.defineProperty(exports, "WAIT", { enumerable: true, get: function () { return _AjaxUtil_2.WAIT; } });
79
+ Object.defineProperty(exports, "getMicroHeader", { enumerable: true, get: function () { return _AjaxUtil_2.getMicroHeader; } });
79
80
  var _a = (0, _Support_1.globalDefault)('NProgress', { start: function () { }, done: function () { } }), start = _a.start, done = _a.done;
80
81
  /**
81
82
  * CATCH 方法可以捕获通用的错误并,省去 try/catch 语法
@@ -19,6 +19,7 @@ export declare const SESSION_TIME: (url: string, second: number) => void;
19
19
  export declare const SESSION: (...urls: string[]) => Set<string>[];
20
20
  export declare const CLEAR: (...urls: string[]) => void[];
21
21
  type HeaderRecord = Record<string, string>;
22
+ export declare const getMicroHeader: (path?: string) => HeaderRecord;
22
23
  export declare const mergeHeaders: (...headersList: HeadersInit[]) => HeaderRecord;
23
24
  export declare const setXHRHeaders: (xhr: XMLHttpRequest, headers: HeadersInit) => void;
24
25
  export declare const appendMicorSessionHeaderForRequest: (url: string, headers: HeadersInit) => HeaderRecord;
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  };
32
32
  var e_1, _a;
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.LOG_AJAX = exports.AOP_BEFORE = exports.setFixedHeader = exports.filterNull = exports.receiveMicorSessionByXHR = exports.receiveMicorSessionByFetch = exports.appendMicorSessionHeaderForRequest = exports.setXHRHeaders = exports.mergeHeaders = exports.CLEAR = exports.SESSION = exports.SESSION_TIME = exports.WAIT = exports.CACHE_TIMER = exports.CACHE_URL = void 0;
34
+ exports.LOG_AJAX = exports.AOP_BEFORE = exports.setFixedHeader = exports.filterNull = exports.receiveMicorSessionByXHR = exports.receiveMicorSessionByFetch = exports.appendMicorSessionHeaderForRequest = exports.setXHRHeaders = exports.mergeHeaders = exports.getMicroHeader = exports.CLEAR = exports.SESSION = exports.SESSION_TIME = exports.WAIT = exports.CACHE_TIMER = exports.CACHE_URL = void 0;
35
35
  var lodash_1 = __importDefault(require("lodash"));
36
36
  var _Support_1 = require("./_Support");
37
37
  var Global_1 = require("./Global");
@@ -184,6 +184,15 @@ var getMatchedMicorSession = function (url) {
184
184
  .map(function (name) { return "".concat(name, "=").concat(store[matchedPath][name].value); })
185
185
  .join('; ');
186
186
  };
187
+ var getMicroHeader = function (path) {
188
+ var _a;
189
+ if (path === void 0) { path = window.location.pathname; }
190
+ var session = getMatchedMicorSession(path);
191
+ if (!session)
192
+ return {};
193
+ return _a = {}, _a[MICOR_SESSION_REQUEST_HEADER] = session, _a;
194
+ };
195
+ exports.getMicroHeader = getMicroHeader;
187
196
  var findHeaderKey = function (headers, headerName) {
188
197
  var lowerName = lodash_1.default.toLower(headerName);
189
198
  return lodash_1.default.find(lodash_1.default.keys(headers), function (key) { return lodash_1.default.toLower(key) == lowerName; });