orchid-orm 1.32.10 → 1.32.12

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.ts CHANGED
@@ -399,7 +399,7 @@ interface Table extends Query, TableInfo {
399
399
  interface TableToDb<T extends ORMTableInput, Relations extends RelationsBase> extends TableInfo, Db<T['table'], T['columns']['shape'], keyof ShapeColumnPrimaryKeys<T['columns']['shape']> extends never ? never : ShapeColumnPrimaryKeys<T['columns']['shape']>, ShapeUniqueColumns<T['columns']['shape']> | TableDataItemsUniqueColumns<T['columns']['shape'], T['columns']['data']>, TableDataItemsUniqueColumnTuples<T['columns']['shape'], T['columns']['data']>, UniqueConstraints<T['columns']['shape']> | TableDataItemsUniqueConstraints<T['columns']['data']>, T['types'], T['columns']['shape'] & ComputedColumnsFromOptions<T['computed']>, MapTableScopesOption<T>> {
400
400
  relations: Relations;
401
401
  }
402
- type ORMTableInputToQueryBuilder<T extends ORMTableInput> = T extends RelationConfigSelf ? TableToDb<T, MapRelations<T>> & MapRelations<T> : TableToDb<T, RelationsBase>;
402
+ type ORMTableInputToQueryBuilder<T extends ORMTableInput> = T extends RelationConfigSelf ? TableToDb<T, MapRelations<T>> & MapRelations<T> : TableToDb<T, EmptyObject>;
403
403
  type ScopeFn<Related extends TableClass, Scope extends Query> = (q: ORMTableInputToQueryBuilder<InstanceType<Related>>) => Scope;
404
404
  interface ORMTableInput {
405
405
  table: string;
@@ -616,9 +616,32 @@ interface BaseTableClass<SchemaConfig extends ColumnSchemaConfig, ColumnTypes> e
616
616
  getFilePath(): string;
617
617
  new (): BaseTableInstance<ColumnTypes>;
618
618
  instance(): BaseTableInstance<ColumnTypes>;
619
+ /**
620
+ * All column types for inserting.
621
+ */
619
622
  inputSchema: SchemaConfig['inputSchema'];
623
+ /**
624
+ * All column types as returned from a database.
625
+ */
620
626
  outputSchema: SchemaConfig['outputSchema'];
627
+ /**
628
+ * All column types for query methods such as `where`.
629
+ */
621
630
  querySchema: SchemaConfig['querySchema'];
631
+ /**
632
+ * Primary key column(s) type for query methods such as `where`.
633
+ */
634
+ pkeySchema: SchemaConfig['pkeySchema'];
635
+ /**
636
+ * Column types for inserting, excluding primary keys.
637
+ * Equals to {@link inputSchema} without primary keys.
638
+ */
639
+ createSchema: SchemaConfig['createSchema'];
640
+ /**
641
+ * Column types for updating, excluding primary keys.
642
+ * Equals to partial {@link createSchema}.
643
+ */
644
+ updateSchema: SchemaConfig['updateSchema'];
622
645
  }
623
646
  declare function createBaseTable<SchemaConfig extends ColumnSchemaConfig = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({ schemaConfig, columnTypes: columnTypesArg, snakeCase, filePath: filePathArg, nowSQL, exportAs, language, }?: {
624
647
  schemaConfig?: SchemaConfig;
package/dist/index.js CHANGED
@@ -41,6 +41,10 @@ function createBaseTable({
41
41
  this.instance();
42
42
  return this._querySchema === void 0 ? this._querySchema = schemaConfig.querySchema.call(this) : this._querySchema;
43
43
  }
44
+ static createSchema() {
45
+ this.instance();
46
+ return this._createSchema === void 0 ? this._createSchema = schemaConfig.createSchema.call(this) : this._createSchema;
47
+ }
44
48
  static updateSchema() {
45
49
  this.instance();
46
50
  return this._updateSchema === void 0 ? this._updateSchema = schemaConfig.updateSchema.call(this) : this._updateSchema;