dn-react-router-toolkit 0.7.15 → 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.
Files changed (63) hide show
  1. package/dist/api/create_api_handler.d.mts +5 -4
  2. package/dist/api/create_api_handler.d.ts +5 -4
  3. package/dist/api/create_api_handler.js +0 -1
  4. package/dist/api/create_api_handler.mjs +0 -1
  5. package/dist/api/index.d.mts +1 -0
  6. package/dist/api/index.d.ts +1 -0
  7. package/dist/api/index.js +0 -2
  8. package/dist/api/index.mjs +0 -2
  9. package/dist/api/item_api_handler.d.mts +5 -4
  10. package/dist/api/item_api_handler.d.ts +5 -4
  11. package/dist/api/item_api_handler.js +0 -1
  12. package/dist/api/item_api_handler.mjs +0 -1
  13. package/dist/crud/crud_loader.d.mts +6 -5
  14. package/dist/crud/crud_loader.d.ts +6 -5
  15. package/dist/crud/crud_loader.js +46 -34
  16. package/dist/crud/crud_loader.mjs +46 -34
  17. package/dist/crud/crud_page.d.mts +3 -2
  18. package/dist/crud/crud_page.d.ts +3 -2
  19. package/dist/crud/crud_page.js +225 -197
  20. package/dist/crud/crud_page.mjs +223 -201
  21. package/dist/crud/generate_handlers.d.mts +3 -2
  22. package/dist/crud/generate_handlers.d.ts +3 -2
  23. package/dist/crud/generate_pages.d.mts +2 -1
  24. package/dist/crud/generate_pages.d.ts +2 -1
  25. package/dist/crud/index.d.mts +5 -3
  26. package/dist/crud/index.d.ts +5 -3
  27. package/dist/crud/index.js +245 -205
  28. package/dist/crud/index.mjs +251 -217
  29. package/dist/post/index.js +65 -58
  30. package/dist/post/index.mjs +68 -67
  31. package/dist/post/post_form_page.js +65 -58
  32. package/dist/post/post_form_page.mjs +68 -67
  33. package/dist/table/index.d.mts +7 -3
  34. package/dist/table/index.d.ts +7 -3
  35. package/dist/table/index.js +153 -105
  36. package/dist/table/index.mjs +149 -110
  37. package/dist/table/item_loader.d.mts +5 -4
  38. package/dist/table/item_loader.d.ts +5 -4
  39. package/dist/table/load_table.d.mts +30 -0
  40. package/dist/table/load_table.d.ts +30 -0
  41. package/dist/table/load_table.js +67 -0
  42. package/dist/table/load_table.mjs +45 -0
  43. package/dist/table/loader.d.mts +7 -15
  44. package/dist/table/loader.d.ts +7 -15
  45. package/dist/table/loader.js +47 -31
  46. package/dist/table/loader.mjs +46 -32
  47. package/dist/table/page.d.mts +6 -16
  48. package/dist/table/page.d.ts +6 -16
  49. package/dist/table/page.js +193 -165
  50. package/dist/table/page.mjs +194 -172
  51. package/dist/table/repository.d.mts +13 -11
  52. package/dist/table/repository.d.ts +13 -11
  53. package/dist/table/repository.js +1 -1
  54. package/dist/table/repository.mjs +1 -1
  55. package/dist/table/table_form.d.mts +13 -0
  56. package/dist/table/table_form.d.ts +13 -0
  57. package/dist/table/table_form.js +295 -0
  58. package/dist/table/table_form.mjs +270 -0
  59. package/dist/table/use_table.d.mts +4 -0
  60. package/dist/table/use_table.d.ts +4 -0
  61. package/dist/table/use_table.js +43 -0
  62. package/dist/table/use_table.mjs +18 -0
  63. package/package.json +1 -1
@@ -1,12 +1,13 @@
1
- import { Table, InferSelectModel, SQLWrapper } from 'drizzle-orm';
1
+ import { InferSelectModel, SQLWrapper } from 'drizzle-orm';
2
2
  import { ActionFunctionArgs, LoaderFunctionArgs } from 'react-router';
3
3
  import { TableRepository } from '../table/repository.mjs';
4
+ import { PgTableWithColumns } from 'drizzle-orm/pg-core';
4
5
  import { WithAuthHandler } from '../auth/with_auth.mjs';
5
- import 'drizzle-orm/pg-core';
6
+ import 'drizzle-orm/node-postgres';
6
7
  import 'dn-react-toolkit/auth';
7
8
  import 'dn-react-toolkit/auth/server';
8
9
 
9
- type APIHandlerOptions<T extends Table, TSelect> = {
10
+ type APIHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
10
11
  withAuthAction: WithAuthHandler<ActionFunctionArgs>;
11
12
  repository: TableRepository<T, TSelect>;
12
13
  validators?: {
@@ -21,7 +22,7 @@ type APIHandlerOptions<T extends Table, TSelect> = {
21
22
  injectUserId?: boolean;
22
23
  roles?: string[];
23
24
  };
24
- declare function apiHandler<T extends Table, TSelect>({ withAuthAction, repository, validators, existingConditions, injectUserId, roles, }: APIHandlerOptions<T, TSelect>): {
25
+ declare function apiHandler<T extends PgTableWithColumns<any>, TSelect>({ withAuthAction, repository, validators, existingConditions, injectUserId, roles, }: APIHandlerOptions<T, TSelect>): {
25
26
  loader: ({ request }: LoaderFunctionArgs) => Promise<{}>;
26
27
  action: (arg: ActionFunctionArgs<any>) => Promise<unknown> | unknown;
27
28
  };
@@ -1,12 +1,13 @@
1
- import { Table, InferSelectModel, SQLWrapper } from 'drizzle-orm';
1
+ import { InferSelectModel, SQLWrapper } from 'drizzle-orm';
2
2
  import { ActionFunctionArgs, LoaderFunctionArgs } from 'react-router';
3
3
  import { TableRepository } from '../table/repository.js';
4
+ import { PgTableWithColumns } from 'drizzle-orm/pg-core';
4
5
  import { WithAuthHandler } from '../auth/with_auth.js';
5
- import 'drizzle-orm/pg-core';
6
+ import 'drizzle-orm/node-postgres';
6
7
  import 'dn-react-toolkit/auth';
7
8
  import 'dn-react-toolkit/auth/server';
8
9
 
9
- type APIHandlerOptions<T extends Table, TSelect> = {
10
+ type APIHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
10
11
  withAuthAction: WithAuthHandler<ActionFunctionArgs>;
11
12
  repository: TableRepository<T, TSelect>;
12
13
  validators?: {
@@ -21,7 +22,7 @@ type APIHandlerOptions<T extends Table, TSelect> = {
21
22
  injectUserId?: boolean;
22
23
  roles?: string[];
23
24
  };
24
- declare function apiHandler<T extends Table, TSelect>({ withAuthAction, repository, validators, existingConditions, injectUserId, roles, }: APIHandlerOptions<T, TSelect>): {
25
+ declare function apiHandler<T extends PgTableWithColumns<any>, TSelect>({ withAuthAction, repository, validators, existingConditions, injectUserId, roles, }: APIHandlerOptions<T, TSelect>): {
25
26
  loader: ({ request }: LoaderFunctionArgs) => Promise<{}>;
26
27
  action: (arg: ActionFunctionArgs<any>) => Promise<unknown> | unknown;
27
28
  };
@@ -25,7 +25,6 @@ __export(create_api_handler_exports, {
25
25
  module.exports = __toCommonJS(create_api_handler_exports);
26
26
  var import_http = require("dn-react-toolkit/http");
27
27
  var import_drizzle_orm = require("drizzle-orm");
28
- var import_react_router = require("react-router");
29
28
  var import_uuid = require("uuid");
30
29
 
31
30
  // src/crud/serialize.ts
@@ -10,7 +10,6 @@ import {
10
10
  import {
11
11
  and
12
12
  } from "drizzle-orm";
13
- import "react-router";
14
13
  import { v4 } from "uuid";
15
14
 
16
15
  // src/crud/serialize.ts
@@ -6,6 +6,7 @@ import 'dn-react-toolkit/auth/server';
6
6
  import 'dn-react-toolkit/file/server';
7
7
  import 'drizzle-orm';
8
8
  import '../table/repository.mjs';
9
+ import 'drizzle-orm/node-postgres';
9
10
  import 'drizzle-orm/pg-core';
10
11
  import '../auth/with_auth.mjs';
11
12
  import 'dn-react-toolkit/auth';
@@ -6,6 +6,7 @@ import 'dn-react-toolkit/auth/server';
6
6
  import 'dn-react-toolkit/file/server';
7
7
  import 'drizzle-orm';
8
8
  import '../table/repository.js';
9
+ import 'drizzle-orm/node-postgres';
9
10
  import 'drizzle-orm/pg-core';
10
11
  import '../auth/with_auth.js';
11
12
  import 'dn-react-toolkit/auth';
package/dist/api/index.js CHANGED
@@ -250,7 +250,6 @@ var createAPIHandler = ({
250
250
  // src/api/create_api_handler.ts
251
251
  var import_http2 = require("dn-react-toolkit/http");
252
252
  var import_drizzle_orm = require("drizzle-orm");
253
- var import_react_router2 = require("react-router");
254
253
  var import_uuid = require("uuid");
255
254
 
256
255
  // src/crud/serialize.ts
@@ -378,7 +377,6 @@ function apiHandler({
378
377
 
379
378
  // src/api/item_api_handler.ts
380
379
  var import_http3 = require("dn-react-toolkit/http");
381
- var import_react_router3 = require("react-router");
382
380
  function itemApiHandler({
383
381
  withAuthAction,
384
382
  repository
@@ -245,7 +245,6 @@ import {
245
245
  import {
246
246
  and
247
247
  } from "drizzle-orm";
248
- import "react-router";
249
248
  import { v4 } from "uuid";
250
249
 
251
250
  // src/crud/serialize.ts
@@ -373,7 +372,6 @@ function apiHandler({
373
372
 
374
373
  // src/api/item_api_handler.ts
375
374
  import { UNAUTHORIZED as UNAUTHORIZED2 } from "dn-react-toolkit/http";
376
- import "react-router";
377
375
  function itemApiHandler({
378
376
  withAuthAction,
379
377
  repository
@@ -1,16 +1,17 @@
1
- import { Table } from 'drizzle-orm';
2
1
  import { LoaderFunctionArgs } from 'react-router';
3
2
  import { TableRepository } from '../table/repository.mjs';
3
+ import { PgTableWithColumns } from 'drizzle-orm/pg-core';
4
4
  import { WithAuthHandler } from '../auth/with_auth.mjs';
5
- import 'drizzle-orm/pg-core';
5
+ import 'drizzle-orm';
6
+ import 'drizzle-orm/node-postgres';
6
7
  import 'dn-react-toolkit/auth';
7
8
  import 'dn-react-toolkit/auth/server';
8
9
 
9
- type ItemAPIHandlerOptions<T extends Table, TSelect> = {
10
+ type ItemAPIHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
10
11
  withAuthAction: WithAuthHandler<LoaderFunctionArgs>;
11
12
  repository: TableRepository<T, TSelect>;
12
13
  };
13
- declare function itemApiHandler<T extends Table, TSelect>({ withAuthAction, repository, }: ItemAPIHandlerOptions<T, TSelect>): {
14
+ declare function itemApiHandler<T extends PgTableWithColumns<any>, TSelect>({ withAuthAction, repository, }: ItemAPIHandlerOptions<T, TSelect>): {
14
15
  loader: ({ request }: LoaderFunctionArgs) => Promise<{}>;
15
16
  action: (arg: LoaderFunctionArgs<any>) => Promise<unknown> | unknown;
16
17
  };
@@ -1,16 +1,17 @@
1
- import { Table } from 'drizzle-orm';
2
1
  import { LoaderFunctionArgs } from 'react-router';
3
2
  import { TableRepository } from '../table/repository.js';
3
+ import { PgTableWithColumns } from 'drizzle-orm/pg-core';
4
4
  import { WithAuthHandler } from '../auth/with_auth.js';
5
- import 'drizzle-orm/pg-core';
5
+ import 'drizzle-orm';
6
+ import 'drizzle-orm/node-postgres';
6
7
  import 'dn-react-toolkit/auth';
7
8
  import 'dn-react-toolkit/auth/server';
8
9
 
9
- type ItemAPIHandlerOptions<T extends Table, TSelect> = {
10
+ type ItemAPIHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
10
11
  withAuthAction: WithAuthHandler<LoaderFunctionArgs>;
11
12
  repository: TableRepository<T, TSelect>;
12
13
  };
13
- declare function itemApiHandler<T extends Table, TSelect>({ withAuthAction, repository, }: ItemAPIHandlerOptions<T, TSelect>): {
14
+ declare function itemApiHandler<T extends PgTableWithColumns<any>, TSelect>({ withAuthAction, repository, }: ItemAPIHandlerOptions<T, TSelect>): {
14
15
  loader: ({ request }: LoaderFunctionArgs) => Promise<{}>;
15
16
  action: (arg: LoaderFunctionArgs<any>) => Promise<unknown> | unknown;
16
17
  };
@@ -24,7 +24,6 @@ __export(item_api_handler_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(item_api_handler_exports);
26
26
  var import_http = require("dn-react-toolkit/http");
27
- var import_react_router = require("react-router");
28
27
  function itemApiHandler({
29
28
  withAuthAction,
30
29
  repository
@@ -1,6 +1,5 @@
1
1
  // src/api/item_api_handler.ts
2
2
  import { UNAUTHORIZED } from "dn-react-toolkit/http";
3
- import "react-router";
4
3
  function itemApiHandler({
5
4
  withAuthAction,
6
5
  repository
@@ -1,15 +1,16 @@
1
1
  import { LoaderFunctionArgs, LoaderFunction } from 'react-router';
2
- import { TableLoaderOptions } from '../table/loader.mjs';
3
2
  import { TableItemLoaderOptions } from '../table/item_loader.mjs';
4
- import { Table } from 'drizzle-orm';
5
3
  import { TableRepository } from '../table/repository.mjs';
4
+ import { TableLoaderOptions } from '../table/load_table.mjs';
5
+ import { PgTableWithColumns } from 'drizzle-orm/pg-core';
6
6
  import { APIHandlerOptions } from '../api/create_api_handler.mjs';
7
- import 'drizzle-orm/pg-core';
7
+ import 'drizzle-orm';
8
+ import 'drizzle-orm/node-postgres';
8
9
  import '../auth/with_auth.mjs';
9
10
  import 'dn-react-toolkit/auth';
10
11
  import 'dn-react-toolkit/auth/server';
11
12
 
12
- type CrudHandlerOptions<T extends Table, TSelect> = {
13
+ type CrudHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
13
14
  repository: TableRepository<T, TSelect>;
14
15
  apiHandlerOptions: Omit<APIHandlerOptions<T, TSelect>, "repository">;
15
16
  loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository"> & {
@@ -20,6 +21,6 @@ type CrudHandlerOptions<T extends Table, TSelect> = {
20
21
  };
21
22
  };
22
23
  type CrudHandler = (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
23
- declare function crudHandler<T extends Table, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
24
+ declare function crudHandler<T extends PgTableWithColumns<any>, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
24
25
 
25
26
  export { type CrudHandler, type CrudHandlerOptions, crudHandler };
@@ -1,15 +1,16 @@
1
1
  import { LoaderFunctionArgs, LoaderFunction } from 'react-router';
2
- import { TableLoaderOptions } from '../table/loader.js';
3
2
  import { TableItemLoaderOptions } from '../table/item_loader.js';
4
- import { Table } from 'drizzle-orm';
5
3
  import { TableRepository } from '../table/repository.js';
4
+ import { TableLoaderOptions } from '../table/load_table.js';
5
+ import { PgTableWithColumns } from 'drizzle-orm/pg-core';
6
6
  import { APIHandlerOptions } from '../api/create_api_handler.js';
7
- import 'drizzle-orm/pg-core';
7
+ import 'drizzle-orm';
8
+ import 'drizzle-orm/node-postgres';
8
9
  import '../auth/with_auth.js';
9
10
  import 'dn-react-toolkit/auth';
10
11
  import 'dn-react-toolkit/auth/server';
11
12
 
12
- type CrudHandlerOptions<T extends Table, TSelect> = {
13
+ type CrudHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
13
14
  repository: TableRepository<T, TSelect>;
14
15
  apiHandlerOptions: Omit<APIHandlerOptions<T, TSelect>, "repository">;
15
16
  loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository"> & {
@@ -20,6 +21,6 @@ type CrudHandlerOptions<T extends Table, TSelect> = {
20
21
  };
21
22
  };
22
23
  type CrudHandler = (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
23
- declare function crudHandler<T extends Table, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
24
+ declare function crudHandler<T extends PgTableWithColumns<any>, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
24
25
 
25
26
  export { type CrudHandler, type CrudHandlerOptions, crudHandler };
@@ -24,45 +24,59 @@ __export(crud_loader_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(crud_loader_exports);
26
26
 
27
- // src/table/loader.tsx
27
+ // src/table/load_table.tsx
28
28
  var import_drizzle_orm = require("drizzle-orm");
29
+ async function loadTable({
30
+ request,
31
+ repository,
32
+ options
33
+ }) {
34
+ const searchParams = new URL(request.url).searchParams;
35
+ const { where, searchKey, defaultOrderBy, defaultDirection } = options;
36
+ const query = searchParams.get("query") ?? void 0;
37
+ const limit = Number(searchParams.get("limit") ?? "20");
38
+ const offset = Number(searchParams.get("offset") ?? "0");
39
+ const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
40
+ const direction = searchParams.get("direction") ?? defaultDirection;
41
+ const whereClauses = (0, import_drizzle_orm.and)(
42
+ searchKey && query ? (0, import_drizzle_orm.ilike)(
43
+ repository.schema[searchKey],
44
+ `%${query}%`
45
+ ) : void 0,
46
+ ...where ?? []
47
+ );
48
+ const total = await repository.countTotal({ where: whereClauses });
49
+ const items = await repository.findAll({
50
+ orderBy,
51
+ direction,
52
+ limit,
53
+ offset,
54
+ where: whereClauses
55
+ });
56
+ return {
57
+ items,
58
+ total,
59
+ limit,
60
+ offset,
61
+ orderBy,
62
+ direction,
63
+ searchKey
64
+ };
65
+ }
66
+
67
+ // src/table/loader.tsx
29
68
  function tableLoader({
30
69
  repository,
31
- tableOptions
70
+ options
32
71
  }) {
33
72
  return async ({ request }) => {
34
- const searchParams = new URL(request.url).searchParams;
35
- const { where, searchKey, defaultOrderBy, defaultDirection } = tableOptions;
36
- const query = searchParams.get("query") ?? void 0;
37
- const limit = Number(searchParams.get("limit") ?? "10");
38
- const offset = Number(searchParams.get("offset") ?? "0");
39
- const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
40
- const direction = searchParams.get("direction") ?? defaultDirection;
41
- const whereClauses = (0, import_drizzle_orm.and)(
42
- searchKey && query ? (0, import_drizzle_orm.ilike)(
43
- repository.schema[searchKey],
44
- `%${query}%`
45
- ) : void 0,
46
- ...where ?? []
47
- );
48
- const total = await repository.countTotal({ where: whereClauses });
49
- const items = await repository.findAll({
50
- orderBy,
51
- direction,
52
- limit,
53
- offset,
54
- where: whereClauses
73
+ const table = await loadTable({
74
+ request,
75
+ repository,
76
+ options
55
77
  });
56
78
  return {
57
- table: {
58
- items,
59
- total,
60
- limit,
61
- offset,
62
- orderBy,
63
- direction,
64
- searchKey
65
- }
79
+ table
66
80
  };
67
81
  };
68
82
  }
@@ -86,7 +100,6 @@ var tableItemloader = ({
86
100
  // src/api/create_api_handler.ts
87
101
  var import_http = require("dn-react-toolkit/http");
88
102
  var import_drizzle_orm2 = require("drizzle-orm");
89
- var import_react_router = require("react-router");
90
103
  var import_uuid = require("uuid");
91
104
 
92
105
  // src/crud/serialize.ts
@@ -214,7 +227,6 @@ function apiHandler({
214
227
 
215
228
  // src/api/item_api_handler.ts
216
229
  var import_http2 = require("dn-react-toolkit/http");
217
- var import_react_router2 = require("react-router");
218
230
  function itemApiHandler({
219
231
  withAuthAction,
220
232
  repository
@@ -1,45 +1,59 @@
1
- // src/table/loader.tsx
1
+ // src/table/load_table.tsx
2
2
  import {
3
3
  and,
4
4
  ilike
5
5
  } from "drizzle-orm";
6
+ async function loadTable({
7
+ request,
8
+ repository,
9
+ options
10
+ }) {
11
+ const searchParams = new URL(request.url).searchParams;
12
+ const { where, searchKey, defaultOrderBy, defaultDirection } = options;
13
+ const query = searchParams.get("query") ?? void 0;
14
+ const limit = Number(searchParams.get("limit") ?? "20");
15
+ const offset = Number(searchParams.get("offset") ?? "0");
16
+ const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
17
+ const direction = searchParams.get("direction") ?? defaultDirection;
18
+ const whereClauses = and(
19
+ searchKey && query ? ilike(
20
+ repository.schema[searchKey],
21
+ `%${query}%`
22
+ ) : void 0,
23
+ ...where ?? []
24
+ );
25
+ const total = await repository.countTotal({ where: whereClauses });
26
+ const items = await repository.findAll({
27
+ orderBy,
28
+ direction,
29
+ limit,
30
+ offset,
31
+ where: whereClauses
32
+ });
33
+ return {
34
+ items,
35
+ total,
36
+ limit,
37
+ offset,
38
+ orderBy,
39
+ direction,
40
+ searchKey
41
+ };
42
+ }
43
+
44
+ // src/table/loader.tsx
6
45
  function tableLoader({
7
46
  repository,
8
- tableOptions
47
+ options
9
48
  }) {
10
49
  return async ({ request }) => {
11
- const searchParams = new URL(request.url).searchParams;
12
- const { where, searchKey, defaultOrderBy, defaultDirection } = tableOptions;
13
- const query = searchParams.get("query") ?? void 0;
14
- const limit = Number(searchParams.get("limit") ?? "10");
15
- const offset = Number(searchParams.get("offset") ?? "0");
16
- const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
17
- const direction = searchParams.get("direction") ?? defaultDirection;
18
- const whereClauses = and(
19
- searchKey && query ? ilike(
20
- repository.schema[searchKey],
21
- `%${query}%`
22
- ) : void 0,
23
- ...where ?? []
24
- );
25
- const total = await repository.countTotal({ where: whereClauses });
26
- const items = await repository.findAll({
27
- orderBy,
28
- direction,
29
- limit,
30
- offset,
31
- where: whereClauses
50
+ const table = await loadTable({
51
+ request,
52
+ repository,
53
+ options
32
54
  });
33
55
  return {
34
- table: {
35
- items,
36
- total,
37
- limit,
38
- offset,
39
- orderBy,
40
- direction,
41
- searchKey
42
- }
56
+ table
43
57
  };
44
58
  };
45
59
  }
@@ -72,7 +86,6 @@ import {
72
86
  import {
73
87
  and as and2
74
88
  } from "drizzle-orm";
75
- import "react-router";
76
89
  import { v4 } from "uuid";
77
90
 
78
91
  // src/crud/serialize.ts
@@ -200,7 +213,6 @@ function apiHandler({
200
213
 
201
214
  // src/api/item_api_handler.ts
202
215
  import { UNAUTHORIZED as UNAUTHORIZED2 } from "dn-react-toolkit/http";
203
- import "react-router";
204
216
  function itemApiHandler({
205
217
  withAuthAction,
206
218
  repository
@@ -1,14 +1,15 @@
1
1
  import { FormContextProps, CrudFormProps } from './crud_form_provider.mjs';
2
- import { TablePageOptions } from '../table/page.mjs';
3
2
  import { FC, ReactNode } from 'react';
3
+ import { TablePageOptions } from '../table/table_form.mjs';
4
4
  import 'react/jsx-runtime';
5
5
  import 'react-store-input';
6
6
  import '../table/table.mjs';
7
+ import '../table/use_table.mjs';
7
8
 
8
9
  type CrudPageOptions<TModel> = {
9
10
  name: string;
10
11
  primaryKey: keyof TModel;
11
- tablePageOptions: Omit<TablePageOptions<TModel>, "name">;
12
+ tablePageOptions: TablePageOptions<TModel>;
12
13
  formOptions: {
13
14
  form?: FC<{
14
15
  form: FormContextProps<TModel>;
@@ -1,14 +1,15 @@
1
1
  import { FormContextProps, CrudFormProps } from './crud_form_provider.js';
2
- import { TablePageOptions } from '../table/page.js';
3
2
  import { FC, ReactNode } from 'react';
3
+ import { TablePageOptions } from '../table/table_form.js';
4
4
  import 'react/jsx-runtime';
5
5
  import 'react-store-input';
6
6
  import '../table/table.js';
7
+ import '../table/use_table.js';
7
8
 
8
9
  type CrudPageOptions<TModel> = {
9
10
  name: string;
10
11
  primaryKey: keyof TModel;
11
- tablePageOptions: Omit<TablePageOptions<TModel>, "name">;
12
+ tablePageOptions: TablePageOptions<TModel>;
12
13
  formOptions: {
13
14
  form?: FC<{
14
15
  form: FormContextProps<TModel>;