@cfast/db 0.7.0 → 0.8.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Grant, PermissionDescriptor } from '@cfast/permissions';
|
|
2
|
-
import { D as DbConfig, a as Db, O as Operation, C as CursorParams, b as OffsetParams } from './types-
|
|
3
|
-
export { c as CacheBackend, d as CacheConfig, e as
|
|
2
|
+
import { D as DbConfig, a as Db, O as Operation, C as CursorParams, b as OffsetParams } from './types-BBgSSwPM.js';
|
|
3
|
+
export { c as CacheBackend, d as CacheConfig, e as CrudAction, f as CursorPage, g as DeleteBuilder, h as DeleteReturningBuilder, F as FindFirstOptions, i as FindManyOptions, I as InferQueryResult, j as InferRow, k as InsertBuilder, l as InsertReturningBuilder, m as OffsetPage, P as PaginateOptions, n as PaginateParams, Q as QueryBuilder, o as QueryCacheOptions, T as TransactionResult, p as Tx, U as UpdateBuilder, q as UpdateReturningBuilder, r as UpdateWhereBuilder, W as WithCan } from './types-BBgSSwPM.js';
|
|
4
4
|
import 'drizzle-orm';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/seed.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DrizzleTable } from '@cfast/permissions';
|
|
2
|
-
import { a as Db,
|
|
2
|
+
import { a as Db, j as InferRow } from './types-BBgSSwPM.js';
|
|
3
3
|
import { Column } from 'drizzle-orm';
|
|
4
4
|
import { SQLiteColumnBuilderBase, SQLiteTableExtraConfigValue } from 'drizzle-orm/sqlite-core';
|
|
5
5
|
import { BuildColumns } from 'drizzle-orm/column-builder';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Grant, DrizzleTable, PermissionDescriptor } from '@cfast/permissions';
|
|
2
2
|
import { Table, TablesRelationalConfig, ExtractTablesWithRelations, TableRelationalConfig, BuildQueryResult } from 'drizzle-orm';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The four CRUD actions used as keys in `_can` annotations.
|
|
6
|
+
*
|
|
7
|
+
* Matches the `CrudAction` type from `@cfast/permissions`. Redefined here
|
|
8
|
+
* so `@cfast/db` does not import a runtime dependency from permissions just
|
|
9
|
+
* for a type alias.
|
|
10
|
+
*/
|
|
11
|
+
type CrudAction = "read" | "create" | "update" | "delete";
|
|
4
12
|
/**
|
|
5
13
|
* Augments a row type with a `_can` object containing per-action booleans.
|
|
6
14
|
*
|
|
@@ -10,7 +18,7 @@ import { Table, TablesRelationalConfig, ExtractTablesWithRelations, TableRelatio
|
|
|
10
18
|
* when the grant has a `where` clause.
|
|
11
19
|
*/
|
|
12
20
|
type WithCan<T> = T & {
|
|
13
|
-
_can: Record<
|
|
21
|
+
_can: Record<CrudAction, boolean>;
|
|
14
22
|
};
|
|
15
23
|
type InferRow<TTable> = TTable extends {
|
|
16
24
|
$inferSelect: infer R;
|
|
@@ -218,4 +226,4 @@ type DeleteReturningBuilder<TTable extends DrizzleTable = DrizzleTable> = Operat
|
|
|
218
226
|
returning: () => Operation<InferRow<TTable>>;
|
|
219
227
|
};
|
|
220
228
|
|
|
221
|
-
export type { CursorParams as C, DbConfig as D, FindFirstOptions as F, InferQueryResult as I, Operation as O, PaginateOptions as P, QueryBuilder as Q, TransactionResult as T, UpdateBuilder as U, WithCan as W, Db as a, OffsetParams as b, CacheBackend as c, CacheConfig as d,
|
|
229
|
+
export type { CursorParams as C, DbConfig as D, FindFirstOptions as F, InferQueryResult as I, Operation as O, PaginateOptions as P, QueryBuilder as Q, TransactionResult as T, UpdateBuilder as U, WithCan as W, Db as a, OffsetParams as b, CacheBackend as c, CacheConfig as d, CrudAction as e, CursorPage as f, DeleteBuilder as g, DeleteReturningBuilder as h, FindManyOptions as i, InferRow as j, InsertBuilder as k, InsertReturningBuilder as l, OffsetPage as m, PaginateParams as n, QueryCacheOptions as o, Tx as p, UpdateReturningBuilder as q, UpdateWhereBuilder as r };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfast/db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Permission-aware Drizzle queries for Cloudflare D1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cfast",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@faker-js/faker": "^9.0.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@cfast/permissions": ">=0.3.0 <0.
|
|
47
|
+
"@cfast/permissions": ">=0.3.0 <0.7.0",
|
|
48
48
|
"drizzle-orm": ">=0.35"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tsup": "^8",
|
|
62
62
|
"typescript": "^5.7",
|
|
63
63
|
"vitest": "^4.1.0",
|
|
64
|
-
"@cfast/permissions": "0.
|
|
64
|
+
"@cfast/permissions": "0.7.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsup src/index.ts src/seed.ts --format esm --dts",
|