New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@paljs/plugins

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paljs/plugins - npm Package Compare versions

Comparing version 4.0.13 to 4.0.14

1271

dist/plugins.cjs.development.js

@@ -10,2 +10,38 @@ 'use strict';

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);
}
}
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);
});
};
}
function _defineProperties(target, props) {

@@ -24,2 +60,5 @@ for (var i = 0; i < props.length; i++) {

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -73,24 +112,20 @@ }

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
return {
done: false,
value: o[i++]
};
};
}
it = o[Symbol.iterator]();
return it.next.bind(it);
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -147,3 +182,3 @@

PrismaSelect.getModelMap = function getModelMap(docs, name) {
var value = docs === null || docs === void 0 ? void 0 : docs.match(/@PrismaSelect.map\(\[(.*?)\]\)/);
var value = docs == null ? void 0 : docs.match(/@PrismaSelect.map\(\[(.*?)\]\)/);

@@ -169,3 +204,3 @@ if (value && name) {

_proto.field = function field(name, model) {
return model === null || model === void 0 ? void 0 : model.fields.find(function (item) {
return model == null ? void 0 : model.fields.find(function (item) {
return item.name === name;

@@ -302,5 +337,7 @@ });

} else {
var subModelFilter = _this.filterBy(field.type.toString(), selectObject.select[key]);
var subModelFilter = _this.filterBy(field.type, selectObject.select[key]);
if (Object.keys(subModelFilter.select).length > 0) {
if (subModelFilter === true) {
filteredObject.select[key] = true;
} else if (Object.keys(subModelFilter.select).length > 0) {
filteredObject.select[key] = subModelFilter;

@@ -364,6 +401,6 @@ }

if ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.dmmf) {
if ((_this$options = this.options) != null && _this$options.dmmf) {
var _this$options2;
(_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.dmmf.forEach(function (doc) {
(_this$options2 = this.options) == null ? void 0 : _this$options2.dmmf.forEach(function (doc) {
models.push.apply(models, doc.datamodel.models);

@@ -387,3 +424,3 @@ });

return (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.defaultFields;
return (_this$options3 = this.options) == null ? void 0 : _this$options3.defaultFields;
}

@@ -403,193 +440,731 @@ }, {

// A type of promise-like that resolves synchronously and supports only one observer
var _Pact = /*#__PURE__*/function () {
function _Pact() {}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
_Pact.prototype.then = function (onFulfilled, onRejected) {
var result = new _Pact();
var state = this.s;
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = function (exports) {
if (state) {
var callback = state & 1 ? onFulfilled : onRejected;
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1; // More compressible than void 0.
if (callback) {
try {
_settle(result, 1, callback(this.v));
} catch (e) {
_settle(result, 2, e);
}
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
return result;
} else {
return this;
}
function define(obj, key, value) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
}
this.o = function (_this) {
try {
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
var value = _this.v;
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
if (_this.s & 1) {
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
} else if (onRejected) {
_settle(result, 1, onRejected(value));
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function () {
return this;
});
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = GeneratorFunctionPrototype;
define(Gp, "constructor", GeneratorFunctionPrototype);
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
define(prototype, method, function (arg) {
return this._invoke(method, arg);
});
});
}
exports.isGeneratorFunction = function (genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
};
exports.mark = function (genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define(genFun, toStringTagSymbol, "GeneratorFunction");
}
genFun.prototype = Object.create(Gp);
return genFun;
}; // Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function (arg) {
return {
__await: arg
};
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
_settle(result, 2, value);
var result = record.arg;
var value = result.value;
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value).then(function (unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function (error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
}
} catch (e) {
_settle(result, 2, e);
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = // If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
} // Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
return this;
});
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
};
return result;
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
return _Pact;
}(); // Settles a pact synchronously
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
} // Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
function _settle(pact, state, value) {
if (!pact.s) {
if (value instanceof _Pact) {
if (value.s) {
if (state & 1) {
state = value.s;
return doneResult();
}
value = value.v;
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted; // Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
} // Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
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 (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (!info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
}
} else {
value.o = _settle.bind(null, pact, state);
return;
// Re-yield the result returned by the delegate method.
return info;
} // The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
} // Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
define(Gp, iteratorSymbol, function () {
return this;
});
define(Gp, "toString", function () {
return "[object Generator]";
});
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
if (value && value.then) {
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
return;
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
pact.s = state;
pact.v = value;
var observer = pact.o;
if (observer) {
observer(pact);
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{
tryLoc: "root"
}];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
}
}
function _isSettledPact(thenable) {
return thenable instanceof _Pact && thenable.s & 1;
} // Converts argument to a function that always returns a Promise
function _forTo(array, body, check) {
var i = -1,
pact,
reject;
exports.keys = function (object) {
var keys = [];
function _cycle(result) {
try {
while (++i < array.length && (!check || !check())) {
result = body(i);
for (var key in object) {
keys.push(key);
}
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
keys.reverse(); // Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
} // To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
}
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined$1;
next.done = true;
return next;
};
return next.next = next;
}
} // Return an iterator with no values.
return {
next: doneResult
};
}
}
_cycle();
exports.values = values;
return pact;
} // Asynchronously iterate through an object's properties (including properties inherited from the prototype)
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator"; // Asynchronously iterate through an object's values
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
function doneResult() {
return {
value: undefined$1,
done: true
};
}
function _forOf(target, body, check) {
if (typeof target[_iteratorSymbol] === "function") {
var _cycle = function _cycle(result) {
try {
while (!(step = iterator.next()).done && (!check || !check())) {
result = body(step.value);
Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
this.prev = 0;
this.next = 0; // Resetting context._sent for legacy support of Babel's
// function.sent implementation.
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function stop() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined$1;
}
return !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
}
};
var iterator = target[_iteratorSymbol](),
step,
pact,
reject;
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
_cycle();
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (iterator["return"]) {
var _fixup = function _fixup(value) {
try {
if (!step.done) {
iterator["return"]();
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function complete(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" || record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
} catch (e) {}
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
return value;
};
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (pact && pact.then) {
return pact.then(_fixup, function (e) {
throw _fixup(e);
});
}
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
_fixup();
}
return thrown;
}
} // The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
return pact;
} // No support for Symbol.iterator
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (!("length" in target)) {
throw new TypeError("Object is not iterable");
} // Handle live collections properly
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined$1;
}
return ContinueSentinel;
}
}; // Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
var values = [];
return exports;
}( // If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
module.exports );
for (var i = 0; i < target.length; i++) {
values.push(target[i]);
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured. Just
// in case runtime.js accidentally runs in strict mode, in modern engines
// we can explicitly access globalThis. In older engines we can escape
// strict mode using a global Function call. This could conceivably fail
// if a Content Security Policy forbids using Function, but in that case
// the proper solution is to fix the accidental strict mode problem. If
// you've misconfigured your bundler to force strict mode and applied a
// CSP to forbid Function, and you're not willing to fix either of those
// problems, please detail your unique predicament in a GitHub issue.
if (typeof globalThis === "object") {
globalThis.regeneratorRuntime = runtime;
} else {
Function("r", "regeneratorRuntime = r")(runtime);
}
}
});
return _forTo(values, function (i) {
return body(values[i]);
}, check);
}
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator"; // Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing
/**

@@ -624,3 +1199,3 @@ * Handle all relation onDelete type

return (_this$dataModel = this.dataModel) === null || _this$dataModel === void 0 ? void 0 : _this$dataModel.models.find(function (item) {
return (_this$dataModel = this.dataModel) == null ? void 0 : _this$dataModel.models.find(function (item) {
return item.name === modelName;

@@ -637,3 +1212,3 @@ });

return (_this$getModel = this.getModel(modelName)) === null || _this$getModel === void 0 ? void 0 : _this$getModel.fields.find(function (item) {
return (_this$getModel = this.getModel(modelName)) == null ? void 0 : _this$getModel.fields.find(function (item) {
return item.type === fieldType && !item.isList;

@@ -646,5 +1221,5 @@ });

return (_this$getModel2 = this.getModel(modelName)) === null || _this$getModel2 === void 0 ? void 0 : (_this$getModel2$field = _this$getModel2.fields.find(function (item) {
return (_this$getModel2 = this.getModel(modelName)) == null ? void 0 : (_this$getModel2$field = _this$getModel2.fields.find(function (item) {
return item.isId;
})) === null || _this$getModel2$field === void 0 ? void 0 : _this$getModel2$field.name;
})) == null ? void 0 : _this$getModel2$field.name;
};

@@ -655,126 +1230,187 @@

return (_this$getModel3 = this.getModel(modelName)) === null || _this$getModel3 === void 0 ? void 0 : _this$getModel3.fields.filter(function (item) {
return (_this$getModel3 = this.getModel(modelName)) == null ? void 0 : _this$getModel3.fields.filter(function (item) {
var _item$documentation, _item$documentation2;
return ((_item$documentation = item.documentation) === null || _item$documentation === void 0 ? void 0 : _item$documentation.includes('@onDelete')) && ((_item$documentation2 = item.documentation) === null || _item$documentation2 === void 0 ? void 0 : _item$documentation2.includes(type));
return ((_item$documentation = item.documentation) == null ? void 0 : _item$documentation.includes('@onDelete')) && ((_item$documentation2 = item.documentation) == null ? void 0 : _item$documentation2.includes(type));
});
};
_proto.setFieldNull = function setFieldNull(modelName, field, where) {
try {
var _this2 = this;
_proto.setFieldNull = /*#__PURE__*/function () {
var _setFieldNull = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(modelName, field, where) {
var name, modelId, fieldModelId, _select, _ref, _extends2, fieldSelect, results, _iterator, _step, result, _where, _data;
var name = PrismaDelete.getModelName(modelName);
return runtime_1.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
name = PrismaDelete.getModelName(modelName);
modelId = this.getModelIdFieldName(modelName);
fieldModelId = this.getModelIdFieldName(field.type);
var modelId = _this2.getModelIdFieldName(modelName);
if (!(modelId && fieldModelId && !field.isRequired)) {
_context.next = 16;
break;
}
var fieldModelId = _this2.getModelIdFieldName(field.type.toString());
fieldSelect = field.isList ? (_ref = {}, _ref[field.name] = {
select: (_select = {}, _select[fieldModelId] = true, _select)
}, _ref) : {};
_context.next = 7;
return this.prisma[name].findMany({
where: where,
select: _extends((_extends2 = {}, _extends2[modelId] = true, _extends2), fieldSelect)
});
return Promise.resolve(function () {
if (modelId && fieldModelId && !field.isRequired) {
var _select, _ref, _extends2;
case 7:
results = _context.sent;
_iterator = _createForOfIteratorHelperLoose(results);
var fieldSelect = field.isList ? (_ref = {}, _ref[field.name] = {
select: (_select = {}, _select[fieldModelId] = true, _select)
}, _ref) : {};
return Promise.resolve(_this2.prisma[name].findMany({
where: where,
select: _extends((_extends2 = {}, _extends2[modelId] = true, _extends2), fieldSelect)
})).then(function (results) {
return _forOf(results, function (result) {
var _temp = function () {
if (!(field.isList && result[field.name].length === 0)) {
var _where, _data;
case 9:
if ((_step = _iterator()).done) {
_context.next = 16;
break;
}
return Promise.resolve(_this2.prisma[name].update({
where: (_where = {}, _where[modelId] = result[modelId], _where),
data: (_data = {}, _data[field.name] = {
disconnect: field.isList ? result[field.name] : true
}, _data)
})).then(function () {});
}
}();
result = _step.value;
if (_temp && _temp.then) return _temp.then(function () {});
});
});
if (field.isList && result[field.name].length === 0) {
_context.next = 14;
break;
}
_context.next = 14;
return this.prisma[name].update({
where: (_where = {}, _where[modelId] = result[modelId], _where),
data: (_data = {}, _data[field.name] = {
disconnect: field.isList ? result[field.name] : true
}, _data)
});
case 14:
_context.next = 9;
break;
case 16:
case "end":
return _context.stop();
}
}
}());
} catch (e) {
return Promise.reject(e);
}
};
}, _callee, this);
}));
_proto.getDeleteArray = function getDeleteArray(modelName, whereInput, includeParent) {
if (includeParent === void 0) {
includeParent = true;
function setFieldNull(_x, _x2, _x3) {
return _setFieldNull.apply(this, arguments);
}
try {
var _temp8 = function _temp8() {
var cascadeFields = _this4.getOnDeleteFields(modelName, 'CASCADE');
return setFieldNull;
}();
var _temp5 = function () {
if (cascadeFields) {
return _forOf(cascadeFields, function (cascadeField) {
var childField = _this4.getFieldByType(cascadeField.type.toString(), modelName);
_proto.getDeleteArray = /*#__PURE__*/function () {
var _getDeleteArray = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(modelName, whereInput, includeParent) {
var deleteArray, nullFields, _iterator2, _step2, nullField, cascadeFields, _iterator3, _step3, cascadeField, childField, _this$getDeleteArray, _where2;
var _temp4 = function () {
if (childField) {
var _temp10 = function () {
if (cascadeField.type !== modelName) {
var _this4$getDeleteArray;
return runtime_1.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (includeParent === void 0) {
includeParent = true;
}
var _push2 = deleteArray.push;
return Promise.resolve(_this4.getDeleteArray(cascadeField.type.toString(), (_this4$getDeleteArray = {}, _this4$getDeleteArray[childField.name] = whereInput, _this4$getDeleteArray))).then(function (_this3$getDeleteArray) {
_push2.call.apply(_push2, [deleteArray].concat(_this3$getDeleteArray));
});
} else {
var _where2;
deleteArray = includeParent ? [{
name: PrismaDelete.getModelName(modelName),
where: whereInput
}] : [];
nullFields = this.getOnDeleteFields(modelName, 'SET_NULL');
deleteArray.push({
name: PrismaDelete.getModelName(modelName),
where: (_where2 = {}, _where2[childField.name] = whereInput, _where2)
});
}
}();
if (!nullFields) {
_context2.next = 11;
break;
}
if (_temp10 && _temp10.then) return _temp10.then(function () {});
}
}();
_iterator2 = _createForOfIteratorHelperLoose(nullFields);
if (_temp4 && _temp4.then) return _temp4.then(function () {});
});
}
}();
case 5:
if ((_step2 = _iterator2()).done) {
_context2.next = 11;
break;
}
return _temp5 && _temp5.then ? _temp5.then(function () {
return deleteArray;
}) : deleteArray;
};
nullField = _step2.value;
_context2.next = 9;
return this.setFieldNull(modelName, nullField, whereInput);
var _this4 = this;
case 9:
_context2.next = 5;
break;
var deleteArray = includeParent ? [{
name: PrismaDelete.getModelName(modelName),
where: whereInput
}] : [];
case 11:
cascadeFields = this.getOnDeleteFields(modelName, 'CASCADE');
var nullFields = _this4.getOnDeleteFields(modelName, 'SET_NULL');
if (!cascadeFields) {
_context2.next = 30;
break;
}
var _temp9 = function () {
if (nullFields) {
var _temp11 = _forOf(nullFields, function (nullField) {
return Promise.resolve(_this4.setFieldNull(modelName, nullField, whereInput)).then(function () {});
});
_iterator3 = _createForOfIteratorHelperLoose(cascadeFields);
if (_temp11 && _temp11.then) return _temp11.then(function () {});
case 14:
if ((_step3 = _iterator3()).done) {
_context2.next = 30;
break;
}
cascadeField = _step3.value;
childField = this.getFieldByType(cascadeField.type, modelName);
if (!childField) {
_context2.next = 28;
break;
}
if (!(cascadeField.type !== modelName)) {
_context2.next = 27;
break;
}
_context2.t0 = deleteArray.push;
_context2.t1 = deleteArray;
_context2.next = 23;
return this.getDeleteArray(cascadeField.type, (_this$getDeleteArray = {}, _this$getDeleteArray[childField.name] = whereInput, _this$getDeleteArray));
case 23:
_context2.t2 = _context2.sent;
_context2.t0.apply.call(_context2.t0, _context2.t1, _context2.t2);
_context2.next = 28;
break;
case 27:
deleteArray.push({
name: PrismaDelete.getModelName(modelName),
where: (_where2 = {}, _where2[childField.name] = whereInput, _where2)
});
case 28:
_context2.next = 14;
break;
case 30:
return _context2.abrupt("return", deleteArray);
case 31:
case "end":
return _context2.stop();
}
}
}();
}, _callee2, this);
}));
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp8) : _temp8(_temp9));
} catch (e) {
return Promise.reject(e);
function getDeleteArray(_x4, _x5, _x6) {
return _getDeleteArray.apply(this, arguments);
}
}
return getDeleteArray;
}()
/**

@@ -795,37 +1431,64 @@ * Handle all relation onDelete type

_proto.onDelete = function onDelete(_ref2) {
var model = _ref2.model,
where = _ref2.where,
deleteParent = _ref2.deleteParent;
_proto.onDelete =
/*#__PURE__*/
function () {
var _onDelete = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(_ref2) {
var model, where, deleteParent, results, i;
return runtime_1.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
model = _ref2.model, where = _ref2.where, deleteParent = _ref2.deleteParent;
_context3.next = 3;
return this.getDeleteArray(model, where, !!deleteParent);
try {
var _this6 = this;
case 3:
results = _context3.sent.reverse();
i = 0;
return Promise.resolve(_this6.getDeleteArray(model, where, !!deleteParent)).then(function (_this5$getDeleteArray) {
var _exit = false;
case 5:
if (!(i < results.length)) {
_context3.next = 17;
break;
}
var results = _this5$getDeleteArray.reverse();
if (!(i + 1 === results.length && deleteParent)) {
_context3.next = 12;
break;
}
return _forTo(results, function (i) {
return function () {
if (i + 1 === results.length && deleteParent) {
_exit = true;
return Promise.resolve(_this6.prisma[results[i].name].deleteMany({
_context3.next = 9;
return this.prisma[results[i].name].deleteMany({
where: results[i].where
}));
} else {
return Promise.resolve(_this6.prisma[results[i].name].deleteMany({
});
case 9:
return _context3.abrupt("return", _context3.sent);
case 12:
_context3.next = 14;
return this.prisma[results[i].name].deleteMany({
where: results[i].where
})).then(function () {});
}
}();
}, function () {
return _exit;
});
});
} catch (e) {
return Promise.reject(e);
});
case 14:
++i;
_context3.next = 5;
break;
case 17:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function onDelete(_x7) {
return _onDelete.apply(this, arguments);
}
};
return onDelete;
}();
_createClass(PrismaDelete, [{

@@ -844,10 +1507,10 @@ key: "getDMMF",

if ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.dmmf) {
if ((_this$options = this.options) != null && _this$options.dmmf) {
var _this$options2, _this$options2$dmmf;
return (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$dmmf = _this$options2.dmmf) === null || _this$options2$dmmf === void 0 ? void 0 : _this$options2$dmmf.datamodel;
return (_this$options2 = this.options) == null ? void 0 : (_this$options2$dmmf = _this$options2.dmmf) == null ? void 0 : _this$options2$dmmf.datamodel;
} else {
var _this$getDMMF;
return (_this$getDMMF = this.getDMMF) === null || _this$getDMMF === void 0 ? void 0 : _this$getDMMF.datamodel;
return (_this$getDMMF = this.getDMMF) == null ? void 0 : _this$getDMMF.datamodel;
}

@@ -860,11 +1523,3 @@ }

function _templateObject() {
var data = _taggedTemplateLiteralLoose(["\n ", "\n "]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
var _templateObject;
var testedTypes = [];

@@ -874,3 +1529,3 @@ var hasEmptyTypeFields = function hasEmptyTypeFields(type, options) {

var schema = options === null || options === void 0 ? void 0 : (_options$dmmf = options.dmmf) === null || _options$dmmf === void 0 ? void 0 : _options$dmmf.schema;
var schema = options == null ? void 0 : (_options$dmmf = options.dmmf) == null ? void 0 : _options$dmmf.schema;

@@ -883,8 +1538,8 @@ if (!schema) {

schema = (_Prisma$dmmf = Prisma.dmmf) === null || _Prisma$dmmf === void 0 ? void 0 : _Prisma$dmmf.schema;
schema = (_Prisma$dmmf = Prisma.dmmf) == null ? void 0 : _Prisma$dmmf.schema;
}
testedTypes.push(type);
var inputObjectTypes = schema ? [].concat((_schema = schema) === null || _schema === void 0 ? void 0 : _schema.inputObjectTypes.prisma) : [];
if ((_schema2 = schema) === null || _schema2 === void 0 ? void 0 : _schema2.inputObjectTypes.model) inputObjectTypes.push.apply(inputObjectTypes, schema.inputObjectTypes.model);
var inputObjectTypes = schema ? [].concat((_schema = schema) == null ? void 0 : _schema.inputObjectTypes.prisma) : [];
if ((_schema2 = schema) != null && _schema2.inputObjectTypes.model) inputObjectTypes.push.apply(inputObjectTypes, schema.inputObjectTypes.model);
var inputType = inputObjectTypes.find(function (item) {

@@ -913,3 +1568,3 @@ return item.name === type;

if ((options === null || options === void 0 ? void 0 : options.doNotUseFieldUpdateOperationsInput) && field.inputTypes.length > 1 && field.inputTypes[1].type.endsWith('FieldUpdateOperationsInput')) {
if (options != null && options.doNotUseFieldUpdateOperationsInput && field.inputTypes.length > 1 && field.inputTypes[1].type.endsWith('FieldUpdateOperationsInput')) {
return field.inputTypes[index];

@@ -927,3 +1582,3 @@ }

var schema = options === null || options === void 0 ? void 0 : (_options$dmmf2 = options.dmmf) === null || _options$dmmf2 === void 0 ? void 0 : _options$dmmf2.schema;
var schema = options == null ? void 0 : (_options$dmmf2 = options.dmmf) == null ? void 0 : _options$dmmf2.schema;

@@ -936,3 +1591,3 @@ if (!schema) {

schema = (_Prisma$dmmf2 = Prisma.dmmf) === null || _Prisma$dmmf2 === void 0 ? void 0 : _Prisma$dmmf2.schema;
schema = (_Prisma$dmmf2 = Prisma.dmmf) == null ? void 0 : _Prisma$dmmf2.schema;
}

@@ -959,7 +1614,7 @@

fileContent += "input " + input.name + " {\n ";
var inputFields = typeof (options === null || options === void 0 ? void 0 : options.filterInputs) === 'function' ? options.filterInputs(input) : input.fields;
var inputFields = typeof (options == null ? void 0 : options.filterInputs) === 'function' ? options.filterInputs(input) : input.fields;
inputFields.filter(function (field) {
var _options$excludeField;
return !(options === null || options === void 0 ? void 0 : (_options$excludeField = options.excludeFields) === null || _options$excludeField === void 0 ? void 0 : _options$excludeField.includes(field.name));
return !(options != null && (_options$excludeField = options.excludeFields) != null && _options$excludeField.includes(field.name));
}).forEach(function (field) {

@@ -976,3 +1631,3 @@ var inputType = getInputType(field, options);

});
(_schema3 = schema) === null || _schema3 === void 0 ? void 0 : _schema3.outputObjectTypes.prisma.filter(function (type) {
(_schema3 = schema) == null ? void 0 : _schema3.outputObjectTypes.prisma.filter(function (type) {
return type.name.includes('Aggregate') || type.name.endsWith('CountOutputType');

@@ -984,3 +1639,3 @@ }).forEach(function (type) {

return !(options === null || options === void 0 ? void 0 : (_options$excludeField2 = options.excludeFields) === null || _options$excludeField2 === void 0 ? void 0 : _options$excludeField2.includes(field.name));
return !(options != null && (_options$excludeField2 = options.excludeFields) != null && _options$excludeField2.includes(field.name));
}).forEach(function (field) {

@@ -998,3 +1653,3 @@ fileContent += field.name + ": " + (field.outputType.isList ? "[" + field.outputType.type + "!]" : field.outputType.type) + (!field.isNullable ? '!' : '') + "\n ";

return gql(_templateObject(), generateInputsString(options));
return gql(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n "])), generateInputsString(options));
};

@@ -1001,0 +1656,0 @@ var generateGraphQlSDLFile = function generateGraphQlSDLFile(schema, path) {

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("graphql-fields"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("fs");function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var a=function(){function e(e,t){this.info=e,this.options=t,this.availableArgs=["where","orderBy","skip","cursor","take"],this.allowedProps=["_count"],this.isAggregate=!1}e.getModelMap=function(e,t){var n=null==e?void 0:e.match(/@PrismaSelect.map\(\[(.*?)\]\)/);return!(!n||!t)&&n[1].replace(/ /g,"").split(",").filter((function(e){return e})).includes(t)};var n=e.prototype;return n.model=function(t){return this.dataModel.find((function(n){return n.name===t||e.getModelMap(n.documentation,t)}))},n.field=function(e,t){return null==t?void 0:t.fields.find((function(t){return t.name===e}))},e.isObject=function(e){return e&&"object"==typeof e&&!Array.isArray(e)},e.mergeDeep=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];if(!r.length)return t;var o=r.shift();if(e.isObject(t)&&e.isObject(o))for(var u in o){var l,a;e.isObject(o[u])?(t[u]||Object.assign(t,((l={})[u]={},l)),e.mergeDeep(t[u],o[u])):Object.assign(t,((a={})[u]=o[u],a))}return e.mergeDeep.apply(e,[t].concat(r))},n.valueOf=function(t,n,r){void 0===r&&(r={});for(var i,o=t.split("."),u=this.getSelect(this.fields),a=l(o);!(i=a()).done;){var s=i.value;if(this.isAggregate&&u.hasOwnProperty(s))u=u[s];else{if(this.isAggregate||!u.hasOwnProperty("select")||!u.select.hasOwnProperty(s))return{};u=u.select[s]}}return n?e.mergeDeep(this.filterBy(n,u),r):u},n.valueWithFilter=function(e){return this.filterBy(e,this.getSelect(this.fields))},n.filterBy=function(e,t){var n=this,r=this.model(e);if(r&&"object"==typeof t){var i={};if(this.defaultFields&&this.defaultFields[e]){var u=this.defaultFields[e];i="function"==typeof u?u(t.select):u}var l=o({},t,{select:o({},i)});return Object.keys(t.select).forEach((function(e){if(n.allowedProps.includes(e))l.select[e]=t.select[e];else{var i=n.field(e,r);if(i)if("object"!==i.kind)l.select[e]=!0;else{var o=n.filterBy(i.type.toString(),t.select[e]);Object.keys(o.select).length>0&&(l.select[e]=o)}}})),l}return t},n.getSelect=function(e){var t=this,n=this.isAggregate?{}:{select:{}};return Object.keys(e).forEach((function(r){0===Object.keys(e[r]).length?t.isAggregate?n[r]=!0:n.select[r]=!0:"__arguments"===r?e[r].forEach((function(e){Object.keys(e).forEach((function(r){t.availableArgs.includes(r)&&(n[r]=e[r].value)}))})):t.isAggregate?n[r]=t.getSelect(e[r]):n.select[r]=t.getSelect(e[r])})),n},i(e,[{key:"value",get:function(){var e=this.info.returnType.toString().replace(/]/g,"").replace(/\[/g,"").replace(/!/g,"");return this.isAggregate=e.includes("Aggregate"),this.valueWithFilter(e)}},{key:"dataModel",get:function(){var e,t=[];if(null===(e=this.options)||void 0===e?void 0:e.dmmf){var n;null===(n=this.options)||void 0===n||n.dmmf.forEach((function(e){t.push.apply(t,e.datamodel.models)}))}else{var r=require("@prisma/client").Prisma;r.dmmf&&r.dmmf.datamodel&&t.push.apply(t,r.dmmf.datamodel.models)}return t}},{key:"defaultFields",get:function(){var e;return null===(e=this.options)||void 0===e?void 0:e.defaultFields}},{key:"fields",get:function(){return t(this.info,{},{excludedFields:["__typename"],processArguments:!0})}}]),e}(),s=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var o=1&i?t:n;if(o){try{c(r,1,o(this.v))}catch(e){c(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?c(r,1,t?t(i):i):n?c(r,1,n(i)):c(r,2,i)}catch(e){c(r,2,e)}},r},e}();function c(e,t,n){if(!e.s){if(n instanceof s){if(!n.s)return void(n.o=c.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(c.bind(null,e,t),c.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}function f(e){return e instanceof s&&1&e.s}function d(e,t,n){var r,i,o=-1;return function u(l){try{for(;++o<e.length&&(!n||!n());)if((l=t(o))&&l.then){if(!f(l))return void l.then(u,i||(i=c.bind(null,r=new s,2)));l=l.v}r?c(r,1,l):r=l}catch(e){c(r||(r=new s),2,e)}}(),r}var p="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function v(e,t,n){if("function"==typeof e[p]){var r,i,o,u=e[p]();if(function e(l){try{for(;!((r=u.next()).done||n&&n());)if((l=t(r.value))&&l.then){if(!f(l))return void l.then(e,o||(o=c.bind(null,i=new s,2)));l=l.v}i?c(i,1,l):i=l}catch(e){c(i||(i=new s),2,e)}}(),u.return){var l=function(e){try{r.done||u.return()}catch(e){}return e};if(i&&i.then)return i.then(l,(function(e){throw l(e)}));l()}return i}if(!("length"in e))throw new TypeError("Object is not iterable");for(var a=[],v=0;v<e.length;v++)a.push(e[v]);return d(a,(function(e){return t(a[e])}),n)}function h(){var e,t,n=(e=["\n ","\n "],t||(t=e.slice(0)),e.raw=t,e);return h=function(){return n},n}"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var m=[],y=function e(t,n){var r,i,o,u,a=null==n||null===(r=n.dmmf)||void 0===r?void 0:r.schema;a||(a=null===(u=require("@prisma/client").Prisma.dmmf)||void 0===u?void 0:u.schema),m.push(t);var s=a?[].concat(null===(i=a)||void 0===i?void 0:i.inputObjectTypes.prisma):[];(null===(o=a)||void 0===o?void 0:o.inputObjectTypes.model)&&s.push.apply(s,a.inputObjectTypes.model);var c=s.find((function(e){return e.name===t}));if(c){if(0===c.fields.length)return!0;for(var f,d=l(c.fields);!(f=d()).done;){var p=g(f.value,n);if(p.type!==t&&"inputObjectTypes"===p.location&&!m.includes(p.type)&&e(p.type,n))return!0}}return!1},g=function(e,t){var n=0;return(null==t?void 0:t.doNotUseFieldUpdateOperationsInput)&&e.inputTypes.length>1&&e.inputTypes[1].type.endsWith("FieldUpdateOperationsInput")||e.inputTypes.length>1&&("inputObjectTypes"===e.inputTypes[1].location||e.inputTypes[1].isList||"Json"===e.inputTypes[1].type)&&(n=1),e.inputTypes[n]};function b(e){var t,n,r=null==e||null===(t=e.dmmf)||void 0===t?void 0:t.schema;r||(r=null===(n=require("@prisma/client").Prisma.dmmf)||void 0===n?void 0:n.schema);var i="\n scalar DateTime\n \n type BatchPayload {\n count: Int!\n}\n";if(r){var o,u=[].concat(r.enumTypes.prisma);r.enumTypes.model&&u.push.apply(u,r.enumTypes.model),u.forEach((function(e){i+="enum "+e.name+" {",e.values.forEach((function(e){i+="\n "+e})),i+="}\n \n "}));var l=[].concat(r.inputObjectTypes.prisma);r.inputObjectTypes.model&&l.push.apply(l,r.inputObjectTypes.model),l.forEach((function(t){t.fields.length>0&&(i+="input "+t.name+" {\n ",("function"==typeof(null==e?void 0:e.filterInputs)?e.filterInputs(t):t.fields).filter((function(t){var n;return!(null==e||null===(n=e.excludeFields)||void 0===n?void 0:n.includes(t.name))})).forEach((function(t){var n=g(t,e);"inputObjectTypes"===n.location&&y(n.type,e)||(i+=t.name+": "+(n.isList?"["+n.type+"!]":n.type)+(t.isRequired?"!":"")+"\n ")})),i+="}\n \n ")})),null===(o=r)||void 0===o||o.outputObjectTypes.prisma.filter((function(e){return e.name.includes("Aggregate")||e.name.endsWith("CountOutputType")})).forEach((function(t){i+="type "+t.name+" {\n ",t.fields.filter((function(t){var n;return!(null==e||null===(n=e.excludeFields)||void 0===n?void 0:n.includes(t.name))})).forEach((function(e){i+=e.name+": "+(e.outputType.isList?"["+e.outputType.type+"!]":e.outputType.type)+(e.isNullable?"":"!")+"\n "})),i+="}\n \n "}))}return i}exports.PrismaDelete=function(){function e(e,t){this.prisma=e,this.options=t}var t=e.prototype;return t.getModel=function(e){var t;return null===(t=this.dataModel)||void 0===t?void 0:t.models.find((function(t){return t.name===e}))},e.getModelName=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},t.getFieldByType=function(e,t){var n;return null===(n=this.getModel(e))||void 0===n?void 0:n.fields.find((function(e){return e.type===t&&!e.isList}))},t.getModelIdFieldName=function(e){var t,n;return null===(t=this.getModel(e))||void 0===t||null===(n=t.fields.find((function(e){return e.isId})))||void 0===n?void 0:n.name},t.getOnDeleteFields=function(e,t){var n;return null===(n=this.getModel(e))||void 0===n?void 0:n.fields.filter((function(e){var n,r;return(null===(n=e.documentation)||void 0===n?void 0:n.includes("@onDelete"))&&(null===(r=e.documentation)||void 0===r?void 0:r.includes(t))}))},t.setFieldNull=function(t,n,r){try{var i=this,u=e.getModelName(t),l=i.getModelIdFieldName(t),a=i.getModelIdFieldName(n.type.toString());return Promise.resolve(function(){if(l&&a&&!n.isRequired){var e,t,s,c=n.isList?((t={})[n.name]={select:(e={},e[a]=!0,e)},t):{};return Promise.resolve(i.prisma[u].findMany({where:r,select:o((s={},s[l]=!0,s),c)})).then((function(e){return v(e,(function(e){var t=function(){var t,r;if(!n.isList||0!==e[n.name].length)return Promise.resolve(i.prisma[u].update({where:(t={},t[l]=e[l],t),data:(r={},r[n.name]={disconnect:!n.isList||e[n.name]},r)})).then((function(){}))}();if(t&&t.then)return t.then((function(){}))}))}))}}())}catch(e){return Promise.reject(e)}},t.getDeleteArray=function(t,n,r){void 0===r&&(r=!0);try{var i=function(){var r=o.getOnDeleteFields(t,"CASCADE"),i=function(){if(r)return v(r,(function(r){var i=o.getFieldByType(r.type.toString(),t),l=function(){if(i){var l=function(){if(r.type!==t){var l,a=u.push;return Promise.resolve(o.getDeleteArray(r.type.toString(),(l={},l[i.name]=n,l))).then((function(e){a.call.apply(a,[u].concat(e))}))}var s;u.push({name:e.getModelName(t),where:(s={},s[i.name]=n,s)})}();if(l&&l.then)return l.then((function(){}))}}();if(l&&l.then)return l.then((function(){}))}))}();return i&&i.then?i.then((function(){return u})):u},o=this,u=r?[{name:e.getModelName(t),where:n}]:[],l=o.getOnDeleteFields(t,"SET_NULL"),a=function(){if(l){var e=v(l,(function(e){return Promise.resolve(o.setFieldNull(t,e,n)).then((function(){}))}));if(e&&e.then)return e.then((function(){}))}}();return Promise.resolve(a&&a.then?a.then(i):i())}catch(e){return Promise.reject(e)}},t.onDelete=function(e){var t=e.model,n=e.where,r=e.deleteParent;try{var i=this;return Promise.resolve(i.getDeleteArray(t,n,!!r)).then((function(e){var t=!1,n=e.reverse();return d(n,(function(e){return e+1===n.length&&r?(t=!0,Promise.resolve(i.prisma[n[e].name].deleteMany({where:n[e].where}))):Promise.resolve(i.prisma[n[e].name].deleteMany({where:n[e].where})).then((function(){}))}),(function(){return t}))}))}catch(e){return Promise.reject(e)}},i(e,[{key:"getDMMF",get:function(){return require("@prisma/client").Prisma.dmmf}},{key:"dataModel",get:function(){var e,t,n,r;return(null===(e=this.options)||void 0===e?void 0:e.dmmf)?null===(t=this.options)||void 0===t||null===(n=t.dmmf)||void 0===n?void 0:n.datamodel:null===(r=this.getDMMF)||void 0===r?void 0:r.datamodel}}]),e}(),exports.PrismaSelect=a,exports.generateGraphQlSDLFile=function(e,t){void 0===t&&(t="schema.graphql");var r=require("graphql");n.writeFileSync(t,(0,r.printSchema)(e))},exports.generateInputsString=b,exports.getInputType=g,exports.hasEmptyTypeFields=y,exports.sdlInputs=function(e){return require("graphql-tag")(h(),b(e))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("graphql-fields"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("fs");function n(e,t,r,n,i,o,a){try{var u=e[o](a),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function u(e){n(a,i,o,u,l,"next",e)}function l(e){n(a,i,o,u,l,"throw",e)}u(void 0)}))}}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c=function(){function e(e,t){this.info=e,this.options=t,this.availableArgs=["where","orderBy","skip","cursor","take"],this.allowedProps=["_count"],this.isAggregate=!1}e.getModelMap=function(e,t){var r=null==e?void 0:e.match(/@PrismaSelect.map\(\[(.*?)\]\)/);return!(!r||!t)&&r[1].replace(/ /g,"").split(",").filter((function(e){return e})).includes(t)};var r=e.prototype;return r.model=function(t){return this.dataModel.find((function(r){return r.name===t||e.getModelMap(r.documentation,t)}))},r.field=function(e,t){return null==t?void 0:t.fields.find((function(t){return t.name===e}))},e.isObject=function(e){return e&&"object"==typeof e&&!Array.isArray(e)},e.mergeDeep=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];if(!n.length)return t;var o=n.shift();if(e.isObject(t)&&e.isObject(o))for(var a in o){var u,l;e.isObject(o[a])?(t[a]||Object.assign(t,((u={})[a]={},u)),e.mergeDeep(t[a],o[a])):Object.assign(t,((l={})[a]=o[a],l))}return e.mergeDeep.apply(e,[t].concat(n))},r.valueOf=function(t,r,n){void 0===n&&(n={});for(var i,o=t.split("."),a=this.getSelect(this.fields),u=s(o);!(i=u()).done;){var l=i.value;if(this.isAggregate&&a.hasOwnProperty(l))a=a[l];else{if(this.isAggregate||!a.hasOwnProperty("select")||!a.select.hasOwnProperty(l))return{};a=a.select[l]}}return r?e.mergeDeep(this.filterBy(r,a),n):a},r.valueWithFilter=function(e){return this.filterBy(e,this.getSelect(this.fields))},r.filterBy=function(e,t){var r=this,n=this.model(e);if(n&&"object"==typeof t){var i={};if(this.defaultFields&&this.defaultFields[e]){var o=this.defaultFields[e];i="function"==typeof o?o(t.select):o}var a=u({},t,{select:u({},i)});return Object.keys(t.select).forEach((function(e){if(r.allowedProps.includes(e))a.select[e]=t.select[e];else{var i=r.field(e,n);if(i)if("object"!==i.kind)a.select[e]=!0;else{var o=r.filterBy(i.type,t.select[e]);!0===o?a.select[e]=!0:Object.keys(o.select).length>0&&(a.select[e]=o)}}})),a}return t},r.getSelect=function(e){var t=this,r=this.isAggregate?{}:{select:{}};return Object.keys(e).forEach((function(n){0===Object.keys(e[n]).length?t.isAggregate?r[n]=!0:r.select[n]=!0:"__arguments"===n?e[n].forEach((function(e){Object.keys(e).forEach((function(n){t.availableArgs.includes(n)&&(r[n]=e[n].value)}))})):t.isAggregate?r[n]=t.getSelect(e[n]):r.select[n]=t.getSelect(e[n])})),r},a(e,[{key:"value",get:function(){var e=this.info.returnType.toString().replace(/]/g,"").replace(/\[/g,"").replace(/!/g,"");return this.isAggregate=e.includes("Aggregate"),this.valueWithFilter(e)}},{key:"dataModel",get:function(){var e,t=[];if(null!=(e=this.options)&&e.dmmf){var r;null==(r=this.options)||r.dmmf.forEach((function(e){t.push.apply(t,e.datamodel.models)}))}else{var n=require("@prisma/client").Prisma;n.dmmf&&n.dmmf.datamodel&&t.push.apply(t,n.dmmf.datamodel.models)}return t}},{key:"defaultFields",get:function(){var e;return null==(e=this.options)?void 0:e.defaultFields}},{key:"fields",get:function(){return t(this.info,{},{excludedFields:["__typename"],processArguments:!0})}}]),e}();function f(e,t){return e(t={exports:{}},t.exports),t.exports}var p,h=f((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i=Object.create((t&&t.prototype instanceof f?t:f).prototype),o=new j(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===c)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=s(e,t,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}(e,r,o),i}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var c={};function f(){}function p(){}function h(){}var d={};u(d,i,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(k([])));v&&v!==t&&r.call(v,i)&&(d=v);var m=h.prototype=f.prototype=Object.create(d);function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,u){var l=s(e[i],e,o);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,u)}))}u(l.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function k(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=h,u(m,"constructor",h),u(h,"constructor",p),p.displayName=u(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(b.prototype),u(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(l(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),u(m,a,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=k,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(u&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),d=[],y=function e(t,r){var n,i,o,a,u=null==r||null==(n=r.dmmf)?void 0:n.schema;u||(u=null==(a=require("@prisma/client").Prisma.dmmf)?void 0:a.schema),d.push(t);var l=u?[].concat(null==(i=u)?void 0:i.inputObjectTypes.prisma):[];null!=(o=u)&&o.inputObjectTypes.model&&l.push.apply(l,u.inputObjectTypes.model);var c=l.find((function(e){return e.name===t}));if(c){if(0===c.fields.length)return!0;for(var f,p=s(c.fields);!(f=p()).done;){var h=v(f.value,r);if(h.type!==t&&"inputObjectTypes"===h.location&&!d.includes(h.type)&&e(h.type,r))return!0}}return!1},v=function(e,t){var r=0;return null!=t&&t.doNotUseFieldUpdateOperationsInput&&e.inputTypes.length>1&&e.inputTypes[1].type.endsWith("FieldUpdateOperationsInput")||e.inputTypes.length>1&&("inputObjectTypes"===e.inputTypes[1].location||e.inputTypes[1].isList||"Json"===e.inputTypes[1].type)&&(r=1),e.inputTypes[r]};function m(e){var t,r,n=null==e||null==(t=e.dmmf)?void 0:t.schema;n||(n=null==(r=require("@prisma/client").Prisma.dmmf)?void 0:r.schema);var i="\n scalar DateTime\n \n type BatchPayload {\n count: Int!\n}\n";if(n){var o,a=[].concat(n.enumTypes.prisma);n.enumTypes.model&&a.push.apply(a,n.enumTypes.model),a.forEach((function(e){i+="enum "+e.name+" {",e.values.forEach((function(e){i+="\n "+e})),i+="}\n \n "}));var u=[].concat(n.inputObjectTypes.prisma);n.inputObjectTypes.model&&u.push.apply(u,n.inputObjectTypes.model),u.forEach((function(t){t.fields.length>0&&(i+="input "+t.name+" {\n ",("function"==typeof(null==e?void 0:e.filterInputs)?e.filterInputs(t):t.fields).filter((function(t){var r;return!(null!=e&&null!=(r=e.excludeFields)&&r.includes(t.name))})).forEach((function(t){var r=v(t,e);"inputObjectTypes"===r.location&&y(r.type,e)||(i+=t.name+": "+(r.isList?"["+r.type+"!]":r.type)+(t.isRequired?"!":"")+"\n ")})),i+="}\n \n ")})),null==(o=n)||o.outputObjectTypes.prisma.filter((function(e){return e.name.includes("Aggregate")||e.name.endsWith("CountOutputType")})).forEach((function(t){i+="type "+t.name+" {\n ",t.fields.filter((function(t){var r;return!(null!=e&&null!=(r=e.excludeFields)&&r.includes(t.name))})).forEach((function(e){i+=e.name+": "+(e.outputType.isList?"["+e.outputType.type+"!]":e.outputType.type)+(e.isNullable?"":"!")+"\n "})),i+="}\n \n "}))}return i}exports.PrismaDelete=function(){function e(e,t){this.prisma=e,this.options=t}var t=e.prototype;return t.getModel=function(e){var t;return null==(t=this.dataModel)?void 0:t.models.find((function(t){return t.name===e}))},e.getModelName=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},t.getFieldByType=function(e,t){var r;return null==(r=this.getModel(e))?void 0:r.fields.find((function(e){return e.type===t&&!e.isList}))},t.getModelIdFieldName=function(e){var t,r;return null==(t=this.getModel(e))||null==(r=t.fields.find((function(e){return e.isId})))?void 0:r.name},t.getOnDeleteFields=function(e,t){var r;return null==(r=this.getModel(e))?void 0:r.fields.filter((function(e){var r,n;return(null==(r=e.documentation)?void 0:r.includes("@onDelete"))&&(null==(n=e.documentation)?void 0:n.includes(t))}))},t.setFieldNull=function(){var t=i(h.mark((function t(r,n,i){var o,a,l,c,f,p,d,y,v,m,g,b;return h.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=e.getModelName(r),a=this.getModelIdFieldName(r),l=this.getModelIdFieldName(n.type),!a||!l||n.isRequired){t.next=16;break}return d=n.isList?((f={})[n.name]={select:(c={},c[l]=!0,c)},f):{},t.next=7,this.prisma[o].findMany({where:i,select:u((p={},p[a]=!0,p),d)});case 7:y=s(t.sent);case 9:if((v=y()).done){t.next=16;break}if(m=v.value,n.isList&&0===m[n.name].length){t.next=14;break}return t.next=14,this.prisma[o].update({where:(g={},g[a]=m[a],g),data:(b={},b[n.name]={disconnect:!n.isList||m[n.name]},b)});case 14:t.next=9;break;case 16:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),t.getDeleteArray=function(){var t=i(h.mark((function t(r,n,i){var o,a,u,l,c,f,p,d,y,v,m,g;return h.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===i&&(i=!0),o=i?[{name:e.getModelName(r),where:n}]:[],!(a=this.getOnDeleteFields(r,"SET_NULL"))){t.next=11;break}u=s(a);case 5:if((l=u()).done){t.next=11;break}return c=l.value,t.next=9,this.setFieldNull(r,c,n);case 9:t.next=5;break;case 11:if(!(f=this.getOnDeleteFields(r,"CASCADE"))){t.next=30;break}p=s(f);case 14:if((d=p()).done){t.next=30;break}if(!(v=this.getFieldByType((y=d.value).type,r))){t.next=28;break}if(y.type===r){t.next=27;break}return t.t0=o.push,t.t1=o,t.next=23,this.getDeleteArray(y.type,((m={})[v.name]=n,m));case 23:t.t2=t.sent,t.t0.apply.call(t.t0,t.t1,t.t2),t.next=28;break;case 27:o.push({name:e.getModelName(r),where:(g={},g[v.name]=n,g)});case 28:t.next=14;break;case 30:return t.abrupt("return",o);case 31:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),t.onDelete=function(){var e=i(h.mark((function e(t){var r,n,i,o,a;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.model,n=t.where,i=t.deleteParent,e.next=3,this.getDeleteArray(r,n,!!i);case 3:o=e.sent.reverse(),a=0;case 5:if(!(a<o.length)){e.next=17;break}if(a+1!==o.length||!i){e.next=12;break}return e.next=9,this.prisma[o[a].name].deleteMany({where:o[a].where});case 9:return e.abrupt("return",e.sent);case 12:return e.next=14,this.prisma[o[a].name].deleteMany({where:o[a].where});case 14:++a,e.next=5;break;case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a(e,[{key:"getDMMF",get:function(){return require("@prisma/client").Prisma.dmmf}},{key:"dataModel",get:function(){var e,t,r,n;return null!=(e=this.options)&&e.dmmf?null==(t=this.options)||null==(r=t.dmmf)?void 0:r.datamodel:null==(n=this.getDMMF)?void 0:n.datamodel}}]),e}(),exports.PrismaSelect=c,exports.generateGraphQlSDLFile=function(e,t){void 0===t&&(t="schema.graphql");var n=require("graphql");r.writeFileSync(t,(0,n.printSchema)(e))},exports.generateInputsString=m,exports.getInputType=v,exports.hasEmptyTypeFields=y,exports.sdlInputs=function(e){var t,r;return require("graphql-tag")(p||(t=["\n ","\n "],r||(r=t.slice(0)),t.raw=r,p=t),m(e))};
//# sourceMappingURL=plugins.cjs.production.min.js.map
import graphqlFields from 'graphql-fields';
import { writeFileSync } from 'fs';
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);
}
}
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);
});
};
}
function _defineProperties(target, props) {

@@ -17,2 +53,5 @@ for (var i = 0; i < props.length; i++) {

if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;

@@ -66,24 +105,20 @@ }

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
return {
done: false,
value: o[i++]
};
};
}
it = o[Symbol.iterator]();
return it.next.bind(it);
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -140,3 +175,3 @@

PrismaSelect.getModelMap = function getModelMap(docs, name) {
var value = docs === null || docs === void 0 ? void 0 : docs.match(/@PrismaSelect.map\(\[(.*?)\]\)/);
var value = docs == null ? void 0 : docs.match(/@PrismaSelect.map\(\[(.*?)\]\)/);

@@ -162,3 +197,3 @@ if (value && name) {

_proto.field = function field(name, model) {
return model === null || model === void 0 ? void 0 : model.fields.find(function (item) {
return model == null ? void 0 : model.fields.find(function (item) {
return item.name === name;

@@ -295,5 +330,7 @@ });

} else {
var subModelFilter = _this.filterBy(field.type.toString(), selectObject.select[key]);
var subModelFilter = _this.filterBy(field.type, selectObject.select[key]);
if (Object.keys(subModelFilter.select).length > 0) {
if (subModelFilter === true) {
filteredObject.select[key] = true;
} else if (Object.keys(subModelFilter.select).length > 0) {
filteredObject.select[key] = subModelFilter;

@@ -357,6 +394,6 @@ }

if ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.dmmf) {
if ((_this$options = this.options) != null && _this$options.dmmf) {
var _this$options2;
(_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.dmmf.forEach(function (doc) {
(_this$options2 = this.options) == null ? void 0 : _this$options2.dmmf.forEach(function (doc) {
models.push.apply(models, doc.datamodel.models);

@@ -380,3 +417,3 @@ });

return (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.defaultFields;
return (_this$options3 = this.options) == null ? void 0 : _this$options3.defaultFields;
}

@@ -396,193 +433,731 @@ }, {

// A type of promise-like that resolves synchronously and supports only one observer
var _Pact = /*#__PURE__*/function () {
function _Pact() {}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
_Pact.prototype.then = function (onFulfilled, onRejected) {
var result = new _Pact();
var state = this.s;
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = function (exports) {
if (state) {
var callback = state & 1 ? onFulfilled : onRejected;
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1; // More compressible than void 0.
if (callback) {
try {
_settle(result, 1, callback(this.v));
} catch (e) {
_settle(result, 2, e);
}
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
return result;
} else {
return this;
}
function define(obj, key, value) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
}
this.o = function (_this) {
try {
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
define({}, "");
} catch (err) {
define = function define(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
var value = _this.v;
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
if (_this.s & 1) {
_settle(result, 1, onFulfilled ? onFulfilled(value) : value);
} else if (onRejected) {
_settle(result, 1, onRejected(value));
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function () {
return this;
});
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = GeneratorFunctionPrototype;
define(Gp, "constructor", GeneratorFunctionPrototype);
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
define(prototype, method, function (arg) {
return this._invoke(method, arg);
});
});
}
exports.isGeneratorFunction = function (genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
};
exports.mark = function (genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define(genFun, toStringTagSymbol, "GeneratorFunction");
}
genFun.prototype = Object.create(Gp);
return genFun;
}; // Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function (arg) {
return {
__await: arg
};
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
_settle(result, 2, value);
var result = record.arg;
var value = result.value;
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value).then(function (unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function (error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
}
} catch (e) {
_settle(result, 2, e);
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = // If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
} // Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
return this;
});
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
};
return result;
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
return _Pact;
}(); // Settles a pact synchronously
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
} // Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
function _settle(pact, state, value) {
if (!pact.s) {
if (value instanceof _Pact) {
if (value.s) {
if (state & 1) {
state = value.s;
return doneResult();
}
value = value.v;
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted; // Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
} // Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
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 (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (!info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
}
} else {
value.o = _settle.bind(null, pact, state);
return;
// Re-yield the result returned by the delegate method.
return info;
} // The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
} // Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
define(Gp, iteratorSymbol, function () {
return this;
});
define(Gp, "toString", function () {
return "[object Generator]";
});
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
if (value && value.then) {
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
return;
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
pact.s = state;
pact.v = value;
var observer = pact.o;
if (observer) {
observer(pact);
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{
tryLoc: "root"
}];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
}
}
function _isSettledPact(thenable) {
return thenable instanceof _Pact && thenable.s & 1;
} // Converts argument to a function that always returns a Promise
function _forTo(array, body, check) {
var i = -1,
pact,
reject;
exports.keys = function (object) {
var keys = [];
function _cycle(result) {
try {
while (++i < array.length && (!check || !check())) {
result = body(i);
for (var key in object) {
keys.push(key);
}
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
keys.reverse(); // Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
} // To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
}
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined$1;
next.done = true;
return next;
};
return next.next = next;
}
} // Return an iterator with no values.
return {
next: doneResult
};
}
}
_cycle();
exports.values = values;
return pact;
} // Asynchronously iterate through an object's properties (including properties inherited from the prototype)
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator"; // Asynchronously iterate through an object's values
// Uses for...of if the runtime supports it, otherwise iterates until length on a copy
function doneResult() {
return {
value: undefined$1,
done: true
};
}
function _forOf(target, body, check) {
if (typeof target[_iteratorSymbol] === "function") {
var _cycle = function _cycle(result) {
try {
while (!(step = iterator.next()).done && (!check || !check())) {
result = body(step.value);
Context.prototype = {
constructor: Context,
reset: function reset(skipTempReset) {
this.prev = 0;
this.next = 0; // Resetting context._sent for legacy support of Babel's
// function.sent implementation.
if (result && result.then) {
if (_isSettledPact(result)) {
result = result.v;
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function stop() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined$1;
}
return !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
return;
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (pact) {
_settle(pact, 1, result);
} else {
pact = result;
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
} catch (e) {
_settle(pact || (pact = new _Pact()), 2, e);
}
};
var iterator = target[_iteratorSymbol](),
step,
pact,
reject;
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
_cycle();
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (iterator["return"]) {
var _fixup = function _fixup(value) {
try {
if (!step.done) {
iterator["return"]();
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function complete(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" || record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
} catch (e) {}
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
return value;
};
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (pact && pact.then) {
return pact.then(_fixup, function (e) {
throw _fixup(e);
});
}
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
_fixup();
}
return thrown;
}
} // The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
return pact;
} // No support for Symbol.iterator
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (!("length" in target)) {
throw new TypeError("Object is not iterable");
} // Handle live collections properly
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined$1;
}
return ContinueSentinel;
}
}; // Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
var values = [];
return exports;
}( // If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
module.exports );
for (var i = 0; i < target.length; i++) {
values.push(target[i]);
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured. Just
// in case runtime.js accidentally runs in strict mode, in modern engines
// we can explicitly access globalThis. In older engines we can escape
// strict mode using a global Function call. This could conceivably fail
// if a Content Security Policy forbids using Function, but in that case
// the proper solution is to fix the accidental strict mode problem. If
// you've misconfigured your bundler to force strict mode and applied a
// CSP to forbid Function, and you're not willing to fix either of those
// problems, please detail your unique predicament in a GitHub issue.
if (typeof globalThis === "object") {
globalThis.regeneratorRuntime = runtime;
} else {
Function("r", "regeneratorRuntime = r")(runtime);
}
}
});
return _forTo(values, function (i) {
return body(values[i]);
}, check);
}
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator"; // Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing
/**

@@ -617,3 +1192,3 @@ * Handle all relation onDelete type

return (_this$dataModel = this.dataModel) === null || _this$dataModel === void 0 ? void 0 : _this$dataModel.models.find(function (item) {
return (_this$dataModel = this.dataModel) == null ? void 0 : _this$dataModel.models.find(function (item) {
return item.name === modelName;

@@ -630,3 +1205,3 @@ });

return (_this$getModel = this.getModel(modelName)) === null || _this$getModel === void 0 ? void 0 : _this$getModel.fields.find(function (item) {
return (_this$getModel = this.getModel(modelName)) == null ? void 0 : _this$getModel.fields.find(function (item) {
return item.type === fieldType && !item.isList;

@@ -639,5 +1214,5 @@ });

return (_this$getModel2 = this.getModel(modelName)) === null || _this$getModel2 === void 0 ? void 0 : (_this$getModel2$field = _this$getModel2.fields.find(function (item) {
return (_this$getModel2 = this.getModel(modelName)) == null ? void 0 : (_this$getModel2$field = _this$getModel2.fields.find(function (item) {
return item.isId;
})) === null || _this$getModel2$field === void 0 ? void 0 : _this$getModel2$field.name;
})) == null ? void 0 : _this$getModel2$field.name;
};

@@ -648,126 +1223,187 @@

return (_this$getModel3 = this.getModel(modelName)) === null || _this$getModel3 === void 0 ? void 0 : _this$getModel3.fields.filter(function (item) {
return (_this$getModel3 = this.getModel(modelName)) == null ? void 0 : _this$getModel3.fields.filter(function (item) {
var _item$documentation, _item$documentation2;
return ((_item$documentation = item.documentation) === null || _item$documentation === void 0 ? void 0 : _item$documentation.includes('@onDelete')) && ((_item$documentation2 = item.documentation) === null || _item$documentation2 === void 0 ? void 0 : _item$documentation2.includes(type));
return ((_item$documentation = item.documentation) == null ? void 0 : _item$documentation.includes('@onDelete')) && ((_item$documentation2 = item.documentation) == null ? void 0 : _item$documentation2.includes(type));
});
};
_proto.setFieldNull = function setFieldNull(modelName, field, where) {
try {
var _this2 = this;
_proto.setFieldNull = /*#__PURE__*/function () {
var _setFieldNull = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(modelName, field, where) {
var name, modelId, fieldModelId, _select, _ref, _extends2, fieldSelect, results, _iterator, _step, result, _where, _data;
var name = PrismaDelete.getModelName(modelName);
return runtime_1.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
name = PrismaDelete.getModelName(modelName);
modelId = this.getModelIdFieldName(modelName);
fieldModelId = this.getModelIdFieldName(field.type);
var modelId = _this2.getModelIdFieldName(modelName);
if (!(modelId && fieldModelId && !field.isRequired)) {
_context.next = 16;
break;
}
var fieldModelId = _this2.getModelIdFieldName(field.type.toString());
fieldSelect = field.isList ? (_ref = {}, _ref[field.name] = {
select: (_select = {}, _select[fieldModelId] = true, _select)
}, _ref) : {};
_context.next = 7;
return this.prisma[name].findMany({
where: where,
select: _extends((_extends2 = {}, _extends2[modelId] = true, _extends2), fieldSelect)
});
return Promise.resolve(function () {
if (modelId && fieldModelId && !field.isRequired) {
var _select, _ref, _extends2;
case 7:
results = _context.sent;
_iterator = _createForOfIteratorHelperLoose(results);
var fieldSelect = field.isList ? (_ref = {}, _ref[field.name] = {
select: (_select = {}, _select[fieldModelId] = true, _select)
}, _ref) : {};
return Promise.resolve(_this2.prisma[name].findMany({
where: where,
select: _extends((_extends2 = {}, _extends2[modelId] = true, _extends2), fieldSelect)
})).then(function (results) {
return _forOf(results, function (result) {
var _temp = function () {
if (!(field.isList && result[field.name].length === 0)) {
var _where, _data;
case 9:
if ((_step = _iterator()).done) {
_context.next = 16;
break;
}
return Promise.resolve(_this2.prisma[name].update({
where: (_where = {}, _where[modelId] = result[modelId], _where),
data: (_data = {}, _data[field.name] = {
disconnect: field.isList ? result[field.name] : true
}, _data)
})).then(function () {});
}
}();
result = _step.value;
if (_temp && _temp.then) return _temp.then(function () {});
});
});
if (field.isList && result[field.name].length === 0) {
_context.next = 14;
break;
}
_context.next = 14;
return this.prisma[name].update({
where: (_where = {}, _where[modelId] = result[modelId], _where),
data: (_data = {}, _data[field.name] = {
disconnect: field.isList ? result[field.name] : true
}, _data)
});
case 14:
_context.next = 9;
break;
case 16:
case "end":
return _context.stop();
}
}
}());
} catch (e) {
return Promise.reject(e);
}
};
}, _callee, this);
}));
_proto.getDeleteArray = function getDeleteArray(modelName, whereInput, includeParent) {
if (includeParent === void 0) {
includeParent = true;
function setFieldNull(_x, _x2, _x3) {
return _setFieldNull.apply(this, arguments);
}
try {
var _temp8 = function _temp8() {
var cascadeFields = _this4.getOnDeleteFields(modelName, 'CASCADE');
return setFieldNull;
}();
var _temp5 = function () {
if (cascadeFields) {
return _forOf(cascadeFields, function (cascadeField) {
var childField = _this4.getFieldByType(cascadeField.type.toString(), modelName);
_proto.getDeleteArray = /*#__PURE__*/function () {
var _getDeleteArray = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(modelName, whereInput, includeParent) {
var deleteArray, nullFields, _iterator2, _step2, nullField, cascadeFields, _iterator3, _step3, cascadeField, childField, _this$getDeleteArray, _where2;
var _temp4 = function () {
if (childField) {
var _temp10 = function () {
if (cascadeField.type !== modelName) {
var _this4$getDeleteArray;
return runtime_1.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (includeParent === void 0) {
includeParent = true;
}
var _push2 = deleteArray.push;
return Promise.resolve(_this4.getDeleteArray(cascadeField.type.toString(), (_this4$getDeleteArray = {}, _this4$getDeleteArray[childField.name] = whereInput, _this4$getDeleteArray))).then(function (_this3$getDeleteArray) {
_push2.call.apply(_push2, [deleteArray].concat(_this3$getDeleteArray));
});
} else {
var _where2;
deleteArray = includeParent ? [{
name: PrismaDelete.getModelName(modelName),
where: whereInput
}] : [];
nullFields = this.getOnDeleteFields(modelName, 'SET_NULL');
deleteArray.push({
name: PrismaDelete.getModelName(modelName),
where: (_where2 = {}, _where2[childField.name] = whereInput, _where2)
});
}
}();
if (!nullFields) {
_context2.next = 11;
break;
}
if (_temp10 && _temp10.then) return _temp10.then(function () {});
}
}();
_iterator2 = _createForOfIteratorHelperLoose(nullFields);
if (_temp4 && _temp4.then) return _temp4.then(function () {});
});
}
}();
case 5:
if ((_step2 = _iterator2()).done) {
_context2.next = 11;
break;
}
return _temp5 && _temp5.then ? _temp5.then(function () {
return deleteArray;
}) : deleteArray;
};
nullField = _step2.value;
_context2.next = 9;
return this.setFieldNull(modelName, nullField, whereInput);
var _this4 = this;
case 9:
_context2.next = 5;
break;
var deleteArray = includeParent ? [{
name: PrismaDelete.getModelName(modelName),
where: whereInput
}] : [];
case 11:
cascadeFields = this.getOnDeleteFields(modelName, 'CASCADE');
var nullFields = _this4.getOnDeleteFields(modelName, 'SET_NULL');
if (!cascadeFields) {
_context2.next = 30;
break;
}
var _temp9 = function () {
if (nullFields) {
var _temp11 = _forOf(nullFields, function (nullField) {
return Promise.resolve(_this4.setFieldNull(modelName, nullField, whereInput)).then(function () {});
});
_iterator3 = _createForOfIteratorHelperLoose(cascadeFields);
if (_temp11 && _temp11.then) return _temp11.then(function () {});
case 14:
if ((_step3 = _iterator3()).done) {
_context2.next = 30;
break;
}
cascadeField = _step3.value;
childField = this.getFieldByType(cascadeField.type, modelName);
if (!childField) {
_context2.next = 28;
break;
}
if (!(cascadeField.type !== modelName)) {
_context2.next = 27;
break;
}
_context2.t0 = deleteArray.push;
_context2.t1 = deleteArray;
_context2.next = 23;
return this.getDeleteArray(cascadeField.type, (_this$getDeleteArray = {}, _this$getDeleteArray[childField.name] = whereInput, _this$getDeleteArray));
case 23:
_context2.t2 = _context2.sent;
_context2.t0.apply.call(_context2.t0, _context2.t1, _context2.t2);
_context2.next = 28;
break;
case 27:
deleteArray.push({
name: PrismaDelete.getModelName(modelName),
where: (_where2 = {}, _where2[childField.name] = whereInput, _where2)
});
case 28:
_context2.next = 14;
break;
case 30:
return _context2.abrupt("return", deleteArray);
case 31:
case "end":
return _context2.stop();
}
}
}();
}, _callee2, this);
}));
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(_temp8) : _temp8(_temp9));
} catch (e) {
return Promise.reject(e);
function getDeleteArray(_x4, _x5, _x6) {
return _getDeleteArray.apply(this, arguments);
}
}
return getDeleteArray;
}()
/**

@@ -788,37 +1424,64 @@ * Handle all relation onDelete type

_proto.onDelete = function onDelete(_ref2) {
var model = _ref2.model,
where = _ref2.where,
deleteParent = _ref2.deleteParent;
_proto.onDelete =
/*#__PURE__*/
function () {
var _onDelete = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(_ref2) {
var model, where, deleteParent, results, i;
return runtime_1.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
model = _ref2.model, where = _ref2.where, deleteParent = _ref2.deleteParent;
_context3.next = 3;
return this.getDeleteArray(model, where, !!deleteParent);
try {
var _this6 = this;
case 3:
results = _context3.sent.reverse();
i = 0;
return Promise.resolve(_this6.getDeleteArray(model, where, !!deleteParent)).then(function (_this5$getDeleteArray) {
var _exit = false;
case 5:
if (!(i < results.length)) {
_context3.next = 17;
break;
}
var results = _this5$getDeleteArray.reverse();
if (!(i + 1 === results.length && deleteParent)) {
_context3.next = 12;
break;
}
return _forTo(results, function (i) {
return function () {
if (i + 1 === results.length && deleteParent) {
_exit = true;
return Promise.resolve(_this6.prisma[results[i].name].deleteMany({
_context3.next = 9;
return this.prisma[results[i].name].deleteMany({
where: results[i].where
}));
} else {
return Promise.resolve(_this6.prisma[results[i].name].deleteMany({
});
case 9:
return _context3.abrupt("return", _context3.sent);
case 12:
_context3.next = 14;
return this.prisma[results[i].name].deleteMany({
where: results[i].where
})).then(function () {});
}
}();
}, function () {
return _exit;
});
});
} catch (e) {
return Promise.reject(e);
});
case 14:
++i;
_context3.next = 5;
break;
case 17:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function onDelete(_x7) {
return _onDelete.apply(this, arguments);
}
};
return onDelete;
}();
_createClass(PrismaDelete, [{

@@ -837,10 +1500,10 @@ key: "getDMMF",

if ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.dmmf) {
if ((_this$options = this.options) != null && _this$options.dmmf) {
var _this$options2, _this$options2$dmmf;
return (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$dmmf = _this$options2.dmmf) === null || _this$options2$dmmf === void 0 ? void 0 : _this$options2$dmmf.datamodel;
return (_this$options2 = this.options) == null ? void 0 : (_this$options2$dmmf = _this$options2.dmmf) == null ? void 0 : _this$options2$dmmf.datamodel;
} else {
var _this$getDMMF;
return (_this$getDMMF = this.getDMMF) === null || _this$getDMMF === void 0 ? void 0 : _this$getDMMF.datamodel;
return (_this$getDMMF = this.getDMMF) == null ? void 0 : _this$getDMMF.datamodel;
}

@@ -853,11 +1516,3 @@ }

function _templateObject() {
var data = _taggedTemplateLiteralLoose(["\n ", "\n "]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
var _templateObject;
var testedTypes = [];

@@ -867,3 +1522,3 @@ var hasEmptyTypeFields = function hasEmptyTypeFields(type, options) {

var schema = options === null || options === void 0 ? void 0 : (_options$dmmf = options.dmmf) === null || _options$dmmf === void 0 ? void 0 : _options$dmmf.schema;
var schema = options == null ? void 0 : (_options$dmmf = options.dmmf) == null ? void 0 : _options$dmmf.schema;

@@ -876,8 +1531,8 @@ if (!schema) {

schema = (_Prisma$dmmf = Prisma.dmmf) === null || _Prisma$dmmf === void 0 ? void 0 : _Prisma$dmmf.schema;
schema = (_Prisma$dmmf = Prisma.dmmf) == null ? void 0 : _Prisma$dmmf.schema;
}
testedTypes.push(type);
var inputObjectTypes = schema ? [].concat((_schema = schema) === null || _schema === void 0 ? void 0 : _schema.inputObjectTypes.prisma) : [];
if ((_schema2 = schema) === null || _schema2 === void 0 ? void 0 : _schema2.inputObjectTypes.model) inputObjectTypes.push.apply(inputObjectTypes, schema.inputObjectTypes.model);
var inputObjectTypes = schema ? [].concat((_schema = schema) == null ? void 0 : _schema.inputObjectTypes.prisma) : [];
if ((_schema2 = schema) != null && _schema2.inputObjectTypes.model) inputObjectTypes.push.apply(inputObjectTypes, schema.inputObjectTypes.model);
var inputType = inputObjectTypes.find(function (item) {

@@ -906,3 +1561,3 @@ return item.name === type;

if ((options === null || options === void 0 ? void 0 : options.doNotUseFieldUpdateOperationsInput) && field.inputTypes.length > 1 && field.inputTypes[1].type.endsWith('FieldUpdateOperationsInput')) {
if (options != null && options.doNotUseFieldUpdateOperationsInput && field.inputTypes.length > 1 && field.inputTypes[1].type.endsWith('FieldUpdateOperationsInput')) {
return field.inputTypes[index];

@@ -920,3 +1575,3 @@ }

var schema = options === null || options === void 0 ? void 0 : (_options$dmmf2 = options.dmmf) === null || _options$dmmf2 === void 0 ? void 0 : _options$dmmf2.schema;
var schema = options == null ? void 0 : (_options$dmmf2 = options.dmmf) == null ? void 0 : _options$dmmf2.schema;

@@ -929,3 +1584,3 @@ if (!schema) {

schema = (_Prisma$dmmf2 = Prisma.dmmf) === null || _Prisma$dmmf2 === void 0 ? void 0 : _Prisma$dmmf2.schema;
schema = (_Prisma$dmmf2 = Prisma.dmmf) == null ? void 0 : _Prisma$dmmf2.schema;
}

@@ -952,7 +1607,7 @@

fileContent += "input " + input.name + " {\n ";
var inputFields = typeof (options === null || options === void 0 ? void 0 : options.filterInputs) === 'function' ? options.filterInputs(input) : input.fields;
var inputFields = typeof (options == null ? void 0 : options.filterInputs) === 'function' ? options.filterInputs(input) : input.fields;
inputFields.filter(function (field) {
var _options$excludeField;
return !(options === null || options === void 0 ? void 0 : (_options$excludeField = options.excludeFields) === null || _options$excludeField === void 0 ? void 0 : _options$excludeField.includes(field.name));
return !(options != null && (_options$excludeField = options.excludeFields) != null && _options$excludeField.includes(field.name));
}).forEach(function (field) {

@@ -969,3 +1624,3 @@ var inputType = getInputType(field, options);

});
(_schema3 = schema) === null || _schema3 === void 0 ? void 0 : _schema3.outputObjectTypes.prisma.filter(function (type) {
(_schema3 = schema) == null ? void 0 : _schema3.outputObjectTypes.prisma.filter(function (type) {
return type.name.includes('Aggregate') || type.name.endsWith('CountOutputType');

@@ -977,3 +1632,3 @@ }).forEach(function (type) {

return !(options === null || options === void 0 ? void 0 : (_options$excludeField2 = options.excludeFields) === null || _options$excludeField2 === void 0 ? void 0 : _options$excludeField2.includes(field.name));
return !(options != null && (_options$excludeField2 = options.excludeFields) != null && _options$excludeField2.includes(field.name));
}).forEach(function (field) {

@@ -991,3 +1646,3 @@ fileContent += field.name + ": " + (field.outputType.isList ? "[" + field.outputType.type + "!]" : field.outputType.type) + (!field.isNullable ? '!' : '') + "\n ";

return gql(_templateObject(), generateInputsString(options));
return gql(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n "])), generateInputsString(options));
};

@@ -994,0 +1649,0 @@ var generateGraphQlSDLFile = function generateGraphQlSDLFile(schema, path) {

{
"name": "@paljs/plugins",
"version": "4.0.13",
"version": "4.0.14",
"main": "dist/index.js",

@@ -24,3 +24,3 @@ "module": "dist/plugins.esm.js",

"dependencies": {
"@paljs/types": "^4.0.13",
"@paljs/types": "^4.0.14",
"graphql-fields": "2.0.3",

@@ -33,5 +33,5 @@ "graphql-tag": "2.12.6"

"devDependencies": {
"@prisma/client": "^3.6.0",
"@prisma/client": "^3.10.0",
"graphql": "^15.7.2",
"typescript": "4.5.2"
"typescript": "4.5.5"
},

@@ -41,3 +41,3 @@ "files": [

],
"gitHead": "8707cbecd7431fcc5ab1217deb62c486ce308f49"
"gitHead": "df3e9320741fb6ad3ee73a6c0a3a71c9c136950c"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc