Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

convex-ents

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convex-ents - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

20

dist/functions.js

@@ -584,7 +584,18 @@ "use strict";

} : async () => {
const [indexName, value] = args;
const doc = await this.ctx.db.query(this.table).withIndex(indexName, (q) => q.eq(indexName, value)).unique();
const [indexName, ...values] = args;
const fieldNames = getIndexFields(
this.entDefinitions,
this.table,
indexName
);
const doc = await this.ctx.db.query(this.table).withIndex(
indexName,
(q) => values.reduce((q2, value, i) => q2.eq(fieldNames[i], value), q)
).unique();
if (throwIfNull && doc === null) {
throw new Error(
`Table "${this.table}" does not contain document with field "${indexName}" = \`${value}\``
`Table "${this.table}" does not contain document with field${values.reduce(
(message, value, i) => `${message} "${fieldNames[i]}" = \`${value}\``,
""
)}`
);

@@ -1282,2 +1293,5 @@ }

}
function getIndexFields(entDefinitions, table, index) {
return entDefinitions[table].indexes[index];
}
function getReadRule(entDefinitions, table) {

@@ -1284,0 +1298,0 @@ return entDefinitions.rules?.[table]?.read;

47

dist/index.js

@@ -370,12 +370,19 @@ "use strict";

const tables = schema.tables;
return Object.keys(tables).reduce(
(acc, tableName) => ({
...acc,
[tableName]: {
defaults: tables[tableName].defaults,
edges: tables[tableName].edgeConfigs,
fields: tables[tableName].fieldConfigs,
deletionConfig: tables[tableName].deletionConfig
}
}),
return Object.entries(tables).reduce(
(acc, [tableName, table]) => {
acc[tableName] = {
indexes: table.indexes.reduce(
(acc2, { indexDescriptor, fields }) => {
acc2[indexDescriptor] = fields;
return acc2;
},
{}
),
defaults: table.defaults,
edges: table.edgeConfigs,
fields: table.fieldConfigs,
deletionConfig: table.deletionConfig
};
return acc;
},
{}

@@ -936,7 +943,18 @@ );

} : async () => {
const [indexName, value] = args;
const doc = await this.ctx.db.query(this.table).withIndex(indexName, (q) => q.eq(indexName, value)).unique();
const [indexName, ...values] = args;
const fieldNames = getIndexFields(
this.entDefinitions,
this.table,
indexName
);
const doc = await this.ctx.db.query(this.table).withIndex(
indexName,
(q) => values.reduce((q2, value, i) => q2.eq(fieldNames[i], value), q)
).unique();
if (throwIfNull && doc === null) {
throw new Error(
`Table "${this.table}" does not contain document with field "${indexName}" = \`${value}\``
`Table "${this.table}" does not contain document with field${values.reduce(
(message, value, i) => `${message} "${fieldNames[i]}" = \`${value}\``,
""
)}`
);

@@ -1634,2 +1652,5 @@ }

}
function getIndexFields(entDefinitions, table, index) {
return entDefinitions[table].indexes[index];
}
function getReadRule(entDefinitions, table) {

@@ -1636,0 +1657,0 @@ return entDefinitions.rules?.[table]?.read;

@@ -365,12 +365,19 @@ "use strict";

const tables = schema.tables;
return Object.keys(tables).reduce(
(acc, tableName) => ({
...acc,
[tableName]: {
defaults: tables[tableName].defaults,
edges: tables[tableName].edgeConfigs,
fields: tables[tableName].fieldConfigs,
deletionConfig: tables[tableName].deletionConfig
}
}),
return Object.entries(tables).reduce(
(acc, [tableName, table]) => {
acc[tableName] = {
indexes: table.indexes.reduce(
(acc2, { indexDescriptor, fields }) => {
acc2[indexDescriptor] = fields;
return acc2;
},
{}
),
defaults: table.defaults,
edges: table.edgeConfigs,
fields: table.fieldConfigs,
deletionConfig: table.deletionConfig
};
return acc;
},
{}

@@ -377,0 +384,0 @@ );

{
"name": "convex-ents",
"version": "0.7.1",
"version": "0.7.2",
"description": "Relations, default values, unique fields, RLS for Convex",

@@ -5,0 +5,0 @@ "keywords": [

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

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