@webex/http-core 3.0.0-beta.213 → 3.0.0-beta.214

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/dist/index.js CHANGED
@@ -120,8 +120,9 @@ var setRequestTimings = function setRequestTimings(options) {
120
120
  * @returns {Promise} promise that resolves to a response object
121
121
  */
122
122
  var setTimingsAndFetch = function setTimingsAndFetch(options) {
123
- // call the fetch API
124
123
  var opts = setRequestTimings(options);
124
+
125
+ // call the fetch API
125
126
  return fetch(opts.uri, opts);
126
127
  };
127
128
  exports.setTimingsAndFetch = setTimingsAndFetch;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["protorequest","defaultOptions","options","uri","arguments","forEach","prop","descriptor","enumerable","writable","json","logger","console","_request","protoprepareFetchOptions","_prepareFetchOptions","setRequestTimings","now","Date","getTime","$timings","requestStart","networkStart","setTimingsAndFetch","opts","fetch","interceptors","HttpStatusInterceptor","create","defaults","request"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {assign, curry, defaults as lodashDefaults, isString} from 'lodash';\n\nimport HttpStatusInterceptor from './interceptors/http-status';\nimport _request from './request';\nimport {prepareFetchOptions as _prepareFetchOptions} from './request/utils';\n\n// Curry protorequest so we generate a function with default options built in.\nconst protorequest = curry(function protorequest(defaultOptions, options) {\n // allow for options to be a string (and therefore expect options in the third\n // position) to match request's api.\n if (isString(options)) {\n const uri = options;\n\n /* eslint prefer-rest-params: [0] */\n options = arguments[2] || {};\n options.uri = uri;\n }\n\n // Hide useless elements from logs\n ['download', 'interceptors', 'logger', 'upload'].forEach((prop) => {\n let descriptor = Reflect.getOwnPropertyDescriptor(options, prop);\n\n descriptor = assign({}, descriptor, {\n enumerable: false,\n writable: true,\n });\n Reflect.defineProperty(options, prop, descriptor);\n });\n\n lodashDefaults(options, defaultOptions);\n\n if (!options.json && options.json !== false) {\n Reflect.deleteProperty(options, 'json');\n }\n\n options.logger = options.logger || this.logger || console;\n\n return _request(options);\n});\n\nexport const protoprepareFetchOptions = curry(function protoprepareFetchOptions(\n defaultOptions,\n options\n) {\n // Hide useless elements from logs\n ['download', 'interceptors', 'logger', 'upload'].forEach((prop) => {\n let descriptor = Reflect.getOwnPropertyDescriptor(options, prop);\n\n descriptor = assign({}, descriptor, {\n enumerable: false,\n writable: true,\n });\n Reflect.defineProperty(options, prop, descriptor);\n });\n\n lodashDefaults(options, defaultOptions);\n\n options.logger = options.logger || this.logger || console;\n\n return _prepareFetchOptions(options);\n});\n\n/**\n * Sets the $timings value(s) before the request/fetch.\n * This function is only useful if you are about to send a request\n * using prepared fetch options; normally it is done in webex.request();\n *\n * @param {any} options\n * @returns {any} the updated options object\n */\nconst setRequestTimings = (options) => {\n const now = new Date().getTime();\n options.$timings = options.$timings || {};\n options.$timings.requestStart = now;\n options.$timings.networkStart = now;\n\n return options;\n};\n\n/**\n * Submits a metric from pre-built request options via the fetch API. Updates\n * the \"$timings\" values to Date.now() since the existing times were set when\n * the options were built (not submitted).\n *\n * @param {any} options - the pre-built request options for submitting a metric\n * @returns {Promise} promise that resolves to a response object\n */\nexport const setTimingsAndFetch = (options) => {\n // call the fetch API\n const opts = setRequestTimings(options);\n\n return fetch(opts.uri, opts);\n};\n\nconst defaultOptions = {\n json: true,\n interceptors: [\n // Reminder: this is supposed to be an instantiated interceptor.\n HttpStatusInterceptor.create(),\n ],\n};\n\nexport const defaults = protorequest;\nexport const request = protorequest(defaultOptions);\nexport {default as ProgressEvent} from './progress-event';\nexport {default as Interceptor} from './lib/interceptor';\nexport {default as HttpError} from './http-error';\nexport {default as HttpStatusInterceptor} from './interceptors/http-status';\nexport {default as detect} from './lib/detect';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AAoGA;AACA;AACA;AAEA;AAtGA;AACA,IAAMA,YAAY,GAAG,qBAAM,SA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,EAAE,KAAK;MACjBC,QAAQ,EAAE;IACZ,CAAC,CAAC;IACF,6BAAuBP,OAAO,EAAEI,IAAI,EAAEC,UAAU,CAAC;EACnD,CAAC,CAAC;EAEF,wBAAeL,OAAO,EAAED,cAAc,CAAC;EAEvCC,OAAO,CAACS,MAAM,GAAGT,OAAO,CAACS,MAAM,IAAI,IAAI,CAACA,MAAM,IAAIC,OAAO;EAEzD,OAAO,IAAAG,0BAAoB,EAACb,OAAO,CAAC;AACtC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA;AAQA,IAAMc,iBAAiB,GAAG,SAApBA,iBAAiB,CAAId,OAAO,EAAK;EACrC,IAAMe,GAAG,GAAG,IAAIC,IAAI,EAAE,CAACC,OAAO,EAAE;EAChCjB,OAAO,CAACkB,QAAQ,GAAGlB,OAAO,CAACkB,QAAQ,IAAI,CAAC,CAAC;EACzClB,OAAO,CAACkB,QAAQ,CAACC,YAAY,GAAGJ,GAAG;EACnCf,OAAO,CAACkB,QAAQ,CAACE,YAAY,GAAGL,GAAG;EAEnC,OAAOf,OAAO;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMqB,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIrB,OAAO,EAAK;EAC7C;EACA,IAAMsB,IAAI,GAAGR,iBAAiB,CAACd,OAAO,CAAC;EAEvC,OAAOuB,KAAK,CAACD,IAAI,CAACrB,GAAG,EAAEqB,IAAI,CAAC;AAC9B,CAAC;AAAC;AAEF,IAAMvB,cAAc,GAAG;EACrBS,IAAI,EAAE,IAAI;EACVgB,YAAY,EAAE;EACZ;EACAC,mBAAqB,CAACC,MAAM,EAAE;AAElC,CAAC;AAEM,IAAMC,QAAQ,GAAG7B,YAAY;AAAC;AAC9B,IAAM8B,OAAO,GAAG9B,YAAY,CAACC,cAAc,CAAC;AAAC"}
1
+ {"version":3,"names":["protorequest","defaultOptions","options","uri","arguments","forEach","prop","descriptor","enumerable","writable","json","logger","console","_request","protoprepareFetchOptions","_prepareFetchOptions","setRequestTimings","now","Date","getTime","$timings","requestStart","networkStart","setTimingsAndFetch","opts","fetch","interceptors","HttpStatusInterceptor","create","defaults","request"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {assign, curry, defaults as lodashDefaults, isString} from 'lodash';\n\nimport HttpStatusInterceptor from './interceptors/http-status';\nimport _request from './request';\nimport {prepareFetchOptions as _prepareFetchOptions} from './request/utils';\n\n// Curry protorequest so we generate a function with default options built in.\nconst protorequest = curry(function protorequest(defaultOptions, options) {\n // allow for options to be a string (and therefore expect options in the third\n // position) to match request's api.\n if (isString(options)) {\n const uri = options;\n\n /* eslint prefer-rest-params: [0] */\n options = arguments[2] || {};\n options.uri = uri;\n }\n\n // Hide useless elements from logs\n ['download', 'interceptors', 'logger', 'upload'].forEach((prop) => {\n let descriptor = Reflect.getOwnPropertyDescriptor(options, prop);\n\n descriptor = assign({}, descriptor, {\n enumerable: false,\n writable: true,\n });\n Reflect.defineProperty(options, prop, descriptor);\n });\n\n lodashDefaults(options, defaultOptions);\n\n if (!options.json && options.json !== false) {\n Reflect.deleteProperty(options, 'json');\n }\n\n options.logger = options.logger || this.logger || console;\n\n return _request(options);\n});\n\nexport const protoprepareFetchOptions = curry(function protoprepareFetchOptions(\n defaultOptions,\n options\n) {\n // Hide useless elements from logs\n ['download', 'interceptors', 'logger', 'upload'].forEach((prop) => {\n let descriptor = Reflect.getOwnPropertyDescriptor(options, prop);\n\n descriptor = assign({}, descriptor, {\n enumerable: false,\n writable: true,\n });\n Reflect.defineProperty(options, prop, descriptor);\n });\n\n lodashDefaults(options, defaultOptions);\n\n options.logger = options.logger || this.logger || console;\n\n return _prepareFetchOptions(options);\n});\n\n/**\n * Sets the $timings value(s) before the request/fetch.\n * This function is only useful if you are about to send a request\n * using prepared fetch options; normally it is done in webex.request();\n *\n * @param {any} options\n * @returns {any} the updated options object\n */\nconst setRequestTimings = (options) => {\n const now = new Date().getTime();\n options.$timings = options.$timings || {};\n options.$timings.requestStart = now;\n options.$timings.networkStart = now;\n\n return options;\n};\n\n/**\n * Submits a metric from pre-built request options via the fetch API. Updates\n * the \"$timings\" values to Date.now() since the existing times were set when\n * the options were built (not submitted).\n *\n * @param {any} options - the pre-built request options for submitting a metric\n * @returns {Promise} promise that resolves to a response object\n */\nexport const setTimingsAndFetch = (options) => {\n const opts = setRequestTimings(options);\n\n // call the fetch API\n return fetch(opts.uri, opts);\n};\n\nconst defaultOptions = {\n json: true,\n interceptors: [\n // Reminder: this is supposed to be an instantiated interceptor.\n HttpStatusInterceptor.create(),\n ],\n};\n\nexport const defaults = protorequest;\nexport const request = protorequest(defaultOptions);\nexport {default as ProgressEvent} from './progress-event';\nexport {default as Interceptor} from './lib/interceptor';\nexport {default as HttpError} from './http-error';\nexport {default as HttpStatusInterceptor} from './interceptors/http-status';\nexport {default as detect} from './lib/detect';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AAoGA;AACA;AACA;AAEA;AAtGA;AACA,IAAMA,YAAY,GAAG,qBAAM,SAASA,YAAY,CAACC,cAAc,EAAEC,OAAO,EAAE;EACxE;EACA;EACA,IAAI,wBAASA,OAAO,CAAC,EAAE;IACrB,IAAMC,GAAG,GAAGD,OAAO;;IAEnB;IACAA,OAAO,GAAGE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5BF,OAAO,CAACC,GAAG,GAAGA,GAAG;EACnB;;EAEA;EACA,CAAC,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAACE,OAAO,CAAC,UAACC,IAAI,EAAK;IACjE,IAAIC,UAAU,GAAG,uCAAiCL,OAAO,EAAEI,IAAI,CAAC;IAEhEC,UAAU,GAAG,sBAAO,CAAC,CAAC,EAAEA,UAAU,EAAE;MAClCC,UAAU,EAA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AO,EAAE;EAChCjB,OAAO,CAACkB,QAAQ,GAAGlB,OAAO,CAACkB,QAAQ,IAAI,CAAC,CAAC;EACzClB,OAAO,CAACkB,QAAQ,CAACC,YAAY,GAAGJ,GAAG;EACnCf,OAAO,CAACkB,QAAQ,CAACE,YAAY,GAAGL,GAAG;EAEnC,OAAOf,OAAO;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMqB,kBAAkB,GAAG,SAArBA,kBAAkB,CAAIrB,OAAO,EAAK;EAC7C,IAAMsB,IAAI,GAAGR,iBAAiB,CAACd,OAAO,CAAC;;EAEvC;EACA,OAAOuB,KAAK,CAACD,IAAI,CAACrB,GAAG,EAAEqB,IAAI,CAAC;AAC9B,CAAC;AAAC;AAEF,IAAMvB,cAAc,GAAG;EACrBS,IAAI,EAAE,IAAI;EACVgB,YAAY,EAAE;EACZ;EACAC,mBAAqB,CAACC,MAAM,EAAE;AAElC,CAAC;AAEM,IAAMC,QAAQ,GAAG7B,YAAY;AAAC;AAC9B,IAAM8B,OAAO,GAAG9B,YAAY,CAACC,cAAc,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/http-core",
3
- "version": "3.0.0-beta.213",
3
+ "version": "3.0.0-beta.214",
4
4
  "description": "Core HTTP library for the Cisco Webex",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -24,18 +24,18 @@
24
24
  ]
25
25
  },
26
26
  "devDependencies": {
27
- "@webex/test-helper-chai": "3.0.0-beta.213",
28
- "@webex/test-helper-file": "3.0.0-beta.213",
29
- "@webex/test-helper-make-local-url": "3.0.0-beta.213",
30
- "@webex/test-helper-mocha": "3.0.0-beta.213",
27
+ "@webex/test-helper-chai": "3.0.0-beta.214",
28
+ "@webex/test-helper-file": "3.0.0-beta.214",
29
+ "@webex/test-helper-make-local-url": "3.0.0-beta.214",
30
+ "@webex/test-helper-mocha": "3.0.0-beta.214",
31
31
  "sinon": "^9.2.4"
32
32
  },
33
33
  "dependencies": {
34
- "@webex/common": "3.0.0-beta.213",
35
- "@webex/http-core": "3.0.0-beta.213",
36
- "@webex/internal-plugin-device": "3.0.0-beta.213",
37
- "@webex/test-helper-test-users": "3.0.0-beta.213",
38
- "@webex/webex-core": "3.0.0-beta.213",
34
+ "@webex/common": "3.0.0-beta.214",
35
+ "@webex/http-core": "3.0.0-beta.214",
36
+ "@webex/internal-plugin-device": "3.0.0-beta.214",
37
+ "@webex/test-helper-test-users": "3.0.0-beta.214",
38
+ "@webex/webex-core": "3.0.0-beta.214",
39
39
  "file-type": "^16.0.1",
40
40
  "global": "^4.4.0",
41
41
  "is-function": "^1.0.1",
package/src/index.js CHANGED
@@ -90,9 +90,9 @@ const setRequestTimings = (options) => {
90
90
  * @returns {Promise} promise that resolves to a response object
91
91
  */
92
92
  export const setTimingsAndFetch = (options) => {
93
- // call the fetch API
94
93
  const opts = setRequestTimings(options);
95
94
 
95
+ // call the fetch API
96
96
  return fetch(opts.uri, opts);
97
97
  };
98
98