From a583b2587dcc0e90542ba38da893b1221983afa1 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 24 Sep 2018 10:42:49 +0100 Subject: [PATCH] Bumped ember-ajax dependency no issue - 3.1.1 moved to class syntax which had a knock-on effect with our custom error objects which also needed to be switched --- ghost/admin/app/services/ajax.js | 52 +++++++++++++------------ ghost/admin/package.json | 2 +- ghost/admin/yarn.lock | 66 +++++++++++++++++++++++++++++--- 3 files changed, 89 insertions(+), 31 deletions(-) diff --git a/ghost/admin/app/services/ajax.js b/ghost/admin/app/services/ajax.js index 128f10e366..eff9ed63f7 100644 --- a/ghost/admin/app/services/ajax.js +++ b/ghost/admin/app/services/ajax.js @@ -20,12 +20,12 @@ function isJSONContentType(header) { /* Version mismatch error */ -export function VersionMismatchError(payload) { - AjaxError.call(this, payload, 'API server is running a newer version of Ghost, please upgrade.'); +export class VersionMismatchError extends AjaxError { + constructor(payload) { + super(payload, 'API server is running a newer version of Ghost, please upgrade.'); + } } -VersionMismatchError.prototype = Object.create(AjaxError.prototype); - export function isVersionMismatchError(errorOrStatus, payload) { if (isAjaxError(errorOrStatus)) { return errorOrStatus instanceof VersionMismatchError; @@ -34,14 +34,14 @@ export function isVersionMismatchError(errorOrStatus, payload) { } } -/* Request entity too large error */ +/* Server unreachable error */ -export function ServerUnreachableError(payload) { - AjaxError.call(this, payload, 'Server was unreachable'); +export class ServerUnreachableError extends AjaxError { + constructor(payload) { + super(payload, 'Server was unreachable'); + } } -ServerUnreachableError.prototype = Object.create(AjaxError.prototype); - export function isServerUnreachableError(error) { if (isAjaxError(error)) { return error instanceof ServerUnreachableError; @@ -50,11 +50,13 @@ export function isServerUnreachableError(error) { } } -export function RequestEntityTooLargeError(payload) { - AjaxError.call(this, payload, 'Request is larger than the maximum file size the server allows'); -} +/* Request entity too large error */ -RequestEntityTooLargeError.prototype = Object.create(AjaxError.prototype); +export class RequestEntityTooLargeError extends AjaxError { + constructor(payload) { + super(payload, 'Request is larger than the maximum file size the server allows'); + } +} export function isRequestEntityTooLargeError(errorOrStatus) { if (isAjaxError(errorOrStatus)) { @@ -66,12 +68,12 @@ export function isRequestEntityTooLargeError(errorOrStatus) { /* Unsupported media type error */ -export function UnsupportedMediaTypeError(payload) { - AjaxError.call(this, payload, 'Request contains an unknown or unsupported file type.'); +export class UnsupportedMediaTypeError extends AjaxError { + constructor(payload) { + super(payload, 'Request contains an unknown or unsupported file type.'); + } } -UnsupportedMediaTypeError.prototype = Object.create(AjaxError.prototype); - export function isUnsupportedMediaTypeError(errorOrStatus) { if (isAjaxError(errorOrStatus)) { return errorOrStatus instanceof UnsupportedMediaTypeError; @@ -82,12 +84,12 @@ export function isUnsupportedMediaTypeError(errorOrStatus) { /* Maintenance error */ -export function MaintenanceError(payload) { - AjaxError.call(this, payload, 'Ghost is currently undergoing maintenance, please wait a moment then retry.'); +export class MaintenanceError extends AjaxError { + constructor(payload) { + super(payload, 'Ghost is currently undergoing maintenance, please wait a moment then retry.'); + } } -MaintenanceError.prototype = Object.create(AjaxError.prototype); - export function isMaintenanceError(errorOrStatus) { if (isAjaxError(errorOrStatus)) { return errorOrStatus instanceof MaintenanceError; @@ -98,12 +100,12 @@ export function isMaintenanceError(errorOrStatus) { /* Theme validation error */ -export function ThemeValidationError(payload) { - AjaxError.call(this, payload, 'Theme is not compatible or contains errors.'); +export class ThemeValidationError extends AjaxError { + constructor(payload) { + super(payload, 'Theme is not compatible or contains errors.'); + } } -ThemeValidationError.prototype = Object.create(AjaxError.prototype); - export function isThemeValidationError(errorOrStatus, payload) { if (isAjaxError(errorOrStatus)) { return errorOrStatus instanceof ThemeValidationError; diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 2d0a5b9dc1..5d586ed2c2 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -43,7 +43,7 @@ "current-device": "0.7.8", "deparam": "1.0.5", "element-resize-detector": "^1.1.14", - "ember-ajax": "3.1.0", + "ember-ajax": "3.1.1", "ember-assign-helper": "0.1.2", "ember-browserify": "1.2.2", "ember-cli": "3.1.4", diff --git a/ghost/admin/yarn.lock b/ghost/admin/yarn.lock index 25dc9545d8..b8d0c38e37 100644 --- a/ghost/admin/yarn.lock +++ b/ghost/admin/yarn.lock @@ -737,6 +737,12 @@ babel-plugin-ember-modules-api-polyfill@^2.3.0, babel-plugin-ember-modules-api-p dependencies: ember-rfc176-data "^0.3.0" +babel-plugin-ember-modules-api-polyfill@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-2.5.0.tgz#860aab9fecbf38c10d1fe0779c6979a854fff154" + dependencies: + ember-rfc176-data "^0.3.5" + babel-plugin-eval@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz#a2faed25ce6be69ade4bfec263f70169195950da" @@ -1363,6 +1369,21 @@ broccoli-babel-transpiler@^6.0.0, broccoli-babel-transpiler@^6.1.2, broccoli-bab rsvp "^4.8.2" workerpool "^2.3.0" +broccoli-babel-transpiler@^6.5.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/broccoli-babel-transpiler/-/broccoli-babel-transpiler-6.5.0.tgz#aa501a227b298a99742fdd0309b1eaad7124bba0" + dependencies: + babel-core "^6.26.0" + broccoli-funnel "^2.0.1" + broccoli-merge-trees "^2.0.0" + broccoli-persistent-filter "^1.4.3" + clone "^2.0.0" + hash-for-dep "^1.2.3" + heimdalljs-logger "^0.1.7" + json-stable-stringify "^1.0.0" + rsvp "^4.8.2" + workerpool "^2.3.0" + broccoli-builder@^0.18.8: version "0.18.14" resolved "https://registry.yarnpkg.com/broccoli-builder/-/broccoli-builder-0.18.14.tgz#4b79e2f844de11a4e1b816c3f49c6df4776c312d" @@ -3232,11 +3253,12 @@ elliptic@^6.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" -ember-ajax@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ember-ajax/-/ember-ajax-3.1.0.tgz#3db36e67357ef447639517656aeac4bb13e73a9c" +ember-ajax@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/ember-ajax/-/ember-ajax-3.1.1.tgz#dcb55aaf1a9fe8b2ce04206863384709ebc2358b" dependencies: - ember-cli-babel "^6.6.0" + ember-cli-babel "^6.16.0" + najax "^1.0.3" ember-assign-helper@0.1.2: version "0.1.2" @@ -3360,6 +3382,24 @@ ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-be ember-cli-version-checker "^2.1.2" semver "^5.5.0" +ember-cli-babel@^6.16.0: + version "6.17.2" + resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.17.2.tgz#f0d53d2fb95e70c15d8db84760d045f88f458f69" + dependencies: + amd-name-resolver "1.2.0" + babel-plugin-debug-macros "^0.2.0-beta.6" + babel-plugin-ember-modules-api-polyfill "^2.5.0" + babel-plugin-transform-es2015-modules-amd "^6.24.0" + babel-polyfill "^6.26.0" + babel-preset-env "^1.7.0" + broccoli-babel-transpiler "^6.5.0" + broccoli-debug "^0.6.4" + broccoli-funnel "^2.0.0" + broccoli-source "^1.1.0" + clone "^2.0.0" + ember-cli-version-checker "^2.1.2" + semver "^5.5.0" + ember-cli-broccoli-sane-watcher@^2.0.4: version "2.1.1" resolved "https://registry.yarnpkg.com/ember-cli-broccoli-sane-watcher/-/ember-cli-broccoli-sane-watcher-2.1.1.tgz#1687adada9022de26053fba833dc7dd10f03dd08" @@ -4120,6 +4160,10 @@ ember-rfc176-data@^0.3.0, ember-rfc176-data@^0.3.1, ember-rfc176-data@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.3.tgz#27fba08d540a7463a4366c48eaa19c5a44971a39" +ember-rfc176-data@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.5.tgz#f630e550572c81a5e5c7220f864c0f06eee9e977" + ember-route-action-helper@2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/ember-route-action-helper/-/ember-route-action-helper-2.0.6.tgz#1d50454350d7112be326ab44058f06cf291d5fd9" @@ -6259,6 +6303,10 @@ jade@0.26.3: commander "0.6.1" mkdirp "0.3.0" +jquery-deferred@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/jquery-deferred/-/jquery-deferred-0.3.1.tgz#596eca1caaff54f61b110962b23cafea74c35355" + jquery@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" @@ -7472,6 +7520,14 @@ mv@~2: ncp "~2.0.0" rimraf "~2.4.0" +najax@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/najax/-/najax-1.0.4.tgz#63fd8dbf15d18f24dc895b3a16fec66c136b8084" + dependencies: + jquery-deferred "^0.3.0" + lodash.defaultsdeep "^4.6.0" + qs "^6.2.0" + nan@^2.10.0, nan@^2.9.2: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" @@ -8538,7 +8594,7 @@ qs@6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" -qs@6.5.2, qs@^6.4.0, qs@~6.5.1: +qs@6.5.2, qs@^6.2.0, qs@^6.4.0, qs@~6.5.1: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"