convex-ents
Advanced tools
Comparing version 0.4.2 to 0.4.3
import 'convex/values'; | ||
import 'convex/server'; | ||
import './schema.js'; | ||
export { M as DocRetriever, w as Ent, L as EntMutationCtx, K as EntQueryCtx, G as GenericEnt, I as GenericEntWriter, t as PromiseArray, s as PromiseArrayOrNull, x as PromiseEdge, p as PromiseEdgeEnts, o as PromiseEdgeEntsOrNull, y as PromiseEdgeOrThrow, r as PromiseEnt, J as PromiseEntId, q as PromiseEntOrNull, H as PromiseEntWriter, F as PromiseEntWriterOrNull, m as PromiseEnts, l as PromiseEntsOrNull, n as PromiseEntsOrNulls, B as PromiseEntsWriter, h as PromiseOrderedQuery, g as PromiseOrderedQueryBase, P as PromiseOrderedQueryOrNull, z as PromiseOrderedQueryWriter, k as PromisePaginationResult, j as PromisePaginationResultOrNull, C as PromisePaginationResultWriter, i as PromiseQuery, d as PromiseQueryOrNull, A as PromiseQueryWriter, f as PromiseTable, e as PromiseTableBase, D as PromiseTableWriter, N as addEntRules, u as entWrapper, v as entsTableFactory, S as getDeletionConfig, R as getEdgeDefinitions, O as getReadRule, Q as getWriteRule } from './index-6qe2c6eO.js'; | ||
export { O as DocRetriever, y as Ent, N as EntMutationCtx, M as EntQueryCtx, w as EntsTable, x as EntsTableWriter, G as GenericEnt, K as GenericEntWriter, t as PromiseArray, s as PromiseArrayOrNull, z as PromiseEdge, p as PromiseEdgeEnts, o as PromiseEdgeEntsOrNull, A as PromiseEdgeOrThrow, r as PromiseEnt, L as PromiseEntId, q as PromiseEntOrNull, J as PromiseEntWriter, I as PromiseEntWriterOrNull, m as PromiseEnts, l as PromiseEntsOrNull, n as PromiseEntsOrNulls, D as PromiseEntsWriter, h as PromiseOrderedQuery, g as PromiseOrderedQueryBase, P as PromiseOrderedQueryOrNull, B as PromiseOrderedQueryWriter, k as PromisePaginationResult, j as PromisePaginationResultOrNull, F as PromisePaginationResultWriter, i as PromiseQuery, d as PromiseQueryOrNull, C as PromiseQueryWriter, f as PromiseTable, e as PromiseTableBase, H as PromiseTableWriter, Q as addEntRules, u as entWrapper, v as entsTableFactory, U as getDeletionConfig, T as getEdgeDefinitions, R as getReadRule, S as getWriteRule } from './index-WGlX_PmZ.js'; | ||
import './deletion.js'; |
@@ -533,3 +533,8 @@ "use strict"; | ||
constructor(ctx, entDefinitions, table) { | ||
super(ctx, entDefinitions, table, async () => ctx.db.query(table)); | ||
super( | ||
ctx, | ||
entDefinitions, | ||
table, | ||
async () => isSystemTable(table) ? ctx.db.system.query(table) : ctx.db.query(table) | ||
); | ||
} | ||
@@ -561,3 +566,3 @@ get(...args) { | ||
doc: async () => { | ||
const doc = await this.ctx.db.get(id); | ||
const doc = await (isSystemTable(this.table) ? this.ctx.db.system.get(id) : this.ctx.db.get(id)); | ||
if (throwIfNull && doc === null) { | ||
@@ -600,3 +605,3 @@ throw new Error( | ||
ids.map(async (id) => { | ||
const doc = await this.ctx.db.get(id); | ||
const doc = await (isSystemTable(this.table) ? this.ctx.db.system.get(id) : this.ctx.db.get(id)); | ||
if (doc === null) { | ||
@@ -990,3 +995,3 @@ throw new Error( | ||
}); | ||
Object.entries(entDefinitions[table].defaults).map( | ||
Object.entries(entDefinitions[table]?.defaults ?? []).map( | ||
([field, value]) => { | ||
@@ -1002,5 +1007,5 @@ if (doc[field] === void 0) { | ||
const enrichedCtx = options !== void 0 ? { ...ctx, ...options } : ctx; | ||
return (table, indexName, indexRange) => { | ||
if (typeof table !== "string") { | ||
throw new Error(`Expected table name, got \`${table}\``); | ||
const table = (table2, indexName, indexRange) => { | ||
if (typeof table2 !== "string") { | ||
throw new Error(`Expected table name, got \`${table2}\``); | ||
} | ||
@@ -1011,3 +1016,3 @@ if (indexName !== void 0) { | ||
entDefinitions, | ||
table | ||
table2 | ||
).withIndex(indexName, indexRange); | ||
@@ -1019,7 +1024,9 @@ } | ||
entDefinitions, | ||
table | ||
table2 | ||
); | ||
} | ||
return new PromiseTableImpl(enrichedCtx, entDefinitions, table); | ||
return new PromiseTableImpl(enrichedCtx, entDefinitions, table2); | ||
}; | ||
table.system = table; | ||
return table; | ||
} | ||
@@ -1128,3 +1135,3 @@ var PromiseTableWriterImpl = class extends PromiseTableImpl { | ||
) | ||
)).map((edgeDoc) => edgeDoc._id); | ||
)).flat().map((edgeDoc) => edgeDoc._id); | ||
edges[key] = { | ||
@@ -1285,2 +1292,5 @@ add, | ||
} | ||
function isSystemTable(table) { | ||
return table.startsWith("_"); | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -1287,0 +1297,0 @@ 0 && (module.exports = { |
export { EntDefinition, defineEnt, defineEntSchema, getEntDefinitions } from './schema.js'; | ||
export { G as GenericEnt, I as GenericEntWriter, p as PromiseEdgeEnts, o as PromiseEdgeEntsOrNull, r as PromiseEnt, J as PromiseEntId, q as PromiseEntOrNull, H as PromiseEntWriter, F as PromiseEntWriterOrNull, m as PromiseEnts, l as PromiseEntsOrNull, n as PromiseEntsOrNulls, B as PromiseEntsWriter, h as PromiseOrderedQuery, g as PromiseOrderedQueryBase, P as PromiseOrderedQueryOrNull, z as PromiseOrderedQueryWriter, i as PromiseQuery, d as PromiseQueryOrNull, A as PromiseQueryWriter, f as PromiseTable, e as PromiseTableBase, D as PromiseTableWriter, N as addEntRules, v as entsTableFactory } from './index-6qe2c6eO.js'; | ||
export { G as GenericEnt, K as GenericEntWriter, p as PromiseEdgeEnts, o as PromiseEdgeEntsOrNull, r as PromiseEnt, L as PromiseEntId, q as PromiseEntOrNull, J as PromiseEntWriter, I as PromiseEntWriterOrNull, m as PromiseEnts, l as PromiseEntsOrNull, n as PromiseEntsOrNulls, D as PromiseEntsWriter, h as PromiseOrderedQuery, g as PromiseOrderedQueryBase, P as PromiseOrderedQueryOrNull, B as PromiseOrderedQueryWriter, i as PromiseQuery, d as PromiseQueryOrNull, C as PromiseQueryWriter, f as PromiseTable, e as PromiseTableBase, H as PromiseTableWriter, Q as addEntRules, v as entsTableFactory } from './index-WGlX_PmZ.js'; | ||
export { scheduledDeleteFactory } from './deletion.js'; | ||
import 'convex/server'; | ||
import 'convex/values'; |
@@ -859,3 +859,8 @@ "use strict"; | ||
constructor(ctx, entDefinitions, table) { | ||
super(ctx, entDefinitions, table, async () => ctx.db.query(table)); | ||
super( | ||
ctx, | ||
entDefinitions, | ||
table, | ||
async () => isSystemTable(table) ? ctx.db.system.query(table) : ctx.db.query(table) | ||
); | ||
} | ||
@@ -887,3 +892,3 @@ get(...args) { | ||
doc: async () => { | ||
const doc = await this.ctx.db.get(id); | ||
const doc = await (isSystemTable(this.table) ? this.ctx.db.system.get(id) : this.ctx.db.get(id)); | ||
if (throwIfNull && doc === null) { | ||
@@ -926,3 +931,3 @@ throw new Error( | ||
ids.map(async (id) => { | ||
const doc = await this.ctx.db.get(id); | ||
const doc = await (isSystemTable(this.table) ? this.ctx.db.system.get(id) : this.ctx.db.get(id)); | ||
if (doc === null) { | ||
@@ -1316,3 +1321,3 @@ throw new Error( | ||
}); | ||
Object.entries(entDefinitions[table].defaults).map( | ||
Object.entries(entDefinitions[table]?.defaults ?? []).map( | ||
([field, value]) => { | ||
@@ -1328,5 +1333,5 @@ if (doc[field] === void 0) { | ||
const enrichedCtx = options !== void 0 ? { ...ctx, ...options } : ctx; | ||
return (table, indexName, indexRange) => { | ||
if (typeof table !== "string") { | ||
throw new Error(`Expected table name, got \`${table}\``); | ||
const table = (table2, indexName, indexRange) => { | ||
if (typeof table2 !== "string") { | ||
throw new Error(`Expected table name, got \`${table2}\``); | ||
} | ||
@@ -1337,3 +1342,3 @@ if (indexName !== void 0) { | ||
entDefinitions, | ||
table | ||
table2 | ||
).withIndex(indexName, indexRange); | ||
@@ -1345,7 +1350,9 @@ } | ||
entDefinitions, | ||
table | ||
table2 | ||
); | ||
} | ||
return new PromiseTableImpl(enrichedCtx, entDefinitions, table); | ||
return new PromiseTableImpl(enrichedCtx, entDefinitions, table2); | ||
}; | ||
table.system = table; | ||
return table; | ||
} | ||
@@ -1454,3 +1461,3 @@ var PromiseTableWriterImpl = class extends PromiseTableImpl { | ||
) | ||
)).map((edgeDoc) => edgeDoc._id); | ||
)).flat().map((edgeDoc) => edgeDoc._id); | ||
edges[key] = { | ||
@@ -1611,2 +1618,5 @@ add, | ||
} | ||
function isSystemTable(table) { | ||
return table.startsWith("_"); | ||
} | ||
@@ -1613,0 +1623,0 @@ // src/deletion.ts |
import 'convex/server'; | ||
import 'convex/values'; | ||
export { E as EdgeChanges, a as WithEdgeInserts, c as WithEdgePatches, b as WithEdges, W as WriterImplBase } from './index-6qe2c6eO.js'; | ||
export { E as EdgeChanges, a as WithEdgeInserts, c as WithEdgePatches, b as WithEdges, W as WriterImplBase } from './index-WGlX_PmZ.js'; | ||
import './schema.js'; | ||
import './deletion.js'; |
@@ -612,3 +612,3 @@ "use strict"; | ||
}); | ||
Object.entries(entDefinitions[table].defaults).map( | ||
Object.entries(entDefinitions[table]?.defaults ?? []).map( | ||
([field, value]) => { | ||
@@ -684,3 +684,3 @@ if (doc[field] === void 0) { | ||
) | ||
)).map((edgeDoc) => edgeDoc._id); | ||
)).flat().map((edgeDoc) => edgeDoc._id); | ||
edges[key] = { | ||
@@ -687,0 +687,0 @@ add, |
{ | ||
"name": "convex-ents", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
778376
5647