jscrambler 6.4.21 → 6.4.23
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.
- package/CHANGELOG.md +14 -0
- package/dist/bin/jscrambler.js +154 -202
- package/dist/cleanup-input-fields.js +7 -8
- package/dist/client.js +69 -76
- package/dist/config.js +2 -3
- package/dist/constants.js +12 -10
- package/dist/generate-signed-params.js +13 -11
- package/dist/get-protection-default-fragments.js +40 -98
- package/dist/index.js +823 -1690
- package/dist/introspection.js +50 -172
- package/dist/mutations.js +70 -82
- package/dist/queries.js +33 -32
- package/dist/utils.js +2 -2
- package/dist/zip.js +110 -197
- package/package.json +27 -25
- /package/{LICENSE-MIT → LICENSE} +0 -0
package/dist/introspection.js
CHANGED
|
@@ -7,185 +7,63 @@ exports.intoObjectType = intoObjectType;
|
|
|
7
7
|
exports.mutation = mutation;
|
|
8
8
|
exports.query = query;
|
|
9
9
|
exports.type = type;
|
|
10
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
11
|
var _lodash = _interopRequireDefault(require("lodash.clonedeep"));
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const typeCache = {};
|
|
14
|
+
async function type(client, name) {
|
|
15
|
+
const {
|
|
16
|
+
jscramblerVersion
|
|
17
|
+
} = client.options;
|
|
18
|
+
if (!typeCache[jscramblerVersion]) {
|
|
19
|
+
typeCache[jscramblerVersion] = {};
|
|
20
|
+
}
|
|
21
|
+
if (typeCache[jscramblerVersion][name]) {
|
|
22
|
+
return typeCache[jscramblerVersion][name];
|
|
23
|
+
}
|
|
24
|
+
const query = {
|
|
25
|
+
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}",
|
|
26
|
+
params: JSON.stringify({
|
|
27
|
+
name
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
const res = await client.get('/application', query);
|
|
31
|
+
const __type = res.data.__type;
|
|
32
|
+
typeCache[jscramblerVersion][__type.name] = __type;
|
|
33
|
+
return __type;
|
|
19
34
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
while (1) {
|
|
25
|
-
switch (_context.prev = _context.next) {
|
|
26
|
-
case 0:
|
|
27
|
-
jscramblerVersion = client.options.jscramblerVersion;
|
|
28
|
-
if (!typeCache[jscramblerVersion]) {
|
|
29
|
-
typeCache[jscramblerVersion] = {};
|
|
30
|
-
}
|
|
31
|
-
if (!typeCache[jscramblerVersion][name]) {
|
|
32
|
-
_context.next = 4;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
return _context.abrupt("return", typeCache[jscramblerVersion][name]);
|
|
36
|
-
case 4:
|
|
37
|
-
query = {
|
|
38
|
-
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}",
|
|
39
|
-
params: JSON.stringify({
|
|
40
|
-
name: name
|
|
41
|
-
})
|
|
42
|
-
};
|
|
43
|
-
_context.next = 7;
|
|
44
|
-
return client.get('/application', query);
|
|
45
|
-
case 7:
|
|
46
|
-
res = _context.sent;
|
|
47
|
-
__type = res.data.__type;
|
|
48
|
-
typeCache[jscramblerVersion][__type.name] = __type;
|
|
49
|
-
return _context.abrupt("return", __type);
|
|
50
|
-
case 11:
|
|
51
|
-
case "end":
|
|
52
|
-
return _context.stop();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}, _callee);
|
|
56
|
-
}));
|
|
57
|
-
return _type.apply(this, arguments);
|
|
35
|
+
async function mutation(client, name) {
|
|
36
|
+
const rootMutation = await type(client, 'RootMutation');
|
|
37
|
+
const mutationType = rootMutation.fields.find(f => f.name === name);
|
|
38
|
+
return mutationType;
|
|
58
39
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
40
|
+
async function query(client, name) {
|
|
41
|
+
const rootQuery = await type(client, 'RootQuery');
|
|
42
|
+
const queryType = rootQuery.fields.find(f => f.name === name);
|
|
43
|
+
return queryType;
|
|
61
44
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
return _context2.abrupt("return", mutationType);
|
|
77
|
-
case 5:
|
|
78
|
-
case "end":
|
|
79
|
-
return _context2.stop();
|
|
80
|
-
}
|
|
45
|
+
async function intoObjectType(client, obj, name) {
|
|
46
|
+
var _resultType$fields;
|
|
47
|
+
const resultType = await type(client, name);
|
|
48
|
+
const fields = (_resultType$fields = resultType.fields) !== null && _resultType$fields !== void 0 ? _resultType$fields : resultType.inputFields;
|
|
49
|
+
const finalObj = {};
|
|
50
|
+
const keys = Object.keys(obj);
|
|
51
|
+
await Promise.all(keys.map(async k => {
|
|
52
|
+
const field = fields.find(f => f.name === k);
|
|
53
|
+
if (field && field.type) {
|
|
54
|
+
finalObj[k] = (0, _lodash.default)(obj[k]);
|
|
55
|
+
if (field.type.kind === 'OBJECT' && !!field.type.name) {
|
|
56
|
+
finalObj[k] = await intoObjectType(client, finalObj[k], field.type.name);
|
|
57
|
+
return;
|
|
81
58
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
function query(_x5, _x6) {
|
|
87
|
-
return _query.apply(this, arguments);
|
|
88
|
-
}
|
|
89
|
-
function _query() {
|
|
90
|
-
_query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(client, name) {
|
|
91
|
-
var rootQuery, queryType;
|
|
92
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
93
|
-
while (1) {
|
|
94
|
-
switch (_context3.prev = _context3.next) {
|
|
95
|
-
case 0:
|
|
96
|
-
_context3.next = 2;
|
|
97
|
-
return type(client, 'RootQuery');
|
|
98
|
-
case 2:
|
|
99
|
-
rootQuery = _context3.sent;
|
|
100
|
-
queryType = rootQuery.fields.find(function (f) {
|
|
101
|
-
return f.name === name;
|
|
102
|
-
});
|
|
103
|
-
return _context3.abrupt("return", queryType);
|
|
104
|
-
case 5:
|
|
105
|
-
case "end":
|
|
106
|
-
return _context3.stop();
|
|
107
|
-
}
|
|
59
|
+
if ((field.type.kind === 'NON_NULL' || field.type.kind === 'LIST') && field.type.ofType.kind === 'OBJECT') {
|
|
60
|
+
finalObj[k] = await intoObjectType(client, finalObj[k], field.type.ofType.name);
|
|
61
|
+
return;
|
|
108
62
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return _query.apply(this, arguments);
|
|
112
|
-
}
|
|
113
|
-
function intoObjectType(_x7, _x8, _x9) {
|
|
114
|
-
return _intoObjectType.apply(this, arguments);
|
|
115
|
-
}
|
|
116
|
-
function _intoObjectType() {
|
|
117
|
-
_intoObjectType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(client, obj, name) {
|
|
118
|
-
var _resultType$fields;
|
|
119
|
-
var resultType, fields, finalObj, keys;
|
|
120
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
121
|
-
while (1) {
|
|
122
|
-
switch (_context5.prev = _context5.next) {
|
|
123
|
-
case 0:
|
|
124
|
-
_context5.next = 2;
|
|
125
|
-
return type(client, name);
|
|
126
|
-
case 2:
|
|
127
|
-
resultType = _context5.sent;
|
|
128
|
-
fields = (_resultType$fields = resultType.fields) !== null && _resultType$fields !== void 0 ? _resultType$fields : resultType.inputFields;
|
|
129
|
-
finalObj = {};
|
|
130
|
-
keys = Object.keys(obj);
|
|
131
|
-
_context5.next = 8;
|
|
132
|
-
return Promise.all(keys.map( /*#__PURE__*/function () {
|
|
133
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(k) {
|
|
134
|
-
var field;
|
|
135
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
136
|
-
while (1) {
|
|
137
|
-
switch (_context4.prev = _context4.next) {
|
|
138
|
-
case 0:
|
|
139
|
-
field = fields.find(function (f) {
|
|
140
|
-
return f.name === k;
|
|
141
|
-
});
|
|
142
|
-
if (!(field && field.type)) {
|
|
143
|
-
_context4.next = 14;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
finalObj[k] = (0, _lodash.default)(obj[k]);
|
|
147
|
-
if (!(field.type.kind === 'OBJECT' && !!field.type.name)) {
|
|
148
|
-
_context4.next = 8;
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
_context4.next = 6;
|
|
152
|
-
return intoObjectType(client, finalObj[k], field.type.name);
|
|
153
|
-
case 6:
|
|
154
|
-
finalObj[k] = _context4.sent;
|
|
155
|
-
return _context4.abrupt("return");
|
|
156
|
-
case 8:
|
|
157
|
-
if (!((field.type.kind === 'NON_NULL' || field.type.kind === 'LIST') && field.type.ofType.kind === 'OBJECT')) {
|
|
158
|
-
_context4.next = 13;
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
_context4.next = 11;
|
|
162
|
-
return intoObjectType(client, finalObj[k], field.type.ofType.name);
|
|
163
|
-
case 11:
|
|
164
|
-
finalObj[k] = _context4.sent;
|
|
165
|
-
return _context4.abrupt("return");
|
|
166
|
-
case 13:
|
|
167
|
-
if (field.type.name === 'String' && typeof finalObj[k] !== 'string') {
|
|
168
|
-
finalObj[k] = JSON.stringify(finalObj[k]);
|
|
169
|
-
}
|
|
170
|
-
case 14:
|
|
171
|
-
case "end":
|
|
172
|
-
return _context4.stop();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}, _callee4);
|
|
176
|
-
}));
|
|
177
|
-
return function (_x10) {
|
|
178
|
-
return _ref.apply(this, arguments);
|
|
179
|
-
};
|
|
180
|
-
}()));
|
|
181
|
-
case 8:
|
|
182
|
-
return _context5.abrupt("return", finalObj);
|
|
183
|
-
case 9:
|
|
184
|
-
case "end":
|
|
185
|
-
return _context5.stop();
|
|
186
|
-
}
|
|
63
|
+
if (field.type.name === 'String' && typeof finalObj[k] !== 'string') {
|
|
64
|
+
finalObj[k] = JSON.stringify(finalObj[k]);
|
|
187
65
|
}
|
|
188
|
-
}
|
|
66
|
+
}
|
|
189
67
|
}));
|
|
190
|
-
return
|
|
68
|
+
return finalObj;
|
|
191
69
|
}
|
package/dist/mutations.js
CHANGED
|
@@ -19,27 +19,22 @@ exports.unlockApplication = unlockApplication;
|
|
|
19
19
|
exports.updateApplication = updateApplication;
|
|
20
20
|
exports.updateApplicationSource = updateApplicationSource;
|
|
21
21
|
exports.updateTemplate = updateTemplate;
|
|
22
|
-
|
|
22
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
23
|
+
var _cleanupInputFields = _interopRequireDefault(require("./cleanup-input-fields"));
|
|
23
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
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."); }
|
|
26
|
-
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); }
|
|
27
|
-
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; }
|
|
28
|
-
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; }
|
|
29
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
30
|
-
var createApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
|
|
25
|
+
const createApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
|
|
31
26
|
function createApplication(data) {
|
|
32
|
-
|
|
27
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createApplicationDefaultFragments;
|
|
33
28
|
return {
|
|
34
29
|
query: "\n mutation createApplication ($data: ApplicationCreate!) {\n createApplication(data: $data) {\n ".concat(fragments, "\n }\n }\n "),
|
|
35
30
|
params: {
|
|
36
|
-
data
|
|
31
|
+
data
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
34
|
}
|
|
40
|
-
|
|
35
|
+
const duplicateApplicationDefaultFragments = "\n _id\n";
|
|
41
36
|
function duplicateApplication(id) {
|
|
42
|
-
|
|
37
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : duplicateApplicationDefaultFragments;
|
|
43
38
|
return {
|
|
44
39
|
query: "\n mutation duplicateApplication ($_id: String!) {\n duplicateApplication (_id: $_id) {\n ".concat(fragments, "\n }\n }\n "),
|
|
45
40
|
params: {
|
|
@@ -47,9 +42,9 @@ function duplicateApplication(id) {
|
|
|
47
42
|
}
|
|
48
43
|
};
|
|
49
44
|
}
|
|
50
|
-
|
|
45
|
+
const removeApplicationDefaultFragments = "\n _id\n";
|
|
51
46
|
function removeApplication(id) {
|
|
52
|
-
|
|
47
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : removeApplicationDefaultFragments;
|
|
53
48
|
return {
|
|
54
49
|
query: "\n mutation removeApplication ($_id: String!) {\n removeApplication (_id: $_id) {\n ".concat(fragments, "\n }\n }\n "),
|
|
55
50
|
params: {
|
|
@@ -57,9 +52,9 @@ function removeApplication(id) {
|
|
|
57
52
|
}
|
|
58
53
|
};
|
|
59
54
|
}
|
|
60
|
-
|
|
55
|
+
const removeProtectionDefaultFragments = "\n _id\n";
|
|
61
56
|
function removeProtection(id, appId) {
|
|
62
|
-
|
|
57
|
+
let fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : removeProtectionDefaultFragments;
|
|
63
58
|
return {
|
|
64
59
|
query: "\n mutation removeProtection ($_id: String!, $applicationId: String!) {\n removeProtection (_id: $_id, applicationId: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
|
|
65
60
|
params: {
|
|
@@ -68,9 +63,9 @@ function removeProtection(id, appId) {
|
|
|
68
63
|
}
|
|
69
64
|
};
|
|
70
65
|
}
|
|
71
|
-
|
|
66
|
+
const cancelProtectionDefaultFragments = "\n _id\n";
|
|
72
67
|
function cancelProtection(id, appId) {
|
|
73
|
-
|
|
68
|
+
let fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : cancelProtectionDefaultFragments;
|
|
74
69
|
return {
|
|
75
70
|
query: "\n mutation cancelProtection ($_id: String!, $applicationId: String!) {\n cancelProtection (_id: $_id, applicationId: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
|
|
76
71
|
params: {
|
|
@@ -79,11 +74,11 @@ function cancelProtection(id, appId) {
|
|
|
79
74
|
}
|
|
80
75
|
};
|
|
81
76
|
}
|
|
82
|
-
|
|
77
|
+
const updateApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
|
|
83
78
|
function updateApplication(applicationData) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateApplicationDefaultFragments;
|
|
80
|
+
let applicationId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
81
|
+
const appId = applicationId !== null && applicationId !== void 0 ? applicationId : applicationData._id;
|
|
87
82
|
delete applicationData._id;
|
|
88
83
|
return {
|
|
89
84
|
query: "\n mutation updateApplication ($applicationId: String!, $data: ApplicationUpdate!) {\n updateApplication (_id: $applicationId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
|
|
@@ -93,9 +88,9 @@ function updateApplication(applicationData) {
|
|
|
93
88
|
}
|
|
94
89
|
};
|
|
95
90
|
}
|
|
96
|
-
|
|
91
|
+
const unlockApplicationDefaultFragments = "\n _id,\n createdAt,\n name\n";
|
|
97
92
|
function unlockApplication(application) {
|
|
98
|
-
|
|
93
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : unlockApplicationDefaultFragments;
|
|
99
94
|
return {
|
|
100
95
|
query: "\n mutation unlockApplication ($applicationId: String!) {\n unlockApplication (_id: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
|
|
101
96
|
params: {
|
|
@@ -103,44 +98,44 @@ function unlockApplication(application) {
|
|
|
103
98
|
}
|
|
104
99
|
};
|
|
105
100
|
}
|
|
106
|
-
|
|
101
|
+
const addApplicationSourceDefaultFragments = "\n _id,\n filename,\n extension\n";
|
|
107
102
|
function addApplicationSource(applicationId, data) {
|
|
108
|
-
|
|
103
|
+
let fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : addApplicationSourceDefaultFragments;
|
|
109
104
|
return {
|
|
110
105
|
query: "\n mutation addSourceToApplication ($applicationId: String!, $data: ApplicationSourceCreate!) {\n addSourceToApplication(applicationId: $applicationId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
|
|
111
106
|
params: {
|
|
112
|
-
applicationId
|
|
113
|
-
data
|
|
107
|
+
applicationId,
|
|
108
|
+
data
|
|
114
109
|
}
|
|
115
110
|
};
|
|
116
111
|
}
|
|
117
|
-
|
|
112
|
+
const updateApplicationSourceDefaultFragments = "\n _id,\n filename,\n extension\n";
|
|
118
113
|
function updateApplicationSource(applicationSource) {
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateApplicationSourceDefaultFragments;
|
|
115
|
+
const sourceId = applicationSource._id;
|
|
121
116
|
delete applicationSource._id;
|
|
122
117
|
return {
|
|
123
118
|
query: "\n mutation updateApplicationSource ($sourceId: String!, $data: ApplicationSourceUpdate!) {\n updateApplicationSource(_id: $sourceId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
|
|
124
119
|
params: {
|
|
125
|
-
sourceId
|
|
120
|
+
sourceId,
|
|
126
121
|
data: applicationSource
|
|
127
122
|
}
|
|
128
123
|
};
|
|
129
124
|
}
|
|
130
|
-
|
|
125
|
+
const removeSourceFromApplicationDefaultFragments = "\n _id,\n sources {\n filename\n }\n";
|
|
131
126
|
function removeSourceFromApplication(filename, applicationId) {
|
|
132
|
-
|
|
127
|
+
let fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : removeSourceFromApplicationDefaultFragments;
|
|
133
128
|
return {
|
|
134
129
|
query: "\n mutation removeSource ($filename: String!, $applicationId: String!) {\n removeSource (filename: $filename, applicationId: $applicationId) {\n ".concat(fragments, "\n }\n }\n "),
|
|
135
130
|
params: {
|
|
136
|
-
filename
|
|
137
|
-
applicationId
|
|
131
|
+
filename,
|
|
132
|
+
applicationId
|
|
138
133
|
}
|
|
139
134
|
};
|
|
140
135
|
}
|
|
141
|
-
|
|
136
|
+
const createTemplateDefaultFragments = "\n _id,\n name,\n description,\n parameters\n";
|
|
142
137
|
function createTemplate(template) {
|
|
143
|
-
|
|
138
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createTemplateDefaultFragments;
|
|
144
139
|
return {
|
|
145
140
|
query: "\n mutation createTemplate ($data: TemplateInput!) {\n createTemplate (data: $data) {\n ".concat(fragments, "\n }\n }\n "),
|
|
146
141
|
params: {
|
|
@@ -148,9 +143,9 @@ function createTemplate(template) {
|
|
|
148
143
|
}
|
|
149
144
|
};
|
|
150
145
|
}
|
|
151
|
-
|
|
146
|
+
const removeTemplateDefaultFragments = "\n _id\n";
|
|
152
147
|
function removeTemplate(id) {
|
|
153
|
-
|
|
148
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : removeTemplateDefaultFragments;
|
|
154
149
|
return {
|
|
155
150
|
query: "\n mutation removeTemplate ($_id: String!) {\n removeTemplate (_id: $_id) {\n ".concat(fragments, "\n }\n }\n "),
|
|
156
151
|
params: {
|
|
@@ -158,59 +153,52 @@ function removeTemplate(id) {
|
|
|
158
153
|
}
|
|
159
154
|
};
|
|
160
155
|
}
|
|
161
|
-
|
|
156
|
+
const updateTemplateDefaultFragments = "\n _id,\n parameters\n";
|
|
162
157
|
function updateTemplate(template) {
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : updateTemplateDefaultFragments;
|
|
159
|
+
const templateId = template._id;
|
|
165
160
|
delete template._id;
|
|
166
161
|
return {
|
|
167
162
|
query: "\n mutation updateTemplate ($templateId: ID!, $data: TemplateInput!) {\n updateTemplate (_id: $templateId, data: $data) {\n ".concat(fragments, "\n }\n }\n "),
|
|
168
163
|
params: {
|
|
169
|
-
templateId
|
|
164
|
+
templateId,
|
|
170
165
|
data: template
|
|
171
166
|
}
|
|
172
167
|
};
|
|
173
168
|
}
|
|
174
|
-
|
|
169
|
+
const createProtectionDefaultFragments = "\n _id,\n state\n";
|
|
175
170
|
function createApplicationProtection(applicationId) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return f.name === 'options';
|
|
192
|
-
})) {
|
|
193
|
-
var _options2 = options,
|
|
194
|
-
bail = _options2.bail,
|
|
195
|
-
randomizationSeed = _options2.randomizationSeed;
|
|
171
|
+
let _fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createProtectionDefaultFragments;
|
|
172
|
+
let _options = arguments.length > 2 ? arguments[2] : undefined;
|
|
173
|
+
let args = arguments.length > 3 ? arguments[3] : undefined;
|
|
174
|
+
let {
|
|
175
|
+
mutationName = 'createApplicationProtection',
|
|
176
|
+
mutationInputType = 'ApplicationProtectionCreate'
|
|
177
|
+
} = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
178
|
+
let fragments = _fragments;
|
|
179
|
+
let options = _options;
|
|
180
|
+
[options, fragments] = (0, _cleanupInputFields.default)(args, fragments, options);
|
|
181
|
+
if (!args.some(f => f.name === 'options')) {
|
|
182
|
+
const {
|
|
183
|
+
bail,
|
|
184
|
+
randomizationSeed
|
|
185
|
+
} = options;
|
|
196
186
|
return {
|
|
197
187
|
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 "),
|
|
198
188
|
params: {
|
|
199
|
-
applicationId
|
|
200
|
-
bail
|
|
201
|
-
randomizationSeed
|
|
189
|
+
applicationId,
|
|
190
|
+
bail,
|
|
191
|
+
randomizationSeed
|
|
202
192
|
}
|
|
203
193
|
};
|
|
204
194
|
}
|
|
205
195
|
|
|
206
196
|
// Check if createApplicationProtection supports "data" argument
|
|
207
|
-
if (args.some(
|
|
208
|
-
return arg.name === 'data';
|
|
209
|
-
})) {
|
|
197
|
+
if (args.some(arg => arg.name === 'data')) {
|
|
210
198
|
return {
|
|
211
199
|
query: "\n mutation ".concat(mutationName, " ($applicationId: String!, $data: ").concat(mutationInputType, ") {\n ").concat(mutationName, " (applicationId: $applicationId, data: $data) {\n ").concat(fragments, "\n }\n }\n "),
|
|
212
200
|
params: {
|
|
213
|
-
applicationId
|
|
201
|
+
applicationId,
|
|
214
202
|
data: options
|
|
215
203
|
}
|
|
216
204
|
};
|
|
@@ -218,29 +206,29 @@ function createApplicationProtection(applicationId) {
|
|
|
218
206
|
return {
|
|
219
207
|
query: "\n mutation ".concat(mutationName, " ($applicationId: String!, $options: JSON) {\n ").concat(mutationName, " (applicationId: $applicationId, options: $options) {\n ").concat(fragments, "\n }\n }\n "),
|
|
220
208
|
params: {
|
|
221
|
-
applicationId
|
|
222
|
-
options
|
|
209
|
+
applicationId,
|
|
210
|
+
options
|
|
223
211
|
}
|
|
224
212
|
};
|
|
225
213
|
}
|
|
226
|
-
|
|
214
|
+
const createProtectionsDefaultFragments = "\n protections {\n ".concat(createProtectionDefaultFragments, "\n }\n");
|
|
227
215
|
function createApplicationProtections(applicationId) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
216
|
+
let _fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createProtectionsDefaultFragments;
|
|
217
|
+
let _options = arguments.length > 2 ? arguments[2] : undefined;
|
|
218
|
+
let args = arguments.length > 3 ? arguments[3] : undefined;
|
|
231
219
|
return createApplicationProtection(applicationId, _fragments, _options, args, {
|
|
232
220
|
mutationName: 'createApplicationProtections',
|
|
233
221
|
mutationInputType: 'ApplicationProtectionsCreate'
|
|
234
222
|
});
|
|
235
223
|
}
|
|
236
|
-
|
|
224
|
+
const applyTemplateDefaultFragments = "\n _id,\n parameters\n";
|
|
237
225
|
function applyTemplate(templateId, appId) {
|
|
238
|
-
|
|
226
|
+
let fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : applyTemplateDefaultFragments;
|
|
239
227
|
return {
|
|
240
228
|
query: "\n mutation applyTemplate ($templateId: String!, $appId: String!) {\n applyTemplate (templateId: $templateId, appId: $appId) {\n ".concat(fragments, "\n }\n }\n "),
|
|
241
229
|
params: {
|
|
242
|
-
templateId
|
|
243
|
-
appId
|
|
230
|
+
templateId,
|
|
231
|
+
appId
|
|
244
232
|
}
|
|
245
233
|
};
|
|
246
234
|
}
|