orchid-orm 1.17.19 → 1.17.21
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 +15 -15
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Query, QueryWithTable, SetQueryTableAlias, WhereArg, UpdateData, CreateData, Db, IsolationLevel, TransactionOptions, Adapter, FromArgs, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, RelationConfigBase, RelationQuery, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsAll, RelationQueryBase, ComputedColumnsBase,
|
|
1
|
+
import { Query, QueryWithTable, SetQueryTableAlias, WhereArg, UpdateData, CreateData, Db, IsolationLevel, TransactionOptions, Adapter, FromArgs, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, RelationConfigBase, RelationQuery, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsAll, RelationQueryBase, ComputedColumnsBase, QueryData, QueryBase, DefaultColumnTypes, QueryBeforeHook, QueryAfterHook, AfterHook, WhereResult, MergeQuery, SetQueryReturns, QueryReturnType } from 'pqb';
|
|
2
2
|
export { OrchidOrmError, OrchidOrmInternalError, columnTypes, raw, testTransaction } from 'pqb';
|
|
3
|
-
import { EmptyObject, MaybeArray, StringKey, ColumnShapeQueryType, ColumnShapeOutput, ColumnShapeInput
|
|
3
|
+
import { EmptyObject, MaybeArray, StringKey, ColumnsShapeBase, ColumnShapeQueryType, ColumnShapeOutput, ColumnShapeInput } from 'orchid-core';
|
|
4
4
|
|
|
5
5
|
type RelationCommonOptions<Related extends TableClass = TableClass, Scope extends Query = Query> = {
|
|
6
6
|
scope?: ScopeFn<Related, Scope>;
|
|
@@ -359,7 +359,7 @@ type DbTable<TC extends TableClass, T extends Table = InstanceType<TC>, Relation
|
|
|
359
359
|
type ScopeFn<Related extends TableClass, Scope extends Query> = (q: DbTable<Related>) => Scope;
|
|
360
360
|
type Table = {
|
|
361
361
|
table: string;
|
|
362
|
-
columns:
|
|
362
|
+
columns: ColumnsShapeBase;
|
|
363
363
|
schema?: string;
|
|
364
364
|
types: unknown;
|
|
365
365
|
noPrimaryKey?: boolean;
|
|
@@ -385,7 +385,7 @@ interface BaseTableClass<ColumnTypes, SchemaProvider extends SchemaProviderBase>
|
|
|
385
385
|
getFilePath(): string;
|
|
386
386
|
new (): {
|
|
387
387
|
table: string;
|
|
388
|
-
columns:
|
|
388
|
+
columns: ColumnsShapeBase;
|
|
389
389
|
schema?: string;
|
|
390
390
|
noPrimaryKey?: boolean;
|
|
391
391
|
snakeCase?: boolean;
|
|
@@ -396,7 +396,7 @@ interface BaseTableClass<ColumnTypes, SchemaProvider extends SchemaProviderBase>
|
|
|
396
396
|
result: ColumnsShapeBase;
|
|
397
397
|
clone<T extends QueryBase>(this: T): T;
|
|
398
398
|
getFilePath(): string;
|
|
399
|
-
setColumns<T extends
|
|
399
|
+
setColumns<T extends ColumnsShapeBase>(fn: (t: ColumnTypes) => T): T;
|
|
400
400
|
/**
|
|
401
401
|
* You can add a generated column in the migration (see [generated](/guide/migration-column-methods.html#generated-column)),
|
|
402
402
|
* such column will persist in the database, it can be indexed.
|
|
@@ -487,7 +487,7 @@ interface BaseTableClass<ColumnTypes, SchemaProvider extends SchemaProviderBase>
|
|
|
487
487
|
*
|
|
488
488
|
* @param computed - object where keys are column names and values are functions returning raw SQL
|
|
489
489
|
*/
|
|
490
|
-
setComputed<Table extends string, Shape extends
|
|
490
|
+
setComputed<Table extends string, Shape extends ColumnsShapeBase, Computed extends ComputedColumnsBase<Db<Table, Shape, EmptyObject, ColumnTypes>>>(computed: Computed): Computed;
|
|
491
491
|
belongsTo<Self extends Table, Related extends TableClass, Scope extends Query, Options extends BelongsToOptions<Self, Related, Scope>>(this: Self, fn: () => Related, options: Options): {
|
|
492
492
|
type: 'belongsTo';
|
|
493
493
|
fn: () => Related;
|
|
@@ -524,15 +524,15 @@ interface BaseTableClass<ColumnTypes, SchemaProvider extends SchemaProviderBase>
|
|
|
524
524
|
afterDeleteCommit: AfterSelectableHookMethod;
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
declare
|
|
528
|
-
columnTypes?: ColumnTypes | ((t: DefaultColumnTypes) => ColumnTypes)
|
|
529
|
-
snakeCase?: boolean
|
|
530
|
-
filePath?: string
|
|
531
|
-
nowSQL?: string
|
|
532
|
-
exportAs?: string
|
|
533
|
-
language?: string
|
|
534
|
-
schemaProvider?: SchemaProvider
|
|
535
|
-
})
|
|
527
|
+
declare function createBaseTable<SchemaProvider extends SchemaProviderBase, ColumnTypes = DefaultColumnTypes>({ columnTypes: columnTypesArg, snakeCase, filePath: filePathArg, nowSQL, exportAs, language, schemaProvider: schemaProviderArg, }?: {
|
|
528
|
+
columnTypes?: ColumnTypes | ((t: DefaultColumnTypes) => ColumnTypes);
|
|
529
|
+
snakeCase?: boolean;
|
|
530
|
+
filePath?: string;
|
|
531
|
+
nowSQL?: string;
|
|
532
|
+
exportAs?: string;
|
|
533
|
+
language?: string;
|
|
534
|
+
schemaProvider?: SchemaProvider;
|
|
535
|
+
}): BaseTableClass<ColumnTypes, SchemaProvider>;
|
|
536
536
|
|
|
537
537
|
type QueryMethods<T extends Query> = Record<string, (q: T, ...args: any[]) => any>;
|
|
538
538
|
type QueryOne<T extends Query> = SetQueryReturns<T, Exclude<QueryReturnType, 'all'>>;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var pqb = require('pqb');
|
|
|
4
4
|
var orchidCore = require('orchid-core');
|
|
5
5
|
var node_async_hooks = require('node:async_hooks');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function createBaseTable({
|
|
8
8
|
columnTypes: columnTypesArg,
|
|
9
9
|
snakeCase,
|
|
10
10
|
filePath: filePathArg,
|
|
@@ -12,7 +12,7 @@ const createBaseTable = ({
|
|
|
12
12
|
exportAs = "BaseTable",
|
|
13
13
|
language,
|
|
14
14
|
schemaProvider: schemaProviderArg
|
|
15
|
-
} = {})
|
|
15
|
+
} = {}) {
|
|
16
16
|
var _a;
|
|
17
17
|
const columnTypes = typeof columnTypesArg === "function" ? columnTypesArg(
|
|
18
18
|
pqb.columnTypes
|
|
@@ -110,7 +110,7 @@ const createBaseTable = ({
|
|
|
110
110
|
orchidCore.applyMixins(base, [pqb.QueryHooks]);
|
|
111
111
|
base.prototype.types = columnTypes;
|
|
112
112
|
return base;
|
|
113
|
-
}
|
|
113
|
+
}
|
|
114
114
|
|
|
115
115
|
const getThroughRelation = (table, through) => {
|
|
116
116
|
var _a;
|