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
2
Versions
280
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

to
2.0.0-alpha.7

2

cross/index.d.ts

@@ -121,3 +121,3 @@ /**

/**
* Base types
* Base types (not including abstract base models).
*/

@@ -124,0 +124,0 @@ baseTypes?: string[];

@@ -696,2 +696,5 @@ "use strict";

}
result.forEach((m) => {
getBaseRecursively(m, modelMeta, result);
});
return [...result];

@@ -715,2 +718,12 @@ });

}
function getBaseRecursively(model, modelMeta, result) {
var _a;
const bases = (_a = getModelInfo(modelMeta, model)) == null ? void 0 : _a.baseTypes;
if (bases) {
bases.forEach((base) => {
result.add(base);
getBaseRecursively(base, modelMeta, result);
});
}
}
// Annotate the CommonJS export names for ESM import in node:

@@ -717,0 +730,0 @@ 0 && (module.exports = {

@@ -13,3 +13,2 @@ "use strict";

const delegate_1 = require("./delegate");
const logger_1 = require("./logger");
const omit_1 = require("./omit");

@@ -36,3 +35,3 @@ const password_1 = require("./password");

function createEnhancement(prisma, options, context) {
var _a, _b;
var _a;
if (!prisma) {

@@ -46,4 +45,2 @@ throw new Error('Invalid prisma instance');

}
const logger = new logger_1.Logger(prisma);
logger.info(`Enabled ZenStack enhancements: ${(_a = options.kinds) === null || _a === void 0 ? void 0 : _a.join(', ')}`);
let result = prisma;

@@ -59,3 +56,3 @@ if (process.env.ZENSTACK_TEST === '1' || // avoid caching in tests

}
const kinds = (_b = options.kinds) !== null && _b !== void 0 ? _b : ALL_ENHANCEMENTS;
const kinds = (_a = options.kinds) !== null && _a !== void 0 ? _a : ALL_ENHANCEMENTS;
// delegate proxy needs to be wrapped inside policy proxy, since it may translate `deleteMany`

@@ -62,0 +59,0 @@ // and `updateMany` to plain `delete` and `update`

@@ -887,3 +887,12 @@ "use strict";

const modelInfo = (0, cross_1.getModelInfo)(this.options.modelMeta, model, true);
for (const field of Object.values(modelInfo.fields)) {
for (const [key, value] of Object.entries(entity)) {
if (key.startsWith(constants_1.DELEGATE_AUX_RELATION_PREFIX)) {
continue;
}
const field = modelInfo.fields[key];
if (!field) {
// not a field, could be `_count`, `_sum`, etc.
result[key] = value;
continue;
}
if (field.inheritedFrom) {

@@ -893,16 +902,13 @@ // already merged from base

}
if (field.name in entity) {
const fieldValue = entity[field.name];
if (field.isDataModel) {
if (Array.isArray(fieldValue)) {
result[field.name] = fieldValue.map((item) => this.assembleUp(field.type, item));
}
else {
result[field.name] = this.assembleUp(field.type, fieldValue);
}
if (field.isDataModel) {
if (Array.isArray(value)) {
result[field.name] = value.map((item) => this.assembleUp(field.type, item));
}
else {
result[field.name] = fieldValue;
result[field.name] = this.assembleUp(field.type, value);
}
}
else {
result[field.name] = value;
}
}

@@ -927,17 +933,23 @@ return result;

}
for (const field of Object.values(modelInfo.fields)) {
if (field.name in entity) {
const fieldValue = entity[field.name];
if (field.isDataModel) {
if (Array.isArray(fieldValue)) {
result[field.name] = fieldValue.map((item) => this.assembleDown(field.type, item));
}
else {
result[field.name] = this.assembleDown(field.type, fieldValue);
}
for (const [key, value] of Object.entries(entity)) {
if (key.startsWith(constants_1.DELEGATE_AUX_RELATION_PREFIX)) {
continue;
}
const field = modelInfo.fields[key];
if (!field) {
// not a field, could be `_count`, `_sum`, etc.
result[key] = value;
continue;
}
if (field.isDataModel) {
if (Array.isArray(value)) {
result[field.name] = value.map((item) => this.assembleDown(field.type, item));
}
else {
result[field.name] = fieldValue;
result[field.name] = this.assembleDown(field.type, value);
}
}
else {
result[field.name] = value;
}
}

@@ -944,0 +956,0 @@ return result;

{
"name": "@zenstackhq/runtime",
"displayName": "ZenStack Runtime Library",
"version": "2.0.0-alpha.6",
"version": "2.0.0-alpha.7",
"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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet