@zenstackhq/orm 3.8.0 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -3407,7 +3407,7 @@ declare class ORMError extends Error {
3407
3407
  sqlParams?: readonly unknown[];
3408
3408
  }
3409
3409
  declare namespace query_utils_d_exports {
3410
- export { TEMP_ALIAS_PREFIX, aggregate, buildJoinPairs, ensureArray, extractFieldName, extractIdFields, extractModelName, fieldHasDefaultValue, flattenCompoundUniqueFilters, getDelegateDescendantModels, getDelegateDiscriminatorValue, getDiscriminatorField, getEnum, getField, getIdFields, getIdValues, getManyToManyRelation, getModel, getModelFields, getRelationForeignKeyFieldPairs, getTypeDef, getUniqueFields, hasModel, isEnum, isForeignKeyField, isInheritedField, isRelationField, isScalarField, isTypeDef, isUnsupportedField, makeDefaultOrderBy, requireField, requireIdFields, requireModel, requireTypeDef, stripAlias, tmpAlias };
3410
+ export { ManyToManyJoinTableEndpoints, TEMP_ALIAS_PREFIX, aggregate, buildJoinPairs, ensureArray, extractFieldName, extractIdFields, extractModelName, fieldHasDefaultValue, flattenCompoundUniqueFilters, getDelegateDescendantModels, getDelegateDiscriminatorValue, getDiscriminatorField, getEnum, getField, getIdFields, getIdValues, getManyToManyJoinTable, getManyToManyRelation, getModel, getModelFields, getRelationForeignKeyFieldPairs, getTypeDef, getUniqueFields, hasModel, isEnum, isForeignKeyField, isInheritedField, isRelationField, isScalarField, isTypeDef, isUnsupportedField, makeDefaultOrderBy, requireField, requireIdFields, requireModel, requireTypeDef, stripAlias, tmpAlias };
3411
3411
  }
3412
3412
  declare function hasModel(schema: SchemaDef, model: string): boolean;
3413
3413
  declare function getModel(schema: SchemaDef, model: string): ModelDef | undefined;
@@ -3467,6 +3467,22 @@ declare function getManyToManyRelation(schema: SchemaDef, model: string, field:
3467
3467
  otherPKName: string;
3468
3468
  joinTable: string;
3469
3469
  } | undefined;
3470
+ /**
3471
+ * Endpoints of an implicit many-to-many relation, identified by its join table name.
3472
+ */
3473
+ interface ManyToManyJoinTableEndpoints {
3474
+ model: string;
3475
+ field: string;
3476
+ otherModel: string;
3477
+ otherField: string;
3478
+ }
3479
+ /**
3480
+ * Resolve the relation endpoints for an implicit many-to-many join table by its table
3481
+ * name, or `undefined` if the table is not an implicit m2m join table. The join-table
3482
+ * index is built once per schema (single pass) and reused, making this an O(1) lookup.
3483
+ * See issue #2715.
3484
+ */
3485
+ declare function getManyToManyJoinTable(schema: SchemaDef, joinTableName: string): ManyToManyJoinTableEndpoints | undefined;
3470
3486
  /**
3471
3487
  * Convert filter like `{ id1_id2: { id1: 1, id2: 1 } }` to `{ id1: 1, id2: 1 }`
3472
3488
  */
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AnyNull, AnyNullClass, DbNull, DbNullClass, JsonArray, JsonNull, JsonNullClass, JsonNullValues, JsonObject, JsonValue } from "./common-types.mjs";
2
2
  import * as _$kysely from "kysely";
3
3
  import { AddColumnNode, AddConstraintNode, AddIndexNode, AddValueNode, AggregateFunctionNode, AliasNode, AliasableExpression, AlterColumnNode, AlterTableNode, AlterTypeNode, AndNode, BinaryOperationNode, CaseNode, CastNode, CheckConstraintNode, CollateNode, ColumnDefinitionNode, ColumnNode, ColumnUpdateNode, CommonTableExpressionNameNode, CommonTableExpressionNode, CreateIndexNode, CreateSchemaNode, CreateTableNode, CreateTypeNode, CreateViewNode, DataTypeNode, DefaultInsertValueNode, DefaultValueNode, DeleteQueryNode, Dialect, DropColumnNode, DropConstraintNode, DropIndexNode, DropSchemaNode, DropTableNode, DropTypeNode, DropViewNode, ExplainNode, Expression, ExpressionBuilder, ExpressionWrapper, FetchNode, ForeignKeyConstraintNode, FromNode, FunctionNode, Generated, GeneratedNode, GroupByItemNode, GroupByNode, HavingNode, IdentifierNode, InsertQueryNode, JSONOperatorChainNode, JSONPathLegNode, JSONPathNode, JSONReferenceNode, JoinNode, Kysely, KyselyConfig, LimitNode, ListNode, MatchedNode, MergeQueryNode, ModifyColumnNode, OffsetNode, OnConflictNode, OnDuplicateKeyNode, OnNode, OperandExpression, OperationNode, OperationNodeVisitor, OperatorNode, OrActionNode, OrNode, OrderByItemNode, OrderByNode, OutputNode, OverNode, ParensNode, PartitionByItemNode, PartitionByNode, PrimaryKeyConstraintNode, PrimitiveValueListNode, QueryId, QueryResult, RawNode, ReferenceNode, ReferencesNode, RefreshMaterializedViewNode, RenameColumnNode, RenameConstraintNode, RenameValueNode, ReturningNode, RootOperationNode, SchemableIdentifierNode, SelectAllNode, SelectModifierNode, SelectQueryBuilder, SelectQueryNode, SelectionNode, SetOperationNode, SqlBool, TableNode, TopNode, TupleNode, UnaryOperationNode, UniqueConstraintNode, UnknownRow, UpdateQueryNode, UsingNode, ValueListNode, ValueNode, ValuesNode, WhenNode, WhereNode, WithNode } from "kysely";
4
- import { ZodType, z as z$1 } from "zod";
4
+ import { ZodType, z } from "zod";
5
5
  import * as _$_zenstackhq_schema0 from "@zenstackhq/schema";
6
6
  import { ArrayExpression, BinaryExpression, BindingExpression, BuiltinType, CallExpression, DataSourceProviderType, Expression as Expression$1, FieldDef, FieldExpression, FieldHasDefault, FieldIsArray, FieldIsDelegateDiscriminator, FieldIsRelation, FieldType, ForeignKeyFields, GetEnum, GetEnums, GetModel, GetModelDelegateMapValue, GetModelDiscriminator, GetModelField, GetModelFieldType, GetModelFields, GetModels, GetSubModels, GetTypeDefField, GetTypeDefFieldType, GetTypeDefFields, GetTypeDefs, IsDelegateModel, LiteralExpression, MemberExpression, ModelDef, ModelFieldIsOptional, NonRelationFields, NullExpression, ProcedureDef, RelationFieldType, RelationFields, RelationInfo, ScalarFields, SchemaDef, ThisExpression, TypeDefFieldIsArray, TypeDefFieldIsOptional, UnaryExpression, UpdatedAtInfo } from "@zenstackhq/schema";
7
7
  import Decimal from "decimal.js";
@@ -3202,7 +3202,7 @@ declare class ZodSchemaFactory<in out Schema extends SchemaDef, in out Options e
3202
3202
  * before serialization.
3203
3203
  */
3204
3204
  toJSONSchema(): {
3205
- schemas: Record<string, z$1.core.JSONSchema.BaseSchema>;
3205
+ schemas: Record<string, z.core.JSONSchema.BaseSchema>;
3206
3206
  };
3207
3207
  get cacheStats(): {
3208
3208
  size: number;
@@ -3407,7 +3407,7 @@ declare class ORMError extends Error {
3407
3407
  sqlParams?: readonly unknown[];
3408
3408
  }
3409
3409
  declare namespace query_utils_d_exports {
3410
- export { TEMP_ALIAS_PREFIX, aggregate, buildJoinPairs, ensureArray, extractFieldName, extractIdFields, extractModelName, fieldHasDefaultValue, flattenCompoundUniqueFilters, getDelegateDescendantModels, getDelegateDiscriminatorValue, getDiscriminatorField, getEnum, getField, getIdFields, getIdValues, getManyToManyRelation, getModel, getModelFields, getRelationForeignKeyFieldPairs, getTypeDef, getUniqueFields, hasModel, isEnum, isForeignKeyField, isInheritedField, isRelationField, isScalarField, isTypeDef, isUnsupportedField, makeDefaultOrderBy, requireField, requireIdFields, requireModel, requireTypeDef, stripAlias, tmpAlias };
3410
+ export { ManyToManyJoinTableEndpoints, TEMP_ALIAS_PREFIX, aggregate, buildJoinPairs, ensureArray, extractFieldName, extractIdFields, extractModelName, fieldHasDefaultValue, flattenCompoundUniqueFilters, getDelegateDescendantModels, getDelegateDiscriminatorValue, getDiscriminatorField, getEnum, getField, getIdFields, getIdValues, getManyToManyJoinTable, getManyToManyRelation, getModel, getModelFields, getRelationForeignKeyFieldPairs, getTypeDef, getUniqueFields, hasModel, isEnum, isForeignKeyField, isInheritedField, isRelationField, isScalarField, isTypeDef, isUnsupportedField, makeDefaultOrderBy, requireField, requireIdFields, requireModel, requireTypeDef, stripAlias, tmpAlias };
3411
3411
  }
3412
3412
  declare function hasModel(schema: SchemaDef, model: string): boolean;
3413
3413
  declare function getModel(schema: SchemaDef, model: string): ModelDef | undefined;
@@ -3467,6 +3467,22 @@ declare function getManyToManyRelation(schema: SchemaDef, model: string, field:
3467
3467
  otherPKName: string;
3468
3468
  joinTable: string;
3469
3469
  } | undefined;
3470
+ /**
3471
+ * Endpoints of an implicit many-to-many relation, identified by its join table name.
3472
+ */
3473
+ interface ManyToManyJoinTableEndpoints {
3474
+ model: string;
3475
+ field: string;
3476
+ otherModel: string;
3477
+ otherField: string;
3478
+ }
3479
+ /**
3480
+ * Resolve the relation endpoints for an implicit many-to-many join table by its table
3481
+ * name, or `undefined` if the table is not an implicit m2m join table. The join-table
3482
+ * index is built once per schema (single pass) and reused, making this an O(1) lookup.
3483
+ * See issue #2715.
3484
+ */
3485
+ declare function getManyToManyJoinTable(schema: SchemaDef, joinTableName: string): ManyToManyJoinTableEndpoints | undefined;
3470
3486
  /**
3471
3487
  * Convert filter like `{ id1_id2: { id1: 1, id2: 1 } }` to `{ id1: 1, id2: 1 }`
3472
3488
  */