@duely/client
Advanced tools
Comparing version 0.0.40 to 0.0.41
@@ -36,3 +36,3 @@ "use strict"; | ||
function _templateObject10() { | ||
var data = _taggedTemplateLiteral(["\n mutation($service_id: ID!) {\n delete_service(service_id: $service_id) {\n success\n message\n service {\n ...service_F\n }\n }\n }\n ", "\n "]); | ||
var data = _taggedTemplateLiteral(["\n mutation($service_id: ID!) {\n delete_service(service_id: $service_id) {\n success\n message\n service {\n id\n }\n }\n }\n ", "\n "]); | ||
@@ -150,3 +150,3 @@ _templateObject10 = function _templateObject10() { | ||
function _mutate() { | ||
_mutate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(mutationDef, variables) { | ||
_mutate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(mutationDef, variables) { | ||
var result, | ||
@@ -162,7 +162,7 @@ after, | ||
res, | ||
_args3 = arguments; | ||
_args4 = arguments; | ||
return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
return regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
@@ -172,7 +172,7 @@ result = mutationDef.result, after = mutationDef.after, defaultVariables = mutationDef.variables, defaultOptions = _objectWithoutProperties(mutationDef, ["result", "after", "variables"]); | ||
for (_len = _args3.length, options = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
options[_key - 2] = _args3[_key]; | ||
for (_len = _args4.length, options = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
options[_key - 2] = _args4[_key]; | ||
} | ||
_context3.next = 5; | ||
_context4.next = 5; | ||
return _client2.client.mutate(_objectSpread(_objectSpread({ | ||
@@ -183,3 +183,3 @@ variables: variables | ||
case 5: | ||
_yield$client$mutate = _context3.sent; | ||
_yield$client$mutate = _context4.sent; | ||
data = _yield$client$mutate.data; | ||
@@ -189,18 +189,18 @@ res = result(data); | ||
if (!after) { | ||
_context3.next = 11; | ||
_context4.next = 11; | ||
break; | ||
} | ||
_context3.next = 11; | ||
_context4.next = 11; | ||
return after(_client2.client.cache, res, variables); | ||
case 11: | ||
return _context3.abrupt("return", res); | ||
return _context4.abrupt("return", res); | ||
case 12: | ||
case "end": | ||
return _context3.stop(); | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
}, _callee4); | ||
})); | ||
@@ -335,2 +335,31 @@ return _mutate.apply(this, arguments); | ||
return d === null || d === void 0 ? void 0 : d.delete_service; | ||
}, | ||
after: function after(cache, result) { | ||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { | ||
var id; | ||
return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
if (result.success) { | ||
_context3.next = 2; | ||
break; | ||
} | ||
return _context3.abrupt("return"); | ||
case 2: | ||
id = result.service.id; | ||
cache.evict({ | ||
id: id | ||
}); | ||
cache.gc(); | ||
case 5: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
}))(); | ||
} | ||
@@ -359,10 +388,2 @@ }; | ||
// result: d => d?.createClient, | ||
// after(client, result, { agencyUuid }) { | ||
// if (!result.success) return; | ||
// const query = queries.clients.query; | ||
// const data = produce(client.readQuery({ query, variables: { agencyUuid } }), data => { | ||
// data.agency.clientsConnection.edges.push(result.client); | ||
// }); | ||
// client.writeQuery({ query, data }); | ||
// } | ||
// }, | ||
@@ -369,0 +390,0 @@ // deleteClient: { |
{ | ||
"name": "@duely/client", | ||
"type": "module", | ||
"version": "0.0.40", | ||
"version": "0.0.41", | ||
"repository": "github:uoleevi/duely", | ||
@@ -6,0 +6,0 @@ "description": "GraphQL client by Duely (wrapper for @apollo/client)", |
@@ -136,3 +136,3 @@ import { gql } from '@apollo/client'; | ||
result: d => d?.create_agency | ||
} | ||
}; | ||
@@ -155,3 +155,3 @@ export const create_service_M = { | ||
result: d => d?.create_service | ||
} | ||
}; | ||
@@ -172,3 +172,3 @@ export const update_service_M = { | ||
result: d => d?.update_service | ||
} | ||
}; | ||
@@ -182,3 +182,3 @@ export const delete_service_M = { | ||
service { | ||
...service_F | ||
id | ||
} | ||
@@ -189,5 +189,12 @@ } | ||
`, | ||
result: d => d?.delete_service | ||
} | ||
result: d => d?.delete_service, | ||
async after(cache, result) { | ||
if (!result.success) return; | ||
const { id } = result.service; | ||
cache.evict({ id }); | ||
cache.gc(); | ||
} | ||
}; | ||
export const create_price_M = { | ||
@@ -212,3 +219,3 @@ mutation: gql` | ||
result: d => d?.create_price | ||
} | ||
}; | ||
@@ -230,10 +237,2 @@ // createClient: { | ||
// result: d => d?.createClient, | ||
// after(client, result, { agencyUuid }) { | ||
// if (!result.success) return; | ||
// const query = queries.clients.query; | ||
// const data = produce(client.readQuery({ query, variables: { agencyUuid } }), data => { | ||
// data.agency.clientsConnection.edges.push(result.client); | ||
// }); | ||
// client.writeQuery({ query, data }); | ||
// } | ||
// }, | ||
@@ -240,0 +239,0 @@ // deleteClient: { |
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
160624
2968