@edx/frontend-platform 4.3.0 → 4.4.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/auth/utils.js CHANGED
@@ -72,7 +72,7 @@ var processAxiosError = function processAxiosError(axiosErrorObject) {
72
72
  httpErrorRequestUrl: httpErrorRequestUrl,
73
73
  httpErrorRequestMethod: httpErrorRequestMethod
74
74
  });
75
- error.message = "Axios Error (Response): ".concat(status, " ").concat(httpErrorRequestUrl, " ").concat(httpErrorResponseData);
75
+ error.message = "Axios Error (Response): ".concat(status, " - See custom attributes for details.");
76
76
  } else if (request) {
77
77
  error.customAttributes = _objectSpread(_objectSpread({}, error.customAttributes), {}, {
78
78
  httpErrorType: 'api-request-error',
@@ -82,7 +82,7 @@ var processAxiosError = function processAxiosError(axiosErrorObject) {
82
82
  });
83
83
  // This case occurs most likely because of intermittent internet connection issues
84
84
  // but it also, though less often, catches CORS or server configuration problems.
85
- error.message = "Axios Error (Request): ".concat(error.message, " (possible local connectivity issue) ").concat(httpErrorRequestMethod, " ").concat(httpErrorRequestUrl);
85
+ error.message = 'Axios Error (Request): (Possible local connectivity issue.) See custom attributes for details.';
86
86
  } else {
87
87
  error.customAttributes = _objectSpread(_objectSpread({}, error.customAttributes), {}, {
88
88
  httpErrorType: 'api-request-config-error',
@@ -90,7 +90,7 @@ var processAxiosError = function processAxiosError(axiosErrorObject) {
90
90
  httpErrorRequestUrl: httpErrorRequestUrl,
91
91
  httpErrorRequestMethod: httpErrorRequestMethod
92
92
  });
93
- error.message = "Axios Error (Config): ".concat(error.message, " ").concat(httpErrorRequestMethod, " ").concat(httpErrorRequestUrl);
93
+ error.message = 'Axios Error (Config): See custom attributes for details.';
94
94
  }
95
95
  return error;
96
96
  };
package/auth/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["urlRegex","getUrlParts","url","found","match","_found","_slicedToArray","fullUrl","protocol","domain","path","endFilename","endFileExtension","query","hash","e","Error","concat","logFrontendAuthError","loggingService","error","prefixedMessageError","Object","create","message","logError","customAttributes","processAxiosError","axiosErrorObject","request","response","config","_objectSpread","httpErrorType","httpErrorRequestUrl","httpErrorRequestMethod","method","status","data","stringifiedData","JSON","stringify","responseIsHTML","includes","httpErrorResponseData","httpErrorStatus","httpErrorMessage","processAxiosErrorAndThrow"],"sources":["../../src/auth/utils.js"],"sourcesContent":["// Lifted from here: https://regexr.com/3ok5o\nconst urlRegex = /([a-z]{1,2}tps?):\\/\\/((?:(?!(?:\\/|#|\\?|&)).)+)(?:(\\/(?:(?:(?:(?!(?:#|\\?|&)).)+\\/))?))?(?:((?:(?!(?:\\.|$|\\?|#)).)+))?(?:(\\.(?:(?!(?:\\?|$|#)).)+))?(?:(\\?(?:(?!(?:$|#)).)+))?(?:(#.+))?/;\nconst getUrlParts = (url) => {\n const found = url.match(urlRegex);\n try {\n const [\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n ] = found;\n\n return {\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n };\n } catch (e) {\n throw new Error(`Could not find url parts from ${url}.`);\n }\n};\n\nconst logFrontendAuthError = (loggingService, error) => {\n const prefixedMessageError = Object.create(error);\n prefixedMessageError.message = `[frontend-auth] ${error.message}`;\n loggingService.logError(prefixedMessageError, prefixedMessageError.customAttributes);\n};\n\nconst processAxiosError = (axiosErrorObject) => {\n const error = Object.create(axiosErrorObject);\n const { request, response, config } = error;\n\n if (!config) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'unknown-api-request-error',\n };\n return error;\n }\n\n const {\n url: httpErrorRequestUrl,\n method: httpErrorRequestMethod,\n } = config;\n /* istanbul ignore else: difficult to enter the request-only error case in a unit test */\n if (response) {\n const { status, data } = response;\n const stringifiedData = JSON.stringify(data) || '(empty response)';\n const responseIsHTML = stringifiedData.includes('<!DOCTYPE html>');\n // Don't include data if it is just an HTML document, like a 500 error page.\n /* istanbul ignore next */\n const httpErrorResponseData = responseIsHTML ? '<Response is HTML>' : stringifiedData;\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-response-error',\n httpErrorStatus: status,\n httpErrorResponseData,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = `Axios Error (Response): ${status} ${httpErrorRequestUrl} ${httpErrorResponseData}`;\n } else if (request) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-request-error',\n httpErrorMessage: error.message,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n // This case occurs most likely because of intermittent internet connection issues\n // but it also, though less often, catches CORS or server configuration problems.\n error.message = `Axios Error (Request): ${error.message} (possible local connectivity issue) ${httpErrorRequestMethod} ${httpErrorRequestUrl}`;\n } else {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-request-config-error',\n httpErrorMessage: error.message,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = `Axios Error (Config): ${error.message} ${httpErrorRequestMethod} ${httpErrorRequestUrl}`;\n }\n\n return error;\n};\n\nconst processAxiosErrorAndThrow = (axiosErrorObject) => {\n throw processAxiosError(axiosErrorObject);\n};\n\nexport {\n getUrlParts,\n logFrontendAuthError,\n processAxiosError,\n processAxiosErrorAndThrow,\n};\n"],"mappings":";;;;;;;;;;;;AAAA;AACA,IAAMA,QAAQ,GAAG,uLAAuL;AACxM,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,GAAG,EAAK;EAC3B,IAAMC,KAAK,GAAGD,GAAG,CAACE,KAAK,CAACJ,QAAQ,CAAC;EACjC,IAAI;IACF,IAAAK,MAAA,GAAAC,cAAA,CASIH,KAAK;MARPI,OAAO,GAAAF,MAAA;MACPG,QAAQ,GAAAH,MAAA;MACRI,MAAM,GAAAJ,MAAA;MACNK,IAAI,GAAAL,MAAA;MACJM,WAAW,GAAAN,MAAA;MACXO,gBAAgB,GAAAP,MAAA;MAChBQ,KAAK,GAAA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1B,KAAK,CAACI,OAAO;MAC/BU,mBAAmB,EAAnBA,mBAAmB;MACnBC,sBAAsB,EAAtBA;IAAsB,EACvB;IACDf,KAAK,CAACI,OAAO,4BAAAP,MAAA,CAA4BG,KAAK,CAACI,OAAO,OAAAP,MAAA,CAAIkB,sBAAsB,OAAAlB,MAAA,CAAIiB,mBAAmB,CAAE;EAC3G;EAEA,OAAOd,KAAK;AACd,CAAC;AAED,IAAM2B,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAInB,gBAAgB,EAAK;EACtD,MAAMD,iBAAiB,CAACC,gBAAgB,CAAC;AAC3C,CAAC;AAED,SACE3B,WAAW,EACXiB,oBAAoB,EACpBS,iBAAiB,EACjBoB,yBAAyB"}
1
+ {"version":3,"file":"utils.js","names":["urlRegex","getUrlParts","url","found","match","_found","_slicedToArray","fullUrl","protocol","domain","path","endFilename","endFileExtension","query","hash","e","Error","concat","logFrontendAuthError","loggingService","error","prefixedMessageError","Object","create","message","logError","customAttributes","processAxiosError","axiosErrorObject","request","response","config","_objectSpread","httpErrorType","httpErrorRequestUrl","httpErrorRequestMethod","method","status","data","stringifiedData","JSON","stringify","responseIsHTML","includes","httpErrorResponseData","httpErrorStatus","httpErrorMessage","processAxiosErrorAndThrow"],"sources":["../../src/auth/utils.js"],"sourcesContent":["// Lifted from here: https://regexr.com/3ok5o\nconst urlRegex = /([a-z]{1,2}tps?):\\/\\/((?:(?!(?:\\/|#|\\?|&)).)+)(?:(\\/(?:(?:(?:(?!(?:#|\\?|&)).)+\\/))?))?(?:((?:(?!(?:\\.|$|\\?|#)).)+))?(?:(\\.(?:(?!(?:\\?|$|#)).)+))?(?:(\\?(?:(?!(?:$|#)).)+))?(?:(#.+))?/;\nconst getUrlParts = (url) => {\n const found = url.match(urlRegex);\n try {\n const [\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n ] = found;\n\n return {\n fullUrl,\n protocol,\n domain,\n path,\n endFilename,\n endFileExtension,\n query,\n hash,\n };\n } catch (e) {\n throw new Error(`Could not find url parts from ${url}.`);\n }\n};\n\nconst logFrontendAuthError = (loggingService, error) => {\n const prefixedMessageError = Object.create(error);\n prefixedMessageError.message = `[frontend-auth] ${error.message}`;\n loggingService.logError(prefixedMessageError, prefixedMessageError.customAttributes);\n};\n\nconst processAxiosError = (axiosErrorObject) => {\n const error = Object.create(axiosErrorObject);\n const { request, response, config } = error;\n\n if (!config) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'unknown-api-request-error',\n };\n return error;\n }\n\n const {\n url: httpErrorRequestUrl,\n method: httpErrorRequestMethod,\n } = config;\n /* istanbul ignore else: difficult to enter the request-only error case in a unit test */\n if (response) {\n const { status, data } = response;\n const stringifiedData = JSON.stringify(data) || '(empty response)';\n const responseIsHTML = stringifiedData.includes('<!DOCTYPE html>');\n // Don't include data if it is just an HTML document, like a 500 error page.\n /* istanbul ignore next */\n const httpErrorResponseData = responseIsHTML ? '<Response is HTML>' : stringifiedData;\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-response-error',\n httpErrorStatus: status,\n httpErrorResponseData,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = `Axios Error (Response): ${status} - See custom attributes for details.`;\n } else if (request) {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-request-error',\n httpErrorMessage: error.message,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n // This case occurs most likely because of intermittent internet connection issues\n // but it also, though less often, catches CORS or server configuration problems.\n error.message = 'Axios Error (Request): (Possible local connectivity issue.) See custom attributes for details.';\n } else {\n error.customAttributes = {\n ...error.customAttributes,\n httpErrorType: 'api-request-config-error',\n httpErrorMessage: error.message,\n httpErrorRequestUrl,\n httpErrorRequestMethod,\n };\n error.message = 'Axios Error (Config): See custom attributes for details.';\n }\n\n return error;\n};\n\nconst processAxiosErrorAndThrow = (axiosErrorObject) => {\n throw processAxiosError(axiosErrorObject);\n};\n\nexport {\n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AAE,mBAAmB;MAClCa,gBAAgB,EAAE1B,KAAK,CAACI,OAAO;MAC/BU,mBAAmB,EAAnBA,mBAAmB;MACnBC,sBAAsB,EAAtBA;IAAsB,EACvB;IACD;IACA;IACAf,KAAK,CAACI,OAAO,GAAG,gGAAgG;EAClH,CAAC,MAAM;IACLJ,KAAK,CAACM,gBAAgB,GAAAM,aAAA,CAAAA,aAAA,KACjBZ,KAAK,CAACM,gBAAgB;MACzBO,aAAa,EAAE,0BAA0B;MACzCa,gBAAgB,EAAE1B,KAAK,CAACI,OAAO;MAC/BU,mBAAmB,EAAnBA,mBAAmB;MACnBC,sBAAsB,EAAtBA;IAAsB,EACvB;IACDf,KAAK,CAACI,OAAO,GAAG,0DAA0D;EAC5E;EAEA,OAAOJ,KAAK;AACd,CAAC;AAED,IAAM2B,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAInB,gBAAgB,EAAK;EACtD,MAAMD,iBAAiB,CAACC,gBAAgB,CAAC;AAC3C,CAAC;AAED,SACE3B,WAAW,EACXiB,oBAAoB,EACpBS,iBAAiB,EACjBoB,yBAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-platform",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "Foundational application framework for Open edX micro-frontend applications.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {