orchid-orm 1.70.1 → 1.71.0
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 +14 -6
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -1
- package/dist/index.mjs.map +1 -1
- package/dist/migrations/index.js +691 -16
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/index.mjs +691 -16
- package/dist/migrations/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, AfterCommitStandaloneHook, AfterHook, Column, ColumnSchemaConfig, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateData, CreateManyMethodsNames, CreateMethodsNames, DbSharedOptions, DbSqlMethod, DbTableOptionScopes, DefaultColumnTypes, DefaultSchemaConfig, DeleteMethodsNames, EmptyObject, FromArg, FromResult, IsQuery, IsolationLevel, JoinQueryMethod, MapTableScopesOption, MaybeArray, MergeQuery, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryData, QueryHasWhere, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryReturnType, QuerySchema, QueryScopes, RecordUnknown, RelationConfigBase, SelectableFromShape, ShallowSimplify, ShapeColumnPrimaryKeys, ShapeUniqueColumns, StorageOptions, TableData, TableDataFn, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints,
|
|
1
|
+
import { Adapter, AfterCommitStandaloneHook, AfterHook, Column, ColumnSchemaConfig, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateData, CreateManyMethodsNames, CreateMethodsNames, DbSharedOptions, DbSqlMethod, DbTableOptionScopes, DefaultColumnTypes, DefaultSchemaConfig, DeleteMethodsNames, EmptyObject, FromArg, FromResult, Grant, IsQuery, IsolationLevel, JoinQueryMethod, MapTableScopesOption, MaybeArray, MergeQuery, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryData, QueryHasWhere, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryReturnType, QuerySchema, QueryScopes, RecordUnknown, RelationConfigBase, Rls, SelectableFromShape, ShallowSimplify, ShapeColumnPrimaryKeys, ShapeUniqueColumns, StorageOptions, TableData, TableDataFn, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TransactionOptions, UniqueConstraints, UpdateData, WhereArg } from "pqb/internal";
|
|
2
2
|
import { Db, Query } from "pqb";
|
|
3
3
|
export * from "pqb";
|
|
4
4
|
interface RelationRefsOptions<Column extends PropertyKey = string, Shape extends Column.Shape.QueryInit = Column.Shape.QueryInit> {
|
|
@@ -180,8 +180,8 @@ interface OrchidORMQueryHelper<Q extends Query, Args extends unknown[], Result>
|
|
|
180
180
|
}, ...args: Args): Result extends Query ? MergeQuery<T, Result> : Result;
|
|
181
181
|
isQueryHelper: true;
|
|
182
182
|
table: Q['table'];
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
__args: Args;
|
|
184
|
+
__result: Result;
|
|
185
185
|
}
|
|
186
186
|
interface OrchidORMTableHelper<T extends Query> {
|
|
187
187
|
makeHelper<Args extends unknown[], Result>(fn: (q: T, ...args: Args) => Result): OrchidORMQueryHelper<T, Args, Result>;
|
|
@@ -196,7 +196,11 @@ type OrchidORM<T extends TableClasses = TableClasses> = OrchidORMDbTables<T> & O
|
|
|
196
196
|
/**
|
|
197
197
|
* Identity helper for table row-level security configuration.
|
|
198
198
|
*/
|
|
199
|
-
declare const defineRls: <T extends
|
|
199
|
+
declare const defineRls: <T extends Rls.TableConfig>(rls: T) => T;
|
|
200
|
+
/**
|
|
201
|
+
* Identity helper for table-local grant configuration.
|
|
202
|
+
*/
|
|
203
|
+
declare const setGrants: <const T extends readonly Grant.TableClassGrant[]>(grants: T) => T;
|
|
200
204
|
interface OrchidORMMethods {
|
|
201
205
|
/**
|
|
202
206
|
* @see import('pqb').QueryTransaction.prototype.transaction
|
|
@@ -501,7 +505,11 @@ interface ORMTableInput {
|
|
|
501
505
|
scopes?: RecordUnknown;
|
|
502
506
|
readonly softDelete?: true | string;
|
|
503
507
|
comment?: string;
|
|
504
|
-
rls?:
|
|
508
|
+
rls?: Rls.TableConfig;
|
|
509
|
+
/**
|
|
510
|
+
* Table-local grants used by migration generation.
|
|
511
|
+
*/
|
|
512
|
+
grants?: readonly Grant.TableClassGrant[];
|
|
505
513
|
autoForeignKeys?: TableData.References.BaseOptions | boolean;
|
|
506
514
|
}
|
|
507
515
|
type Queryable<T extends ORMTableInput> = ShallowSimplify<{ [K in keyof T['columns']['shape']]?: T['columns']['shape'][K]['queryType'] }>;
|
|
@@ -775,4 +783,4 @@ declare const createRepo: <T extends Query, Methods extends MethodsBase<T>>(tabl
|
|
|
775
783
|
table: T["table"];
|
|
776
784
|
shape: T["shape"];
|
|
777
785
|
}>(q: Q) => Query & Q & MapMethods<T, Methods>) & T, Methods>;
|
|
778
|
-
export { BaseTableClass, BaseTableInstance, DefaultSelect, FromQuery, Insertable, MapMethods, MapQueryMethods, MethodsBase, ORMTableInput, OrchidORM, OrchidORMDbTables, OrchidORMTableHelper, OrchidORMTables, OrchidOrmParam, Queryable, Repo, Selectable, SetColumnsResult, Table, TableClass, TableClasses, TableInfo, TableToDb, Updatable, bundleOrchidORMTables, createBaseTable, createRepo, defineRls, makeOrchidOrmDbWithAdapter, orchidORMWithAdapter };
|
|
786
|
+
export { BaseTableClass, BaseTableInstance, DefaultSelect, FromQuery, Insertable, MapMethods, MapQueryMethods, MethodsBase, ORMTableInput, OrchidORM, OrchidORMDbTables, OrchidORMTableHelper, OrchidORMTables, OrchidOrmParam, Queryable, Repo, Selectable, SetColumnsResult, Table, TableClass, TableClasses, TableInfo, TableToDb, Updatable, bundleOrchidORMTables, createBaseTable, createRepo, defineRls, makeOrchidOrmDbWithAdapter, orchidORMWithAdapter, setGrants };
|
package/dist/index.js
CHANGED
|
@@ -1374,6 +1374,10 @@ function afterCommit(hook) {
|
|
|
1374
1374
|
* Identity helper for table row-level security configuration.
|
|
1375
1375
|
*/
|
|
1376
1376
|
const defineRls = (rls) => rls;
|
|
1377
|
+
/**
|
|
1378
|
+
* Identity helper for table-local grant configuration.
|
|
1379
|
+
*/
|
|
1380
|
+
const setGrants = (grants) => grants;
|
|
1377
1381
|
const orchidORMBundleMetadataKey = Symbol("orchidORMBundleMetadataKey");
|
|
1378
1382
|
const assignTablesToOrm = (tables, result, adapter, qb, asyncStorage, commonOptions, schema) => {
|
|
1379
1383
|
const tableInstances = {};
|
|
@@ -1406,6 +1410,7 @@ const assignTablesToOrm = (tables, result, adapter, qb, asyncStorage, commonOpti
|
|
|
1406
1410
|
dbTable.filePath = table.filePath;
|
|
1407
1411
|
dbTable.name = table.constructor.name;
|
|
1408
1412
|
dbTable.internal.tableRls = table.rls;
|
|
1413
|
+
dbTable.internal.tableGrants = table.grants;
|
|
1409
1414
|
result[key] = dbTable;
|
|
1410
1415
|
}
|
|
1411
1416
|
applyRelations(qb, tableInstances, result, schema);
|
|
@@ -1528,6 +1533,7 @@ exports.createRepo = createRepo;
|
|
|
1528
1533
|
exports.defineRls = defineRls;
|
|
1529
1534
|
exports.makeOrchidOrmDbWithAdapter = makeOrchidOrmDbWithAdapter;
|
|
1530
1535
|
exports.orchidORMWithAdapter = orchidORMWithAdapter;
|
|
1536
|
+
exports.setGrants = setGrants;
|
|
1531
1537
|
Object.keys(pqb).forEach(function(k) {
|
|
1532
1538
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1533
1539
|
enumerable: true,
|