batch.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. "use strict";
  2. const Parse = require('parse/node').Parse;
  3. const path = require('path');
  4. // These methods handle batch requests.
  5. const batchPath = '/batch';
  6. // Mounts a batch-handler onto a PromiseRouter.
  7. function mountOnto(router) {
  8. router.route('POST', batchPath, req => {
  9. return handleBatch(router, req);
  10. });
  11. }
  12. function parseURL(urlString) {
  13. try {
  14. return new URL(urlString);
  15. } catch (error) {
  16. return undefined;
  17. }
  18. }
  19. function makeBatchRoutingPathFunction(originalUrl, serverURL, publicServerURL) {
  20. serverURL = serverURL ? parseURL(serverURL) : undefined;
  21. publicServerURL = publicServerURL ? parseURL(publicServerURL) : undefined;
  22. const apiPrefixLength = originalUrl.length - batchPath.length;
  23. let apiPrefix = originalUrl.slice(0, apiPrefixLength);
  24. const makeRoutablePath = function (requestPath) {
  25. // The routablePath is the path minus the api prefix
  26. if (requestPath.slice(0, apiPrefix.length) != apiPrefix) {
  27. throw new Parse.Error(Parse.Error.INVALID_JSON, 'cannot route batch path ' + requestPath);
  28. }
  29. return path.posix.join('/', requestPath.slice(apiPrefix.length));
  30. };
  31. if (serverURL && publicServerURL && serverURL.pathname != publicServerURL.pathname) {
  32. const localPath = serverURL.pathname;
  33. const publicPath = publicServerURL.pathname;
  34. // Override the api prefix
  35. apiPrefix = localPath;
  36. return function (requestPath) {
  37. // Figure out which server url was used by figuring out which
  38. // path more closely matches requestPath
  39. const startsWithLocal = requestPath.startsWith(localPath);
  40. const startsWithPublic = requestPath.startsWith(publicPath);
  41. const pathLengthToUse = startsWithLocal && startsWithPublic ? Math.max(localPath.length, publicPath.length) : startsWithLocal ? localPath.length : publicPath.length;
  42. const newPath = path.posix.join('/', localPath, '/', requestPath.slice(pathLengthToUse));
  43. // Use the method for local routing
  44. return makeRoutablePath(newPath);
  45. };
  46. }
  47. return makeRoutablePath;
  48. }
  49. // Returns a promise for a {response} object.
  50. // TODO: pass along auth correctly
  51. function handleBatch(router, req) {
  52. if (!Array.isArray(req.body.requests)) {
  53. throw new Parse.Error(Parse.Error.INVALID_JSON, 'requests must be an array');
  54. }
  55. // The batch paths are all from the root of our domain.
  56. // That means they include the API prefix, that the API is mounted
  57. // to. However, our promise router does not route the api prefix. So
  58. // we need to figure out the API prefix, so that we can strip it
  59. // from all the subrequests.
  60. if (!req.originalUrl.endsWith(batchPath)) {
  61. throw 'internal routing problem - expected url to end with batch';
  62. }
  63. const makeRoutablePath = makeBatchRoutingPathFunction(req.originalUrl, req.config.serverURL, req.config.publicServerURL);
  64. const batch = transactionRetries => {
  65. let initialPromise = Promise.resolve();
  66. if (req.body.transaction === true) {
  67. initialPromise = req.config.database.createTransactionalSession();
  68. }
  69. return initialPromise.then(() => {
  70. const promises = req.body.requests.map(restRequest => {
  71. const routablePath = makeRoutablePath(restRequest.path);
  72. // Construct a request that we can send to a handler
  73. const request = {
  74. body: restRequest.body,
  75. config: req.config,
  76. auth: req.auth,
  77. info: req.info
  78. };
  79. return router.tryRouteRequest(restRequest.method, routablePath, request).then(response => {
  80. return {
  81. success: response.response
  82. };
  83. }, error => {
  84. return {
  85. error: {
  86. code: error.code,
  87. error: error.message
  88. }
  89. };
  90. });
  91. });
  92. return Promise.all(promises).then(results => {
  93. if (req.body.transaction === true) {
  94. if (results.find(result => typeof result.error === 'object')) {
  95. return req.config.database.abortTransactionalSession().then(() => {
  96. return Promise.reject({
  97. response: results
  98. });
  99. });
  100. } else {
  101. return req.config.database.commitTransactionalSession().then(() => {
  102. return {
  103. response: results
  104. };
  105. });
  106. }
  107. } else {
  108. return {
  109. response: results
  110. };
  111. }
  112. }).catch(error => {
  113. if (error && error.response && error.response.find(errorItem => typeof errorItem.error === 'object' && errorItem.error.code === 251) && transactionRetries > 0) {
  114. return batch(transactionRetries - 1);
  115. }
  116. throw error;
  117. });
  118. });
  119. };
  120. return batch(5);
  121. }
  122. module.exports = {
  123. mountOnto,
  124. makeBatchRoutingPathFunction
  125. };
  126. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJQYXJzZSIsInJlcXVpcmUiLCJwYXRoIiwiYmF0Y2hQYXRoIiwibW91bnRPbnRvIiwicm91dGVyIiwicm91dGUiLCJyZXEiLCJoYW5kbGVCYXRjaCIsInBhcnNlVVJMIiwidXJsU3RyaW5nIiwiVVJMIiwiZXJyb3IiLCJ1bmRlZmluZWQiLCJtYWtlQmF0Y2hSb3V0aW5nUGF0aEZ1bmN0aW9uIiwib3JpZ2luYWxVcmwiLCJzZXJ2ZXJVUkwiLCJwdWJsaWNTZXJ2ZXJVUkwiLCJhcGlQcmVmaXhMZW5ndGgiLCJsZW5ndGgiLCJhcGlQcmVmaXgiLCJzbGljZSIsIm1ha2VSb3V0YWJsZVBhdGgiLCJyZXF1ZXN0UGF0aCIsIkVycm9yIiwiSU5WQUxJRF9KU09OIiwicG9zaXgiLCJqb2luIiwicGF0aG5hbWUiLCJsb2NhbFBhdGgiLCJwdWJsaWNQYXRoIiwic3RhcnRzV2l0aExvY2FsIiwic3RhcnRzV2l0aCIsInN0YXJ0c1dpdGhQdWJsaWMiLCJwYXRoTGVuZ3RoVG9Vc2UiLCJNYXRoIiwibWF4IiwibmV3UGF0aCIsIkFycmF5IiwiaXNBcnJheSIsImJvZHkiLCJyZXF1ZXN0cyIsImVuZHNXaXRoIiwiY29uZmlnIiwiYmF0Y2giLCJ0cmFuc2FjdGlvblJldHJpZXMiLCJpbml0aWFsUHJvbWlzZSIsIlByb21pc2UiLCJyZXNvbHZlIiwidHJhbnNhY3Rpb24iLCJkYXRhYmFzZSIsImNyZWF0ZVRyYW5zYWN0aW9uYWxTZXNzaW9uIiwidGhlbiIsInByb21pc2VzIiwibWFwIiwicmVzdFJlcXVlc3QiLCJyb3V0YWJsZVBhdGgiLCJyZXF1ZXN0IiwiYXV0aCIsImluZm8iL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Vycm9yOiB7IGNvZGU6IGVycm9yLmNvZGUsIGVycm9yOiBlcnJvci5tZXNzYWdlIH0gfTtcbiAgICAgICAgICB9XG4gICAgICAgICk7XG4gICAgICB9KTtcblxuICAgICAgcmV0dXJuIFByb21pc2UuYWxsKHByb21pc2VzKVxuICAgICAgICAudGhlbihyZXN1bHRzID0+IHtcbiAgICAgICAgICBpZiAocmVxLmJvZHkudHJhbnNhY3Rpb24gPT09IHRydWUpIHtcbiAgICAgICAgICAgIGlmIChyZXN1bHRzLmZpbmQocmVzdWx0ID0+IHR5cGVvZiByZXN1bHQuZXJyb3IgPT09ICdvYmplY3QnKSkge1xuICAgICAgICAgICAgICByZXR1cm4gcmVxLmNvbmZpZy5kYXRhYmFzZS5hYm9ydFRyYW5zYWN0aW9uYWxTZXNzaW9uKCkudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KHsgcmVzcG9uc2U6IHJlc3VsdHMgfSk7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHJlcS5jb25maWcuZGF0YWJhc2UuY29tbWl0VHJhbnNhY3Rpb25hbFNlc3Npb24oKS50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICByZXR1cm4geyByZXNwb25zZTogcmVzdWx0cyB9O1xuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHsgcmVzcG9uc2U6IHJlc3VsdHMgfTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pXG4gICAgICAgIC5jYXRjaChlcnJvciA9PiB7XG4gICAgICAgICAgaWYgKFxuICAgICAgICAgICAgZXJyb3IgJiZcbiAgICAgICAgICAgIGVycm9yLnJlc3BvbnNlICYmXG4gICAgICAgICAgICBlcnJvci5yZXNwb25zZS5maW5kKFxuICAgICAgICAgICAgICBlcnJ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