scrivito_sdk 1.7.0.rc1 → 1.7.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4c29ade58e6d8b19aec8c00f0828b7d40ce3d26
4
- data.tar.gz: 9fd5a9370feaff0841b16528816a0270d896b841
3
+ metadata.gz: 4016e97128a005af2e498a50cd196bd7b59f3b5e
4
+ data.tar.gz: e825b47033b48d098da446aa4f8af5a1cd23ae7f
5
5
  SHA512:
6
- metadata.gz: 8470f64b051cc0822b3d7fd60d99e1f70eedbd958d80933e99b7dc86a0d89e78de68811cb66baae1e9a66c56209c3a5bb3815954cea38356ccd641679731124f
7
- data.tar.gz: 72955c9b0731c2a24c8b264ffad9130309def34ead040f73669a6ee357c19b49ee02724f78ac29826884aa4507fe030d281492f418f1f51ae6cd1f55aa4f80a1
6
+ metadata.gz: bfca683f74cbb3cf1a50224c3eea444edb0a444de6672611485c402c7a50122c2dba0a04d089722f4882ccf167eb90d5a78addc3016d888cbb936deede95499d
7
+ data.tar.gz: a690ea5857589c751e1bd2bc9c4e7b006ed34b7a774edf90e6fb18fb460f3ada821eef9bff62cb9e88ef3008624daf8d55044165a2cfec0fd639495601d3b1d3
@@ -452,7 +452,7 @@ module ScrivitoHelper
452
452
  # cache. The options are passed to the +cache+ helper of Rails. See the Rails
453
453
  # {http://api.rubyonrails.org/classes/ActionView/Helpers/CacheHelper.html#method-i-cache documentation}
454
454
  # for details.
455
- def scrivito_cache(key, options=nil, &block)
455
+ def scrivito_cache(key, options={}, &block)
456
456
  workspace = Scrivito::Workspace.current
457
457
  cache_if(workspace.published? && !scrivito_user, [workspace.cache_key, key], options, &block)
458
458
  end
data/config/ca-bundle.crt CHANGED
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## Bundle of CA Root Certificates
3
3
  ##
4
- ## Certificate data from Mozilla as of: Mon Dec 5 10:56:44 2016 GMT
4
+ ## Certificate data from Mozilla as of: Tue Dec 27 15:46:13 2016 GMT
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -13628,7 +13628,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
13628
13628
  if (error.status === 403) {
13629
13629
  throw new scrivito.AccessDeniedError(specificOutput, error.status, errorBody.code);
13630
13630
  } else if (error.status.toString()[0] === '4' && specificOutput) {
13631
- throw new scrivito.ClientError(specificOutput, error.status, errorBody.code);
13631
+ throw scrivito.ClientError['for'](specificOutput, error.status, errorBody.code);
13632
13632
  } else if (error.status === 500 && specificOutput) {
13633
13633
  throw new scrivito.BackendError(specificOutput, error.status);
13634
13634
  }
@@ -13679,7 +13679,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
13679
13679
  case 'success':
13680
13680
  return task.result;
13681
13681
  case 'error':
13682
- throw new scrivito.ClientError(task.message, undefined, task.code);
13682
+ throw scrivito.ClientError['for'](task.message, 412, task.code);
13683
13683
  case 'open':
13684
13684
  return scrivito.wait(2).then(function () {
13685
13685
  return request('GET', 'tasks/' + task.id).then(function (result) {
@@ -13788,6 +13788,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
13788
13788
  function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
13789
13789
 
13790
13790
  (function () {
13791
+ var TRANSFORM_SOURCE_TYPE_INVALID = 'binary.unprocessable.image.transform.source.type_invalid';
13792
+ var TRANSFORM_SOURCE_TOO_LARGE = 'binary.unprocessable.image.transform.source.too_large';
13793
+
13791
13794
  // From https://phabricator.babeljs.io/T3083#65595
13792
13795
  function ExtendableError() {
13793
13796
  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
@@ -13805,7 +13808,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13805
13808
  ExtendableError.__proto__ = Error;
13806
13809
  }
13807
13810
 
13808
- scrivito.ScrivitoError = (function (_ExtendableError) {
13811
+ var ScrivitoError = (function (_ExtendableError) {
13809
13812
  _inherits(ScrivitoError, _ExtendableError);
13810
13813
 
13811
13814
  function ScrivitoError(message) {
@@ -13836,6 +13839,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13836
13839
  this.message = message;
13837
13840
  }
13838
13841
 
13842
+ /**
13843
+ * An error thrown in case a backend request fails due to an error caused by the client.
13844
+ */
13845
+
13839
13846
  _createClass(ScrivitoError, [{
13840
13847
  key: 'name',
13841
13848
  get: function get() {
@@ -13853,19 +13860,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13853
13860
  return ScrivitoError;
13854
13861
  })(ExtendableError);
13855
13862
 
13856
- /**
13857
- * An error thrown in case a backend request fails due to an error caused by the client.
13858
- */
13859
- scrivito.ClientError = (function (_scrivito$ScrivitoError) {
13860
- _inherits(ClientError, _scrivito$ScrivitoError);
13863
+ var ClientError = (function (_ScrivitoError) {
13864
+ _inherits(ClientError, _ScrivitoError);
13861
13865
 
13862
13866
  /**
13863
13867
  * The constructor is not part of the public API and should **not** be used.
13864
13868
  */
13865
13869
 
13866
13870
  function ClientError(message, httpCode, backendCode) {
13867
- if (httpCode === undefined) httpCode = 412;
13868
-
13869
13871
  _classCallCheck(this, ClientError);
13870
13872
 
13871
13873
  _get(Object.getPrototypeOf(ClientError.prototype), 'constructor', this).call(this, message);
@@ -13873,15 +13875,30 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13873
13875
  this.backendCode = backendCode;
13874
13876
  }
13875
13877
 
13878
+ /**
13879
+ * An error thrown in case a backend request from the UI
13880
+ * is denied access to a specific resource.
13881
+ */
13882
+
13883
+ _createClass(ClientError, null, [{
13884
+ key: 'for',
13885
+ value: function _for(message, httpCode, backendCode) {
13886
+ switch (backendCode) {
13887
+ case TRANSFORM_SOURCE_TYPE_INVALID:
13888
+ return new scrivito.TransformationSourceTypeInvalidError(message, httpCode, backendCode);
13889
+ case TRANSFORM_SOURCE_TOO_LARGE:
13890
+ return new scrivito.TransformationSourceTooLargeError(message, httpCode, backendCode);
13891
+ default:
13892
+ return new scrivito.ClientError(message, httpCode, backendCode);
13893
+ }
13894
+ }
13895
+ }]);
13896
+
13876
13897
  return ClientError;
13877
- })(scrivito.ScrivitoError);
13898
+ })(ScrivitoError);
13878
13899
 
13879
- /**
13880
- * An error thrown in case a backend request from the UI
13881
- * is denied access to a specific resource.
13882
- */
13883
- scrivito.AccessDeniedError = (function (_scrivito$ClientError) {
13884
- _inherits(AccessDeniedError, _scrivito$ClientError);
13900
+ var AccessDeniedError = (function (_ClientError) {
13901
+ _inherits(AccessDeniedError, _ClientError);
13885
13902
 
13886
13903
  /**
13887
13904
  * The constructor is not part of the public API and should **not** be used.
@@ -13893,14 +13910,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13893
13910
  _get(Object.getPrototypeOf(AccessDeniedError.prototype), 'constructor', this).call(this, message, httpCode, backendCode);
13894
13911
  }
13895
13912
 
13913
+ /**
13914
+ * An error thrown in case wrong arguments are passed to an SDK function.
13915
+ */
13896
13916
  return AccessDeniedError;
13897
- })(scrivito.ClientError);
13917
+ })(ClientError);
13898
13918
 
13899
- /**
13900
- * An error thrown in case wrong arguments are passed to an SDK function.
13901
- */
13902
- scrivito.ArgumentError = (function (_scrivito$ScrivitoError2) {
13903
- _inherits(ArgumentError, _scrivito$ScrivitoError2);
13919
+ var ArgumentError = (function (_ScrivitoError2) {
13920
+ _inherits(ArgumentError, _ScrivitoError2);
13904
13921
 
13905
13922
  /**
13906
13923
  * The constructor is not part of the public API and should **not** be used.
@@ -13913,10 +13930,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13913
13930
  }
13914
13931
 
13915
13932
  return ArgumentError;
13916
- })(scrivito.ScrivitoError);
13933
+ })(ScrivitoError);
13917
13934
 
13918
- scrivito.CommunicationError = (function (_scrivito$ScrivitoError3) {
13919
- _inherits(CommunicationError, _scrivito$ScrivitoError3);
13935
+ var CommunicationError = (function (_ScrivitoError3) {
13936
+ _inherits(CommunicationError, _ScrivitoError3);
13920
13937
 
13921
13938
  function CommunicationError(message, httpCode) {
13922
13939
  _classCallCheck(this, CommunicationError);
@@ -13925,15 +13942,15 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13925
13942
  this.httpCode = httpCode;
13926
13943
  }
13927
13944
 
13945
+ /**
13946
+ * An error thrown in case a backend request from the UI
13947
+ * fails due to an internal server error.
13948
+ */
13928
13949
  return CommunicationError;
13929
- })(scrivito.ScrivitoError);
13950
+ })(ScrivitoError);
13930
13951
 
13931
- /**
13932
- * An error thrown in case a backend request from the UI
13933
- * fails due to an internal server error.
13934
- */
13935
- scrivito.BackendError = (function (_scrivito$CommunicationError) {
13936
- _inherits(BackendError, _scrivito$CommunicationError);
13952
+ var BackendError = (function (_CommunicationError) {
13953
+ _inherits(BackendError, _CommunicationError);
13937
13954
 
13938
13955
  /**
13939
13956
  * The constructor is not part of the public API and should **not** be used.
@@ -13945,15 +13962,15 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13945
13962
  _get(Object.getPrototypeOf(BackendError.prototype), 'constructor', this).call(this, message, httpCode);
13946
13963
  }
13947
13964
 
13965
+ /**
13966
+ * This error is raised if scrivito detects an internal problem.
13967
+ * These errors should never occur when using the public API of the SDK.
13968
+ */
13948
13969
  return BackendError;
13949
- })(scrivito.CommunicationError);
13970
+ })(CommunicationError);
13950
13971
 
13951
- /**
13952
- * This error is raised if scrivito detects an internal problem.
13953
- * These errors should never occur when using the public API of the SDK.
13954
- */
13955
- scrivito.InternalError = (function (_scrivito$ScrivitoError4) {
13956
- _inherits(InternalError, _scrivito$ScrivitoError4);
13972
+ var InternalError = (function (_ScrivitoError4) {
13973
+ _inherits(InternalError, _ScrivitoError4);
13957
13974
 
13958
13975
  /**
13959
13976
  * The constructor is not part of the public API and should **not** be used.
@@ -13965,15 +13982,15 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13965
13982
  _get(Object.getPrototypeOf(InternalError.prototype), 'constructor', this).call(this, message);
13966
13983
  }
13967
13984
 
13985
+ /**
13986
+ * An error thrown in case a backend request from the UI
13987
+ * fails due to network problems.
13988
+ */
13968
13989
  return InternalError;
13969
- })(scrivito.ScrivitoError);
13990
+ })(ScrivitoError);
13970
13991
 
13971
- /**
13972
- * An error thrown in case a backend request from the UI
13973
- * fails due to network problems.
13974
- */
13975
- scrivito.NetworkError = (function (_scrivito$CommunicationError2) {
13976
- _inherits(NetworkError, _scrivito$CommunicationError2);
13992
+ var NetworkError = (function (_CommunicationError2) {
13993
+ _inherits(NetworkError, _CommunicationError2);
13977
13994
 
13978
13995
  /**
13979
13996
  * The constructor is not part of the public API and should **not** be used.
@@ -13985,15 +14002,15 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
13985
14002
  _get(Object.getPrototypeOf(NetworkError.prototype), 'constructor', this).call(this, message, httpCode);
13986
14003
  }
13987
14004
 
14005
+ /**
14006
+ * An error thrown in case a backend request from the UI
14007
+ * exceeds the rate limit of the backend.
14008
+ */
13988
14009
  return NetworkError;
13989
- })(scrivito.CommunicationError);
14010
+ })(CommunicationError);
13990
14011
 
13991
- /**
13992
- * An error thrown in case a backend request from the UI
13993
- * exceeds the rate limit of the backend.
13994
- */
13995
- scrivito.RateLimitExceededError = (function (_scrivito$CommunicationError3) {
13996
- _inherits(RateLimitExceededError, _scrivito$CommunicationError3);
14012
+ var RateLimitExceededError = (function (_CommunicationError3) {
14013
+ _inherits(RateLimitExceededError, _CommunicationError3);
13997
14014
 
13998
14015
  /**
13999
14016
  * The constructor is not part of the public API and should **not** be used.
@@ -14005,14 +14022,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
14005
14022
  _get(Object.getPrototypeOf(RateLimitExceededError.prototype), 'constructor', this).call(this, message, httpCode);
14006
14023
  }
14007
14024
 
14025
+ /**
14026
+ * An error thrown in case a given Scrivito resource is not found.
14027
+ */
14008
14028
  return RateLimitExceededError;
14009
- })(scrivito.CommunicationError);
14029
+ })(CommunicationError);
14010
14030
 
14011
- /**
14012
- * An error thrown in case a given Scrivito resource is not found.
14013
- */
14014
- scrivito.ResourceNotFoundError = (function (_scrivito$ScrivitoError5) {
14015
- _inherits(ResourceNotFoundError, _scrivito$ScrivitoError5);
14031
+ var ResourceNotFoundError = (function (_ScrivitoError5) {
14032
+ _inherits(ResourceNotFoundError, _ScrivitoError5);
14016
14033
 
14017
14034
  /**
14018
14035
  * The constructor is not part of the public API and should **not** be used.
@@ -14024,14 +14041,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
14024
14041
  _get(Object.getPrototypeOf(ResourceNotFoundError.prototype), 'constructor', this).call(this, message);
14025
14042
  }
14026
14043
 
14044
+ /**
14045
+ * An error thrown in case a backend request from the UI is denied access.
14046
+ */
14027
14047
  return ResourceNotFoundError;
14028
- })(scrivito.ScrivitoError);
14048
+ })(ScrivitoError);
14029
14049
 
14030
- /**
14031
- * An error thrown in case a backend request from the UI is denied access.
14032
- */
14033
- scrivito.UnauthorizedError = (function (_scrivito$ClientError2) {
14034
- _inherits(UnauthorizedError, _scrivito$ClientError2);
14050
+ var UnauthorizedError = (function (_ClientError2) {
14051
+ _inherits(UnauthorizedError, _ClientError2);
14035
14052
 
14036
14053
  /**
14037
14054
  * The constructor is not part of the public API and should **not** be used.
@@ -14043,11 +14060,54 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
14043
14060
  _get(Object.getPrototypeOf(UnauthorizedError.prototype), 'constructor', this).call(this, message, httpCode, backendCode);
14044
14061
  }
14045
14062
 
14063
+ /**
14064
+ * An error thrown in case an image to be transformed is of an invalid type.
14065
+ *
14066
+ * Supported types are `jpg`, `png`, and `gif`. In addition, `svg` files are
14067
+ * returned untransformed.
14068
+ */
14046
14069
  return UnauthorizedError;
14047
- })(scrivito.ClientError);
14070
+ })(ClientError);
14071
+
14072
+ var TransformationSourceTypeInvalidError = (function (_ClientError3) {
14073
+ _inherits(TransformationSourceTypeInvalidError, _ClientError3);
14074
+
14075
+ /**
14076
+ * The constructor is not part of the public API and should **not** be used.
14077
+ */
14048
14078
 
14049
- scrivito.TranslationError = (function (_scrivito$InternalError) {
14050
- _inherits(TranslationError, _scrivito$InternalError);
14079
+ function TransformationSourceTypeInvalidError(message, httpCode, backendCode) {
14080
+ _classCallCheck(this, TransformationSourceTypeInvalidError);
14081
+
14082
+ _get(Object.getPrototypeOf(TransformationSourceTypeInvalidError.prototype), 'constructor', this).call(this, message, httpCode, backendCode);
14083
+ }
14084
+
14085
+ /**
14086
+ * An error thrown in case an image to be transformed is too large.
14087
+ *
14088
+ * Images up to 8MB in size are supported for transformation.
14089
+ */
14090
+ return TransformationSourceTypeInvalidError;
14091
+ })(ClientError);
14092
+
14093
+ var TransformationSourceTooLargeError = (function (_ClientError4) {
14094
+ _inherits(TransformationSourceTooLargeError, _ClientError4);
14095
+
14096
+ /**
14097
+ * The constructor is not part of the public API and should **not** be used.
14098
+ */
14099
+
14100
+ function TransformationSourceTooLargeError(message, httpCode, backendCode) {
14101
+ _classCallCheck(this, TransformationSourceTooLargeError);
14102
+
14103
+ _get(Object.getPrototypeOf(TransformationSourceTooLargeError.prototype), 'constructor', this).call(this, message, httpCode, backendCode);
14104
+ }
14105
+
14106
+ return TransformationSourceTooLargeError;
14107
+ })(ClientError);
14108
+
14109
+ var TranslationError = (function (_InternalError) {
14110
+ _inherits(TranslationError, _InternalError);
14051
14111
 
14052
14112
  function TranslationError(message) {
14053
14113
  _classCallCheck(this, TranslationError);
@@ -14056,10 +14116,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
14056
14116
  }
14057
14117
 
14058
14118
  return TranslationError;
14059
- })(scrivito.InternalError);
14119
+ })(InternalError);
14060
14120
 
14061
- scrivito.InterpolationError = (function (_scrivito$TranslationError) {
14062
- _inherits(InterpolationError, _scrivito$TranslationError);
14121
+ var InterpolationError = (function (_TranslationError) {
14122
+ _inherits(InterpolationError, _TranslationError);
14063
14123
 
14064
14124
  function InterpolationError(message) {
14065
14125
  _classCallCheck(this, InterpolationError);
@@ -14068,7 +14128,25 @@ function _inherits(subClass, superClass) { if (typeof superClass !== 'function'
14068
14128
  }
14069
14129
 
14070
14130
  return InterpolationError;
14071
- })(scrivito.TranslationError);
14131
+ })(TranslationError);
14132
+
14133
+ scrivito.ScrivitoError = ScrivitoError;
14134
+ scrivito.ClientError = ClientError;
14135
+ scrivito.AccessDeniedError = AccessDeniedError;
14136
+ scrivito.ArgumentError = ArgumentError;
14137
+ scrivito.CommunicationError = CommunicationError;
14138
+ scrivito.BackendError = BackendError;
14139
+ scrivito.InternalError = InternalError;
14140
+ scrivito.NetworkError = NetworkError;
14141
+ scrivito.RateLimitExceededError = RateLimitExceededError;
14142
+ scrivito.ResourceNotFoundError = ResourceNotFoundError;
14143
+ scrivito.UnauthorizedError = UnauthorizedError;
14144
+
14145
+ scrivito.TransformationSourceTypeInvalidError = TransformationSourceTypeInvalidError;
14146
+ scrivito.TransformationSourceTooLargeError = TransformationSourceTooLargeError;
14147
+
14148
+ scrivito.TranslationError = TranslationError;
14149
+ scrivito.InterpolationError = InterpolationError;
14072
14150
  })();
14073
14151
  'use strict';
14074
14152
 
@@ -14195,7 +14273,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
14195
14273
  var request = new XMLHttpRequest();
14196
14274
 
14197
14275
  request.open(method === 'POST' ? 'POST' : 'PUT', url);
14198
- request.responseType = 'json';
14199
14276
  request.setRequestHeader('Content-type', 'application/json; charset=utf-8');
14200
14277
 
14201
14278
  if (token) {
@@ -14219,17 +14296,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
14219
14296
  connectionCounter -= 1;
14220
14297
 
14221
14298
  if (request.status >= 200 && request.status < 300) {
14222
- var responseJSON = request.response;
14299
+ try {
14300
+ return resolve(JSON.parse(request.responseText));
14301
+ } catch (error) {
14302
+ if (error instanceof SyntaxError) {
14303
+ return resolve(request.responseText);
14304
+ }
14223
14305
 
14224
- if (_.isString(responseJSON)) {
14225
- // We can't use #response here as IE11 does not handle it correctly
14226
- responseJSON = JSON.parse(request.responseText);
14306
+ throw error;
14227
14307
  }
14228
-
14229
- return resolve(responseJSON);
14230
14308
  }
14231
14309
 
14232
- return reject(request.response);
14310
+ return reject(request);
14233
14311
  }
14234
14312
 
14235
14313
  function onAjaxError(error, reject) {
@@ -17113,6 +17191,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
17113
17191
  * accessible hours or days after they have been generated.
17114
17192
  *
17115
17193
  * @throws {scrivito.NotLoadedError} If the URL is not yet loaded.
17194
+ * @throws {scrivito.TransformationSourceTypeInvalidError}
17195
+ * If the binary is the result of a transformation and of an invalid type.
17196
+ * @throws {scrivito.TransformationSourceTooLargeError}
17197
+ * If the binary is the result of a transformation and the file is too large.
17116
17198
  * @type {String}
17117
17199
  */
17118
17200
  }, {
@@ -16,7 +16,7 @@ module Scrivito
16
16
  end
17
17
 
18
18
  def as_json
19
- {message: message, backend_code: backend_code}
19
+ {message: message, backendCode: backend_code}
20
20
  end
21
21
  end
22
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0.rc1
4
+ version: 1.7.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2016-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable