orchid-orm 1.19.0 → 1.20.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.ts +10 -9
- package/dist/index.js +210 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +215 -122
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Query, QueryWithTable, SetQueryTableAlias, RelationJoinQuery, WhereArg, UpdateData, CreateData, AddQueryDefaults, Db, IsolationLevel, TransactionOptions, Adapter, FromArgs, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, RelationQuery, RelationConfigBase, RelationQueryBase, ComputedColumnsBase, MapTableScopesOption, QueryData, QueryBase, DbTableOptionScopes, DefaultColumnTypes, QueryBeforeHook, QueryAfterHook, AfterHook, WhereResult, MergeQuery, SetQueryReturns, QueryReturnType } from 'pqb';
|
|
1
|
+
import { Query, QueryWithTable, SetQueryTableAlias, RelationJoinQuery, WhereArg, UpdateData, CreateData, AddQueryDefaults, Db, IsolationLevel, TransactionOptions, Adapter, FromArgs, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, RelationQuery, RelationConfigBase, RelationQueryBase, ComputedColumnsBase, MapTableScopesOption, QueryData, QueryBase, DbTableOptionScopes, DefaultSchemaConfig, DefaultColumnTypes, QueryBeforeHook, QueryAfterHook, AfterHook, WhereResult, MergeQuery, SetQueryReturns, QueryReturnType } from 'pqb';
|
|
2
2
|
export * from 'pqb';
|
|
3
|
-
import { ColumnsShapeBase, EmptyObject, MaybeArray, StringKey, CoreQueryScopes, ColumnShapeQueryType, ColumnShapeOutput, ColumnShapeInput } from 'orchid-core';
|
|
3
|
+
import { ColumnsShapeBase, EmptyObject, MaybeArray, StringKey, CoreQueryScopes, ColumnShapeQueryType, ColumnShapeOutput, ColumnShapeInput, ColumnSchemaConfig } from 'orchid-core';
|
|
4
4
|
|
|
5
5
|
type RelationCommonOptions<Related extends TableClass = TableClass, Scope extends Query = Query> = {
|
|
6
6
|
scope?: ScopeFn<Related, Scope>;
|
|
@@ -374,7 +374,6 @@ type Updateable<T extends Table> = Partial<Insertable<T>>;
|
|
|
374
374
|
type BeforeHookMethod = <T extends Table>(cb: QueryBeforeHook) => T;
|
|
375
375
|
type AfterHookMethod = <T extends Table>(cb: QueryAfterHook) => T;
|
|
376
376
|
type AfterSelectableHookMethod = <T extends Table, S extends (keyof T['columns'])[]>(this: T, select: S, cb: AfterHook<S, T['columns']>) => T;
|
|
377
|
-
type SchemaProviderBase = any;
|
|
378
377
|
interface BaseTableInstance<ColumnTypes> {
|
|
379
378
|
table: string;
|
|
380
379
|
columns: ColumnsShapeBase;
|
|
@@ -530,23 +529,25 @@ interface BaseTableInstance<ColumnTypes> {
|
|
|
530
529
|
afterDelete: AfterSelectableHookMethod;
|
|
531
530
|
afterDeleteCommit: AfterSelectableHookMethod;
|
|
532
531
|
}
|
|
533
|
-
interface BaseTableClass<
|
|
532
|
+
interface BaseTableClass<SchemaConfig extends ColumnSchemaConfig, ColumnTypes> {
|
|
534
533
|
nowSQL: string | undefined;
|
|
535
534
|
exportAs: string;
|
|
536
|
-
schema: SchemaProvider;
|
|
537
535
|
getFilePath(): string;
|
|
538
536
|
new (): BaseTableInstance<ColumnTypes>;
|
|
539
537
|
instance(): BaseTableInstance<ColumnTypes>;
|
|
538
|
+
inputSchema: SchemaConfig['inputSchema'];
|
|
539
|
+
outputSchema: SchemaConfig['outputSchema'];
|
|
540
|
+
querySchema: SchemaConfig['querySchema'];
|
|
540
541
|
}
|
|
541
|
-
declare function createBaseTable<
|
|
542
|
-
|
|
542
|
+
declare function createBaseTable<SchemaConfig extends ColumnSchemaConfig = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({ schemaConfig, columnTypes: columnTypesArg, snakeCase, filePath: filePathArg, nowSQL, exportAs, language, }?: {
|
|
543
|
+
schemaConfig?: SchemaConfig;
|
|
544
|
+
columnTypes?: ColumnTypes | ((t: DefaultColumnTypes<SchemaConfig>) => ColumnTypes);
|
|
543
545
|
snakeCase?: boolean;
|
|
544
546
|
filePath?: string;
|
|
545
547
|
nowSQL?: string;
|
|
546
548
|
exportAs?: string;
|
|
547
549
|
language?: string;
|
|
548
|
-
|
|
549
|
-
}): BaseTableClass<ColumnTypes, SchemaProvider>;
|
|
550
|
+
}): BaseTableClass<SchemaConfig, ColumnTypes>;
|
|
550
551
|
|
|
551
552
|
type QueryMethods<T extends Query> = Record<string, (q: T, ...args: any[]) => any>;
|
|
552
553
|
type QueryOne<T extends Query> = SetQueryReturns<T, Exclude<QueryReturnType, 'all'>>;
|