jscrambler 6.0.1 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,29 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.intoObjectType = exports.query = exports.mutation = exports.type = undefined;
6
+ exports.intoObjectType = intoObjectType;
7
+ exports.mutation = mutation;
8
+ exports.query = query;
9
+ exports.type = type;
7
10
 
8
- var type = exports.type = function () {
9
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(client, name) {
11
+ var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
16
+
17
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
18
+
19
+ var typeCache = {};
20
+
21
+ function type(_x, _x2) {
22
+ return _type.apply(this, arguments);
23
+ }
24
+
25
+ function _type() {
26
+ _type = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(client, name) {
10
27
  var jscramblerVersion, query, res, __type;
11
28
 
12
29
  return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -15,7 +32,6 @@ var type = exports.type = function () {
15
32
  case 0:
16
33
  jscramblerVersion = client.options.jscramblerVersion;
17
34
 
18
-
19
35
  if (!typeCache[jscramblerVersion]) {
20
36
  typeCache[jscramblerVersion] = {};
21
37
  }
@@ -25,11 +41,11 @@ var type = exports.type = function () {
25
41
  break;
26
42
  }
27
43
 
28
- return _context.abrupt('return', typeCache[jscramblerVersion][name]);
44
+ return _context.abrupt("return", typeCache[jscramblerVersion][name]);
29
45
 
30
46
  case 4:
31
47
  query = {
32
- query: '\nquery getType($name: String!) {\n __type(name: $name) {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n}\n\nfragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n}\n\nfragment TypeRef on __Type {\n kind\n name\n inputFields {\n name\n type {\n name\n kind\n }\n }\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n}',
48
+ query: "\nquery getType($name: String!) {\n __type(name: $name) {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n}\n\nfragment InputValue on __InputValue {\n name\n description\n type { ...TypeRef }\n defaultValue\n}\n\nfragment TypeRef on __Type {\n kind\n name\n inputFields {\n name\n type {\n name\n kind\n }\n }\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n}",
33
49
  params: JSON.stringify({
34
50
  name: name
35
51
  })
@@ -40,27 +56,25 @@ var type = exports.type = function () {
40
56
  case 7:
41
57
  res = _context.sent;
42
58
  __type = res.data.__type;
43
-
44
-
45
59
  typeCache[jscramblerVersion][__type.name] = __type;
46
-
47
- return _context.abrupt('return', __type);
60
+ return _context.abrupt("return", __type);
48
61
 
49
62
  case 11:
50
- case 'end':
63
+ case "end":
51
64
  return _context.stop();
52
65
  }
53
66
  }
54
- }, _callee, this);
67
+ }, _callee);
55
68
  }));
69
+ return _type.apply(this, arguments);
70
+ }
56
71
 
57
- return function type(_x, _x2) {
58
- return _ref.apply(this, arguments);
59
- };
60
- }();
72
+ function mutation(_x3, _x4) {
73
+ return _mutation.apply(this, arguments);
74
+ }
61
75
 
62
- var mutation = exports.mutation = function () {
63
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(client, name) {
76
+ function _mutation() {
77
+ _mutation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(client, name) {
64
78
  var rootMutation, mutationType;
65
79
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
66
80
  while (1) {
@@ -74,23 +88,24 @@ var mutation = exports.mutation = function () {
74
88
  mutationType = rootMutation.fields.find(function (f) {
75
89
  return f.name === name;
76
90
  });
77
- return _context2.abrupt('return', mutationType);
91
+ return _context2.abrupt("return", mutationType);
78
92
 
79
93
  case 5:
80
- case 'end':
94
+ case "end":
81
95
  return _context2.stop();
82
96
  }
83
97
  }
84
- }, _callee2, this);
98
+ }, _callee2);
85
99
  }));
100
+ return _mutation.apply(this, arguments);
101
+ }
86
102
 
87
- return function mutation(_x3, _x4) {
88
- return _ref2.apply(this, arguments);
89
- };
90
- }();
103
+ function query(_x5, _x6) {
104
+ return _query.apply(this, arguments);
105
+ }
91
106
 
92
- var query = exports.query = function () {
93
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(client, name) {
107
+ function _query() {
108
+ _query = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(client, name) {
94
109
  var rootQuery, queryType;
95
110
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
96
111
  while (1) {
@@ -104,25 +119,24 @@ var query = exports.query = function () {
104
119
  queryType = rootQuery.fields.find(function (f) {
105
120
  return f.name === name;
106
121
  });
107
- return _context3.abrupt('return', queryType);
122
+ return _context3.abrupt("return", queryType);
108
123
 
109
124
  case 5:
110
- case 'end':
125
+ case "end":
111
126
  return _context3.stop();
112
127
  }
113
128
  }
114
- }, _callee3, this);
129
+ }, _callee3);
115
130
  }));
131
+ return _query.apply(this, arguments);
132
+ }
116
133
 
117
- return function query(_x5, _x6) {
118
- return _ref3.apply(this, arguments);
119
- };
120
- }();
121
-
122
- var intoObjectType = exports.intoObjectType = function () {
123
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(client, obj, name) {
124
- var _this = this;
134
+ function intoObjectType(_x7, _x8, _x9) {
135
+ return _intoObjectType.apply(this, arguments);
136
+ }
125
137
 
138
+ function _intoObjectType() {
139
+ _intoObjectType = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(client, obj, name) {
126
140
  var fields, finalObj, keys;
127
141
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
128
142
  while (1) {
@@ -136,8 +150,8 @@ var intoObjectType = exports.intoObjectType = function () {
136
150
  finalObj = {};
137
151
  keys = Object.keys(obj);
138
152
  _context5.next = 7;
139
- return Promise.all(keys.map(function () {
140
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(k) {
153
+ return Promise.all(keys.map( /*#__PURE__*/function () {
154
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(k) {
141
155
  var field;
142
156
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
143
157
  while (1) {
@@ -152,7 +166,7 @@ var intoObjectType = exports.intoObjectType = function () {
152
166
  break;
153
167
  }
154
168
 
155
- finalObj[k] = (0, _lodash2.default)(obj[k]);
169
+ finalObj[k] = (0, _lodash.default)(obj[k]);
156
170
 
157
171
  if (!(field.type.kind === 'OBJECT' && !!field.type.name)) {
158
172
  _context4.next = 8;
@@ -164,7 +178,7 @@ var intoObjectType = exports.intoObjectType = function () {
164
178
 
165
179
  case 6:
166
180
  finalObj[k] = _context4.sent;
167
- return _context4.abrupt('return');
181
+ return _context4.abrupt("return");
168
182
 
169
183
  case 8:
170
184
  if (!((field.type.kind === 'NON_NULL' || field.type.kind === 'LIST') && field.type.ofType.kind === 'OBJECT')) {
@@ -177,49 +191,35 @@ var intoObjectType = exports.intoObjectType = function () {
177
191
 
178
192
  case 11:
179
193
  finalObj[k] = _context4.sent;
180
- return _context4.abrupt('return');
194
+ return _context4.abrupt("return");
181
195
 
182
196
  case 13:
183
-
184
197
  if (field.type.name === 'String' && typeof finalObj[k] !== 'string') {
185
198
  finalObj[k] = JSON.stringify(finalObj[k]);
186
199
  }
187
200
 
188
201
  case 14:
189
- case 'end':
202
+ case "end":
190
203
  return _context4.stop();
191
204
  }
192
205
  }
193
- }, _callee4, _this);
206
+ }, _callee4);
194
207
  }));
195
208
 
196
209
  return function (_x10) {
197
- return _ref5.apply(this, arguments);
210
+ return _ref.apply(this, arguments);
198
211
  };
199
212
  }()));
200
213
 
201
214
  case 7:
202
- return _context5.abrupt('return', finalObj);
215
+ return _context5.abrupt("return", finalObj);
203
216
 
204
217
  case 8:
205
- case 'end':
218
+ case "end":
206
219
  return _context5.stop();
207
220
  }
208
221
  }
209
- }, _callee5, this);
222
+ }, _callee5);
210
223
  }));
211
-
212
- return function intoObjectType(_x7, _x8, _x9) {
213
- return _ref4.apply(this, arguments);
214
- };
215
- }();
216
-
217
- var _lodash = require('lodash.clonedeep');
218
-
219
- var _lodash2 = _interopRequireDefault(_lodash);
220
-
221
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
222
-
223
- function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
224
-
225
- var typeCache = {};
224
+ return _intoObjectType.apply(this, arguments);
225
+ }
package/dist/mutations.js CHANGED
@@ -1,79 +1,83 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
8
-
6
+ exports.addApplicationSource = addApplicationSource;
7
+ exports.applyTemplate = applyTemplate;
8
+ exports.cancelProtection = cancelProtection;
9
9
  exports.createApplication = createApplication;
10
+ exports.createApplicationProtection = createApplicationProtection;
11
+ exports.createApplicationProtections = createApplicationProtections;
12
+ exports.createTemplate = createTemplate;
10
13
  exports.duplicateApplication = duplicateApplication;
11
14
  exports.removeApplication = removeApplication;
12
15
  exports.removeProtection = removeProtection;
13
- exports.cancelProtection = cancelProtection;
14
- exports.updateApplication = updateApplication;
15
- exports.unlockApplication = unlockApplication;
16
- exports.addApplicationSource = addApplicationSource;
17
- exports.updateApplicationSource = updateApplicationSource;
18
16
  exports.removeSourceFromApplication = removeSourceFromApplication;
19
- exports.createTemplate = createTemplate;
20
17
  exports.removeTemplate = removeTemplate;
18
+ exports.unlockApplication = unlockApplication;
19
+ exports.updateApplication = updateApplication;
20
+ exports.updateApplicationSource = updateApplicationSource;
21
21
  exports.updateTemplate = updateTemplate;
22
- exports.createApplicationProtection = createApplicationProtection;
23
- exports.applyTemplate = applyTemplate;
24
22
 
25
- var _cleanupInputFields3 = require('./cleanup-input-fields');
26
-
27
- var _cleanupInputFields4 = _interopRequireDefault(_cleanupInputFields3);
23
+ var _cleanupInputFields3 = _interopRequireDefault(require("./cleanup-input-fields"));
28
24
 
29
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
26
 
31
- var createApplicationDefaultFragments = '\n _id,\n createdAt,\n name\n';
27
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
28
+
29
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
30
+
31
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
32
+
33
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
34
+
35
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
36
+
37
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
38
+
39
+ var createApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
32
40
 
33
41
  function createApplication(data) {
34
42
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createApplicationDefaultFragments;
35
-
36
43
  return {
37
- query: '\n mutation createApplication ($data: ApplicationCreate!) {\n createApplication(data: $data) {\n ' + fragments + '\n }\n }\n ',
44
+ query: "\n mutation createApplication ($data: ApplicationCreate!) {\n createApplication(data: $data) {\n ".concat(fragments, "\n }\n }\n "),
38
45
  params: {
39
46
  data: data
40
47
  }
41
48
  };
42
49
  }
43
50
 
44
- var duplicateApplicationDefaultFragments = '\n _id\n';
51
+ var duplicateApplicationDefaultFragments = "\n _id\n";
45
52
 
46
53
  function duplicateApplication(id) {
47
54
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : duplicateApplicationDefaultFragments;
48
-
49
55
  return {
50
- query: '\n mutation duplicateApplication ($_id: String!) {\n duplicateApplication (_id: $_id) {\n ' + fragments + '\n }\n }\n ',
56
+ query: "\n mutation duplicateApplication ($_id: String!) {\n duplicateApplication (_id: $_id) {\n ".concat(fragments, "\n }\n }\n "),
51
57
  params: {
52
58
  _id: id
53
59
  }
54
60
  };
55
61
  }
56
62
 
57
- var removeApplicationDefaultFragments = '\n _id\n';
63
+ var removeApplicationDefaultFragments = "\n _id\n";
58
64
 
59
65
  function removeApplication(id) {
60
66
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : removeApplicationDefaultFragments;
61
-
62
67
  return {
63
- query: '\n mutation removeApplication ($_id: String!) {\n removeApplication (_id: $_id) {\n ' + fragments + '\n }\n }\n ',
68
+ query: "\n mutation removeApplication ($_id: String!) {\n removeApplication (_id: $_id) {\n ".concat(fragments, "\n }\n }\n "),
64
69
  params: {
65
70
  _id: id
66
71
  }
67
72
  };
68
73
  }
69
74
 
70
- var removeProtectionDefaultFragments = '\n _id\n';
75
+ var removeProtectionDefaultFragments = "\n _id\n";
71
76
 
72
77
  function removeProtection(id, appId) {
73
78
  var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : removeProtectionDefaultFragments;
74
-
75
79
  return {
76
- query: '\n mutation removeProtection ($_id: String!, $applicationId: String!) {\n removeProtection (_id: $_id, applicationId: $applicationId) {\n ' + fragments + '\n }\n }\n ',
80
+ query: "\n mutation removeProtection ($_id: String!, $applicationId: String!) {\n removeProtection (_id: $_id, applicationId: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
77
81
  params: {
78
82
  _id: id,
79
83
  applicationId: appId
@@ -81,13 +85,12 @@ function removeProtection(id, appId) {
81
85
  };
82
86
  }
83
87
 
84
- var cancelProtectionDefaultFragments = '\n _id\n';
88
+ var cancelProtectionDefaultFragments = "\n _id\n";
85
89
 
86
90
  function cancelProtection(id, appId) {
87
91
  var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : cancelProtectionDefaultFragments;
88
-
89
92
  return {
90
- query: '\n mutation cancelProtection ($_id: String!, $applicationId: String!) {\n cancelProtection (_id: $_id, applicationId: $applicationId) {\n ' + fragments + '\n }\n }\n ',
93
+ query: "\n mutation cancelProtection ($_id: String!, $applicationId: String!) {\n cancelProtection (_id: $_id, applicationId: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
91
94
  params: {
92
95
  _id: id,
93
96
  applicationId: appId
@@ -95,16 +98,14 @@ function cancelProtection(id, appId) {
95
98
  };
96
99
  }
97
100
 
98
- var updateApplicationDefaultFragments = '\n _id,\n createdAt,\n name\n';
101
+ var updateApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
99
102
 
100
103
  function updateApplication(application) {
101
104
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateApplicationDefaultFragments;
102
-
103
105
  var applicationId = application._id;
104
106
  delete application._id;
105
-
106
107
  return {
107
- query: '\n mutation updateApplication ($applicationId: String!, $data: ApplicationUpdate!) {\n updateApplication (_id: $applicationId, data: $data) {\n ' + fragments + '\n }\n }\n ',
108
+ query: "\n mutation updateApplication ($applicationId: String!, $data: ApplicationUpdate!) {\n updateApplication (_id: $applicationId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
108
109
  params: {
109
110
  applicationId: applicationId,
110
111
  data: application
@@ -112,26 +113,24 @@ function updateApplication(application) {
112
113
  };
113
114
  }
114
115
 
115
- var unlockApplicationDefaultFragments = '\n _id,\n createdAt,\n name\n';
116
+ var unlockApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
116
117
 
117
118
  function unlockApplication(application) {
118
119
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : unlockApplicationDefaultFragments;
119
-
120
120
  return {
121
- query: '\n mutation unlockApplication ($applicationId: String!) {\n unlockApplication (_id: $applicationId) {\n ' + fragments + '\n }\n }\n ',
121
+ query: "\n mutation unlockApplication ($applicationId: String!) {\n unlockApplication (_id: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
122
122
  params: {
123
123
  applicationId: application._id
124
124
  }
125
125
  };
126
126
  }
127
127
 
128
- var addApplicationSourceDefaultFragments = '\n _id,\n filename,\n extension\n';
128
+ var addApplicationSourceDefaultFragments = "\n _id,\n filename,\n extension\n";
129
129
 
130
130
  function addApplicationSource(applicationId, data) {
131
131
  var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : addApplicationSourceDefaultFragments;
132
-
133
132
  return {
134
- query: '\n mutation addSourceToApplication ($applicationId: String!, $data: ApplicationSourceCreate!) {\n addSourceToApplication(applicationId: $applicationId, data: $data) {\n ' + fragments + '\n }\n }\n ',
133
+ query: "\n mutation addSourceToApplication ($applicationId: String!, $data: ApplicationSourceCreate!) {\n addSourceToApplication(applicationId: $applicationId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
135
134
  params: {
136
135
  applicationId: applicationId,
137
136
  data: data
@@ -139,16 +138,14 @@ function addApplicationSource(applicationId, data) {
139
138
  };
140
139
  }
141
140
 
142
- var updateApplicationSourceDefaultFragments = '\n _id,\n filename,\n extension\n';
141
+ var updateApplicationSourceDefaultFragments = "\n _id,\n filename,\n extension\n";
143
142
 
144
143
  function updateApplicationSource(applicationSource) {
145
144
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateApplicationSourceDefaultFragments;
146
-
147
145
  var sourceId = applicationSource._id;
148
146
  delete applicationSource._id;
149
-
150
147
  return {
151
- query: '\n mutation updateApplicationSource ($sourceId: String!, $data: ApplicationSourceUpdate!) {\n updateApplicationSource(_id: $sourceId, data: $data) {\n ' + fragments + '\n }\n }\n ',
148
+ query: "\n mutation updateApplicationSource ($sourceId: String!, $data: ApplicationSourceUpdate!) {\n updateApplicationSource(_id: $sourceId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
152
149
  params: {
153
150
  sourceId: sourceId,
154
151
  data: applicationSource
@@ -156,13 +153,12 @@ function updateApplicationSource(applicationSource) {
156
153
  };
157
154
  }
158
155
 
159
- var removeSourceFromApplicationDefaultFragments = '\n _id,\n sources {\n filename\n }\n';
156
+ var removeSourceFromApplicationDefaultFragments = "\n _id,\n sources {\n filename\n }\n";
160
157
 
161
158
  function removeSourceFromApplication(filename, applicationId) {
162
159
  var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : removeSourceFromApplicationDefaultFragments;
163
-
164
160
  return {
165
- query: '\n mutation removeSource ($filename: String!, $applicationId: String!) {\n removeSource (filename: $filename, applicationId: $applicationId) {\n ' + fragments + '\n }\n }\n ',
161
+ query: "\n mutation removeSource ($filename: String!, $applicationId: String!) {\n removeSource (filename: $filename, applicationId: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
166
162
  params: {
167
163
  filename: filename,
168
164
  applicationId: applicationId
@@ -170,42 +166,38 @@ function removeSourceFromApplication(filename, applicationId) {
170
166
  };
171
167
  }
172
168
 
173
- var createTemplateDefaultFragments = '\n _id,\n name,\n description,\n parameters\n';
169
+ var createTemplateDefaultFragments = "\n _id,\n name,\n description,\n parameters\n";
174
170
 
175
171
  function createTemplate(template) {
176
172
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createTemplateDefaultFragments;
177
-
178
173
  return {
179
- query: '\n mutation createTemplate ($data: TemplateInput!) {\n createTemplate (data: $data) {\n ' + fragments + '\n }\n }\n ',
174
+ query: "\n mutation createTemplate ($data: TemplateInput!) {\n createTemplate (data: $data) {\n ".concat(fragments, "\n }\n }\n "),
180
175
  params: {
181
176
  data: template
182
177
  }
183
178
  };
184
179
  }
185
180
 
186
- var removeTemplateDefaultFragments = '\n _id\n';
181
+ var removeTemplateDefaultFragments = "\n _id\n";
187
182
 
188
183
  function removeTemplate(id) {
189
184
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : removeTemplateDefaultFragments;
190
-
191
185
  return {
192
- query: '\n mutation removeTemplate ($_id: String!) {\n removeTemplate (_id: $_id) {\n ' + fragments + '\n }\n }\n ',
186
+ query: "\n mutation removeTemplate ($_id: String!) {\n removeTemplate (_id: $_id) {\n ".concat(fragments, "\n }\n }\n "),
193
187
  params: {
194
188
  _id: id
195
189
  }
196
190
  };
197
191
  }
198
192
 
199
- var updateTemplateDefaultFragments = '\n _id,\n parameters\n';
193
+ var updateTemplateDefaultFragments = "\n _id,\n parameters\n";
200
194
 
201
195
  function updateTemplate(template) {
202
196
  var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateTemplateDefaultFragments;
203
-
204
197
  var templateId = template._id;
205
198
  delete template._id;
206
-
207
199
  return {
208
- query: '\n mutation updateTemplate ($templateId: ID!, $data: TemplateInput!) {\n updateTemplate (_id: $templateId, data: $data) {\n ' + fragments + '\n }\n }\n ',
200
+ query: "\n mutation updateTemplate ($templateId: ID!, $data: TemplateInput!) {\n updateTemplate (_id: $templateId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
209
201
  params: {
210
202
  templateId: templateId,
211
203
  data: template
@@ -213,49 +205,53 @@ function updateTemplate(template) {
213
205
  };
214
206
  }
215
207
 
216
- var createProtectionDefaultFragments = '\n _id,\n state\n';
208
+ var createProtectionDefaultFragments = "\n _id,\n state\n";
217
209
 
218
210
  function createApplicationProtection(applicationId) {
219
211
  var _fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createProtectionDefaultFragments;
220
212
 
221
- var _options = arguments[2];
222
- var args = arguments[3];
213
+ var _options = arguments.length > 2 ? arguments[2] : undefined;
214
+
215
+ var args = arguments.length > 3 ? arguments[3] : undefined;
216
+
217
+ var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
218
+ _ref$mutationName = _ref.mutationName,
219
+ mutationName = _ref$mutationName === void 0 ? 'createApplicationProtection' : _ref$mutationName,
220
+ _ref$mutationInputTyp = _ref.mutationInputType,
221
+ mutationInputType = _ref$mutationInputTyp === void 0 ? 'ApplicationProtectionCreate' : _ref$mutationInputTyp;
223
222
 
224
223
  var fragments = _fragments;
225
224
  var options = _options;
226
225
 
227
- var _cleanupInputFields = (0, _cleanupInputFields4.default)(args, fragments, options);
226
+ var _cleanupInputFields = (0, _cleanupInputFields3.default)(args, fragments, options);
228
227
 
229
228
  var _cleanupInputFields2 = _slicedToArray(_cleanupInputFields, 2);
230
229
 
231
230
  options = _cleanupInputFields2[0];
232
231
  fragments = _cleanupInputFields2[1];
233
232
 
234
-
235
233
  if (!args.some(function (f) {
236
234
  return f.name === 'options';
237
235
  })) {
238
236
  var _options2 = options,
239
237
  bail = _options2.bail,
240
238
  randomizationSeed = _options2.randomizationSeed;
241
-
242
-
243
239
  return {
244
- query: '\n mutation createApplicationProtection ($applicationId: String!, $bail: Boolean, $randomizationSeed: String) {\n createApplicationProtection (applicationId: $applicationId, bail: $bail, randomizationSeed: $randomizationSeed) {\n ' + fragments + '\n }\n }\n ',
240
+ query: "\n mutation ".concat(mutationName, " ($applicationId: String!, $bail: Boolean, $randomizationSeed: String) {\n ").concat(mutationName, " (applicationId: $applicationId, bail: $bail, randomizationSeed: $randomizationSeed) {\n ").concat(fragments, "\n }\n }\n "),
245
241
  params: {
246
242
  applicationId: applicationId,
247
243
  bail: bail,
248
244
  randomizationSeed: randomizationSeed
249
245
  }
250
246
  };
251
- }
247
+ } // Check if createApplicationProtection supports "data" argument
248
+
252
249
 
253
- // Check if createApplicationProtection supports "data" argument
254
250
  if (args.some(function (arg) {
255
251
  return arg.name === 'data';
256
252
  })) {
257
253
  return {
258
- query: '\n mutation createApplicationProtection ($applicationId: String!, $data: ApplicationProtectionCreate) {\n createApplicationProtection (applicationId: $applicationId, data: $data) {\n ' + fragments + '\n }\n }\n ',
254
+ query: "\n mutation ".concat(mutationName, " ($applicationId: String!, $data: ").concat(mutationInputType, ") {\n ").concat(mutationName, " (applicationId: $applicationId, data: $data) {\n ").concat(fragments, "\n }\n }\n "),
259
255
  params: {
260
256
  applicationId: applicationId,
261
257
  data: options
@@ -264,7 +260,7 @@ function createApplicationProtection(applicationId) {
264
260
  }
265
261
 
266
262
  return {
267
- query: '\n mutation createApplicationProtection ($applicationId: String!, $options: JSON) {\n createApplicationProtection (applicationId: $applicationId, options: $options) {\n ' + fragments + '\n }\n }\n ',
263
+ query: "\n mutation ".concat(mutationName, " ($applicationId: String!, $options: JSON) {\n ").concat(mutationName, " (applicationId: $applicationId, options: $options) {\n ").concat(fragments, "\n }\n }\n "),
268
264
  params: {
269
265
  applicationId: applicationId,
270
266
  options: options
@@ -272,13 +268,26 @@ function createApplicationProtection(applicationId) {
272
268
  };
273
269
  }
274
270
 
275
- var applyTemplateDefaultFragments = '\n _id,\n parameters\n';
271
+ var createProtectionsDefaultFragments = "\n protections {\n ".concat(createProtectionDefaultFragments, "\n }\n");
272
+
273
+ function createApplicationProtections(applicationId) {
274
+ var _fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createProtectionsDefaultFragments;
275
+
276
+ var _options = arguments.length > 2 ? arguments[2] : undefined;
277
+
278
+ var args = arguments.length > 3 ? arguments[3] : undefined;
279
+ return createApplicationProtection(applicationId, _fragments, _options, args, {
280
+ mutationName: 'createApplicationProtections',
281
+ mutationInputType: 'ApplicationProtectionsCreate'
282
+ });
283
+ }
284
+
285
+ var applyTemplateDefaultFragments = "\n _id,\n parameters\n";
276
286
 
277
287
  function applyTemplate(templateId, appId) {
278
288
  var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : applyTemplateDefaultFragments;
279
-
280
289
  return {
281
- query: '\n mutation applyTemplate ($templateId: String!, $appId: String!) {\n applyTemplate (templateId: $templateId, appId: $appId) {\n ' + fragments + '\n }\n }\n ',
290
+ query: "\n mutation applyTemplate ($templateId: String!, $appId: String!) {\n applyTemplate (templateId: $templateId, appId: $appId) {\n ".concat(fragments, "\n }\n }\n "),
282
291
  params: {
283
292
  templateId: templateId,
284
293
  appId: appId