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

@zenstackhq/runtime

Package Overview
Dependencies
Maintainers
0
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zenstackhq/runtime - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

59

enhancements/delegate.js

@@ -169,11 +169,9 @@ "use strict";

}
else {
if (fieldInfo && this.isDelegateOrDescendantOfDelegate(fieldInfo.type)) {
let nextValue = value;
if (nextValue === true) {
// make sure the payload is an object
args[kind][field] = nextValue = {};
}
this.injectSelectIncludeHierarchy(fieldInfo.type, nextValue);
else if (fieldInfo.isDataModel) {
let nextValue = value;
if (nextValue === true) {
// make sure the payload is an object
args[kind][field] = nextValue = {};
}
this.injectSelectIncludeHierarchy(fieldInfo.type, nextValue);
}

@@ -329,4 +327,6 @@ }

}
// note that we can't call `createMany` directly because it doesn't support
// nested created, which is needed for creating base entities
// `createMany` doesn't support nested create, which is needed for creating entities
// inheriting a delegate base, so we need to convert it to a regular `create` here.
// Note that the main difference is `create` doesn't support `skipDuplicates` as
// `createMany` does.
return this.queryUtils.transaction(this.prisma, (tx) => __awaiter(this, void 0, void 0, function* () {

@@ -358,9 +358,24 @@ const r = yield Promise.all((0, cross_1.enumerate)(args.data).map((item) => __awaiter(this, void 0, void 0, function* () {

},
createMany: (model, args, _context) => {
if (args.skipDuplicates) {
throw (0, utils_1.prismaClientValidationError)(this.prisma, this.options.prismaModule, '`createMany` with `skipDuplicates` set to true is not supported for delegated models');
createMany: (model, args, context) => {
// `createMany` doesn't support nested create, which is needed for creating entities
// inheriting a delegate base, so we need to convert it to a regular `create` here.
// Note that the main difference is `create` doesn't support `skipDuplicates` as
// `createMany` does.
var _a;
if (this.isDelegateOrDescendantOfDelegate(model)) {
if (args.skipDuplicates) {
throw (0, utils_1.prismaClientValidationError)(this.prisma, this.options.prismaModule, '`createMany` with `skipDuplicates` set to true is not supported for delegated models');
}
// convert to regular `create`
let createPayload = (_a = context.parent.create) !== null && _a !== void 0 ? _a : [];
if (!Array.isArray(createPayload)) {
createPayload = [createPayload];
}
for (const item of (0, cross_1.enumerate)(args.data)) {
this.doProcessCreatePayload(model, item);
createPayload.push(item);
}
context.parent.create = createPayload;
delete context.parent['createMany'];
}
for (const item of (0, cross_1.enumerate)(args === null || args === void 0 ? void 0 : args.data)) {
this.doProcessCreatePayload(model, item);
}
},

@@ -385,4 +400,4 @@ });

// ensure the full nested "create" structure is created for base types
ensureBaseCreateHierarchy(model, result) {
let curr = result;
ensureBaseCreateHierarchy(model, args) {
let curr = args;
let base = this.getBaseModel(model);

@@ -402,2 +417,10 @@ let sub = this.getModelInfo(model);

}
// Look for base id field assignments in the current level, and push
// them down to the base level
for (const idField of (0, cross_1.getIdFields)(this.options.modelMeta, base.name)) {
if (curr[idField.name] !== undefined) {
curr[baseRelationName].create[idField.name] = curr[idField.name];
delete curr[idField.name];
}
}
curr = curr[baseRelationName].create;

@@ -404,0 +427,0 @@ sub = base;

{
"name": "@zenstackhq/runtime",
"displayName": "ZenStack Runtime Library",
"version": "2.2.3",
"version": "2.2.4",
"description": "Runtime of ZenStack for both client-side and server-side environments.",

@@ -6,0 +6,0 @@ "repository": {

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