sanity-plugin-migration
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -18,2 +18,4 @@ "use strict"; | ||
var _clientConfig = require("../helpers/clientConfig"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -37,10 +39,9 @@ | ||
var apiVersion = "2021-05-19"; | ||
var originClient = _client.default.withConfig(_clientConfig.clientConfig); // const localStorageKey = [ | ||
// `migrationQuery`, | ||
// originClient.config().projectId, | ||
// originClient.config().dataset, | ||
// ].join(`-`) | ||
var originClient = _client.default.withConfig({ | ||
apiVersion | ||
}); | ||
var localStorageKey = ["migrationQuery", originClient.config().projectId, originClient.config().dataset].join("-"); | ||
function MigrationQuery(props) { | ||
@@ -47,0 +48,0 @@ var token = props.token; |
@@ -40,3 +40,3 @@ "use strict"; | ||
var _config$__experimenta; | ||
var _clientConfig = require("../helpers/clientConfig"); | ||
@@ -71,22 +71,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// Prepare origin (this Studio) client | ||
var clientConfig = { | ||
apiVersion: "2021-05-19" | ||
}; | ||
function MigrationTool(props) { | ||
var _config$__experimenta, _spacesOptions$find, _spacesOptions$find2, _message$tone; | ||
var originClient = _client.default.withConfig(clientConfig); // Create list of dataset options | ||
// and set initial value of dropdown | ||
var docs = props.docs, | ||
token = props.token; // Prepare origin (this Studio) client | ||
// In function-scope so it is up to date on every render | ||
var originClient = _client.default.withConfig(_clientConfig.clientConfig); // Create list of dataset options | ||
// and set initial value of dropdown | ||
var spacesOptions = _configSanity.default !== null && _configSanity.default !== void 0 && (_config$__experimenta = _configSanity.default.__experimental_spaces) !== null && _config$__experimenta !== void 0 && _config$__experimenta.length ? _configSanity.default.__experimental_spaces.map(space => _objectSpread(_objectSpread({}, space), {}, { | ||
disabled: space.name === originClient.clientConfig.dataset | ||
})) : []; | ||
function MigrationTool(props) { | ||
var _spacesOptions$find, _spacesOptions$find2, _message$tone; | ||
var spacesOptions = _configSanity.default !== null && _configSanity.default !== void 0 && (_config$__experimenta = _configSanity.default.__experimental_spaces) !== null && _config$__experimenta !== void 0 && _config$__experimenta.length ? _configSanity.default.__experimental_spaces.map(space => _objectSpread(_objectSpread({}, space), {}, { | ||
disabled: space.name === originClient.clientConfig.dataset | ||
})) : []; | ||
var docs = props.docs, | ||
token = props.token; | ||
var _useState = (0, _react.useState)(spacesOptions.length ? (_spacesOptions$find = spacesOptions.find(space => space.disabled)) === null || _spacesOptions$find === void 0 ? void 0 : _spacesOptions$find.name : ""), | ||
var _useState = (0, _react.useState)(spacesOptions.length ? (_spacesOptions$find = spacesOptions.find(space => !space.disabled)) === null || _spacesOptions$find === void 0 ? void 0 : _spacesOptions$find.name : ""), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
@@ -178,3 +174,3 @@ destinationValue = _useState2[0], | ||
var destinationClient = _client.default.withConfig(_objectSpread(_objectSpread({}, clientConfig), {}, { | ||
var destinationClient = _client.default.withConfig(_objectSpread(_objectSpread({}, _clientConfig.clientConfig), {}, { | ||
dataset: destinationValue | ||
@@ -267,5 +263,6 @@ })); | ||
var destinationClient = _client.default.withConfig(clientConfig); | ||
var destinationClient = _client.default.withConfig(_objectSpread(_objectSpread({}, _clientConfig.clientConfig), {}, { | ||
dataset: destinationValue | ||
})); | ||
destinationClient.clientConfig.dataset = destinationValue; | ||
var transactionDocs = []; | ||
@@ -370,3 +367,3 @@ var svgMaps = []; // Upload assets and then add to transaction | ||
}); | ||
yield transaction.commit().then(() => { | ||
yield transaction.commit().then(res => { | ||
setMessage({ | ||
@@ -395,3 +392,3 @@ tone: 'positive', | ||
tone: "critical" | ||
}, "No Spaces found in ", /*#__PURE__*/_react.default.createElement("code", null, "sanity.json")); | ||
}, /*#__PURE__*/_react.default.createElement("code", null, "__experimental_spaces"), " not found in ", /*#__PURE__*/_react.default.createElement("code", null, "sanity.json")); | ||
} | ||
@@ -398,0 +395,0 @@ |
@@ -14,10 +14,8 @@ "use strict"; | ||
var _clientConfig = require("../helpers/clientConfig"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var apiVersion = "2021-05-19"; | ||
var client = _client.default.withConfig(_clientConfig.clientConfig); | ||
var client = _client.default.withConfig({ | ||
apiVersion | ||
}); | ||
function ResetSecret() { | ||
@@ -24,0 +22,0 @@ function handleClick() { |
{ | ||
"name": "sanity-plugin-migration", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Empower content editors to migrate Documents and Assets between Sanity Datasets from inside Sanity Studio", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158990
52
1921