dn-react-router-toolkit 0.7.4 → 0.7.5

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.
@@ -15,7 +15,7 @@ type APIHandlerOptions<T extends Table, TSelect> = {
15
15
  message?: (value?: InferInsertModel<T>[K]) => string;
16
16
  };
17
17
  };
18
- existingConditions: {
18
+ existingConditions?: {
19
19
  [K in keyof InferInsertModel<T>]?: (value: InferInsertModel<T>[K]) => SQLWrapper;
20
20
  };
21
21
  injectUserId?: boolean;
@@ -15,7 +15,7 @@ type APIHandlerOptions<T extends Table, TSelect> = {
15
15
  message?: (value?: InferInsertModel<T>[K]) => string;
16
16
  };
17
17
  };
18
- existingConditions: {
18
+ existingConditions?: {
19
19
  [K in keyof InferInsertModel<T>]?: (value: InferInsertModel<T>[K]) => SQLWrapper;
20
20
  };
21
21
  injectUserId?: boolean;
@@ -87,13 +87,8 @@ function apiHandler({
87
87
  const serilaizedParams = await request.json();
88
88
  const params = deserialize(serilaizedParams);
89
89
  if (validators) {
90
- const paramsForValidation = Object.keys(
91
- validators
92
- ).filter(
93
- (key) => Object.prototype.hasOwnProperty.call(
94
- validators,
95
- key
96
- )
90
+ const paramsForValidation = Object.keys(validators).filter(
91
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
97
92
  );
98
93
  for (const paramKey of paramsForValidation) {
99
94
  const value = params[paramKey];
@@ -73,13 +73,8 @@ function apiHandler({
73
73
  const serilaizedParams = await request.json();
74
74
  const params = deserialize(serilaizedParams);
75
75
  if (validators) {
76
- const paramsForValidation = Object.keys(
77
- validators
78
- ).filter(
79
- (key) => Object.prototype.hasOwnProperty.call(
80
- validators,
81
- key
82
- )
76
+ const paramsForValidation = Object.keys(validators).filter(
77
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
83
78
  );
84
79
  for (const paramKey of paramsForValidation) {
85
80
  const value = params[paramKey];
@@ -25,7 +25,7 @@ type FormContextProps<TModel> = {
25
25
  declare const FormContext: React__default.Context<{}>;
26
26
  declare function useFormContext<TModel>(): FormContextProps<TModel>;
27
27
  type CrudFormProps<TModel> = {
28
- primaryKey: keyof TModel;
28
+ primaryKey?: keyof TModel;
29
29
  name: string;
30
30
  prefix: string;
31
31
  item?: TModel;
@@ -25,7 +25,7 @@ type FormContextProps<TModel> = {
25
25
  declare const FormContext: React__default.Context<{}>;
26
26
  declare function useFormContext<TModel>(): FormContextProps<TModel>;
27
27
  type CrudFormProps<TModel> = {
28
- primaryKey: keyof TModel;
28
+ primaryKey?: keyof TModel;
29
29
  name: string;
30
30
  prefix: string;
31
31
  item?: TModel;
@@ -148,13 +148,8 @@ function apiHandler({
148
148
  const serilaizedParams = await request.json();
149
149
  const params = deserialize(serilaizedParams);
150
150
  if (validators) {
151
- const paramsForValidation = Object.keys(
152
- validators
153
- ).filter(
154
- (key) => Object.prototype.hasOwnProperty.call(
155
- validators,
156
- key
157
- )
151
+ const paramsForValidation = Object.keys(validators).filter(
152
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
158
153
  );
159
154
  for (const paramKey of paramsForValidation) {
160
155
  const value = params[paramKey];
@@ -135,13 +135,8 @@ function apiHandler({
135
135
  const serilaizedParams = await request.json();
136
136
  const params = deserialize(serilaizedParams);
137
137
  if (validators) {
138
- const paramsForValidation = Object.keys(
139
- validators
140
- ).filter(
141
- (key) => Object.prototype.hasOwnProperty.call(
142
- validators,
143
- key
144
- )
138
+ const paramsForValidation = Object.keys(validators).filter(
139
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
145
140
  );
146
141
  for (const paramKey of paramsForValidation) {
147
142
  const value = params[paramKey];
@@ -12,7 +12,7 @@ type CrudPageOptions<TModel> = {
12
12
  form?: React__default.FC<{
13
13
  form: FormContextProps<TModel>;
14
14
  }>;
15
- columns: CrudFormProps<TModel>["columns"];
15
+ columns?: CrudFormProps<TModel>["columns"];
16
16
  };
17
17
  header: React__default.FC<{
18
18
  title: string;
@@ -12,7 +12,7 @@ type CrudPageOptions<TModel> = {
12
12
  form?: React__default.FC<{
13
13
  form: FormContextProps<TModel>;
14
14
  }>;
15
- columns: CrudFormProps<TModel>["columns"];
15
+ columns?: CrudFormProps<TModel>["columns"];
16
16
  };
17
17
  header: React__default.FC<{
18
18
  title: string;
@@ -4,6 +4,7 @@ export { CrudPage, CrudPageOptions, crudPage } from './crud_page.mjs';
4
4
  export { generateHandlers } from './generate_handlers.mjs';
5
5
  export { generatePages } from './generate_pages.mjs';
6
6
  export { generateCrudRoutes } from './generate_routes.mjs';
7
+ export { deserialize, serialize } from './serialize.mjs';
7
8
  import 'react-store-input';
8
9
  import 'react';
9
10
  import 'react-router';
@@ -4,6 +4,7 @@ export { CrudPage, CrudPageOptions, crudPage } from './crud_page.js';
4
4
  export { generateHandlers } from './generate_handlers.js';
5
5
  export { generatePages } from './generate_pages.js';
6
6
  export { generateCrudRoutes } from './generate_routes.js';
7
+ export { deserialize, serialize } from './serialize.js';
7
8
  import 'react-store-input';
8
9
  import 'react';
9
10
  import 'react-router';
@@ -7596,9 +7596,11 @@ __export(crud_exports, {
7596
7596
  FormContext: () => FormContext,
7597
7597
  crudHandler: () => crudHandler,
7598
7598
  crudPage: () => crudPage,
7599
+ deserialize: () => deserialize,
7599
7600
  generateCrudRoutes: () => generateCrudRoutes,
7600
7601
  generateHandlers: () => generateHandlers,
7601
7602
  generatePages: () => generatePages,
7603
+ serialize: () => serialize,
7602
7604
  useFormContext: () => useFormContext
7603
7605
  });
7604
7606
  module.exports = __toCommonJS(crud_exports);
@@ -8052,13 +8054,8 @@ function apiHandler({
8052
8054
  const serilaizedParams = await request.json();
8053
8055
  const params = deserialize(serilaizedParams);
8054
8056
  if (validators) {
8055
- const paramsForValidation = Object.keys(
8056
- validators
8057
- ).filter(
8058
- (key) => Object.prototype.hasOwnProperty.call(
8059
- validators,
8060
- key
8061
- )
8057
+ const paramsForValidation = Object.keys(validators).filter(
8058
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
8062
8059
  );
8063
8060
  for (const paramKey of paramsForValidation) {
8064
8061
  const value = params[paramKey];
@@ -8719,9 +8716,11 @@ function generateCrudRoutes(routes, apiFile, file) {
8719
8716
  FormContext,
8720
8717
  crudHandler,
8721
8718
  crudPage,
8719
+ deserialize,
8722
8720
  generateCrudRoutes,
8723
8721
  generateHandlers,
8724
8722
  generatePages,
8723
+ serialize,
8725
8724
  useFormContext
8726
8725
  });
8727
8726
  /*! Bundled license information:
@@ -8048,13 +8048,8 @@ function apiHandler({
8048
8048
  const serilaizedParams = await request.json();
8049
8049
  const params = deserialize(serilaizedParams);
8050
8050
  if (validators) {
8051
- const paramsForValidation = Object.keys(
8052
- validators
8053
- ).filter(
8054
- (key) => Object.prototype.hasOwnProperty.call(
8055
- validators,
8056
- key
8057
- )
8051
+ const paramsForValidation = Object.keys(validators).filter(
8052
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
8058
8053
  );
8059
8054
  for (const paramKey of paramsForValidation) {
8060
8055
  const value = params[paramKey];
@@ -8720,9 +8715,11 @@ export {
8720
8715
  FormContext,
8721
8716
  crudHandler,
8722
8717
  crudPage,
8718
+ deserialize,
8723
8719
  generateCrudRoutes,
8724
8720
  generateHandlers,
8725
8721
  generatePages,
8722
+ serialize,
8726
8723
  useFormContext
8727
8724
  };
8728
8725
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,101 +1,101 @@
1
1
  {
2
- "name": "dn-react-router-toolkit",
3
- "version": "0.7.4",
4
- "types": "./dist/index.d.ts",
5
- "main": "./dist/index.mjs",
6
- "module": "./dist/index.js",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
12
- },
13
- "./auth": {
14
- "types": "./dist/auth/index.d.ts",
15
- "import": "./dist/auth/index.mjs",
16
- "require": "./dist/auth/index.js"
17
- },
18
- "./api": {
19
- "types": "./dist/api/index.d.ts",
20
- "import": "./dist/api/index.mjs",
21
- "require": "./dist/api/index.js"
22
- },
23
- "./client": {
24
- "types": "./dist/client/index.d.ts",
25
- "import": "./dist/client/index.mjs",
26
- "require": "./dist/client/index.js"
27
- },
28
- "./seo": {
29
- "types": "./dist/seo/index.d.ts",
30
- "import": "./dist/seo/index.mjs",
31
- "require": "./dist/seo/index.js"
32
- },
33
- "./db": {
34
- "types": "./dist/db/index.d.ts",
35
- "import": "./dist/db/index.mjs",
36
- "require": "./dist/db/index.js"
37
- },
38
- "./db/backup": {
39
- "types": "./dist/db/backup/index.d.ts",
40
- "import": "./dist/db/backup/index.mjs",
41
- "require": "./dist/db/backup/index.js"
42
- },
43
- "./table": {
44
- "types": "./dist/table/index.d.ts",
45
- "import": "./dist/table/index.mjs",
46
- "require": "./dist/table/index.js"
47
- },
48
- "./crud": {
49
- "types": "./dist/crud/index.d.ts",
50
- "import": "./dist/crud/index.mjs",
51
- "require": "./dist/crud/index.js"
52
- },
53
- "./post": {
54
- "types": "./dist/post/index.d.ts",
55
- "import": "./dist/post/index.mjs",
56
- "require": "./dist/post/index.js"
57
- },
58
- "./form": {
59
- "types": "./dist/form/index.d.ts",
60
- "import": "./dist/form/index.mjs",
61
- "require": "./dist/form/index.js"
62
- }
2
+ "name": "dn-react-router-toolkit",
3
+ "version": "0.7.5",
4
+ "types": "./dist/index.d.ts",
5
+ "main": "./dist/index.mjs",
6
+ "module": "./dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js"
63
12
  },
64
- "scripts": {
65
- "build": "tsup",
66
- "dev": "tsup --watch"
13
+ "./auth": {
14
+ "types": "./dist/auth/index.d.ts",
15
+ "import": "./dist/auth/index.mjs",
16
+ "require": "./dist/auth/index.js"
67
17
  },
68
- "repository": {
69
- "type": "git",
70
- "url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
18
+ "./api": {
19
+ "types": "./dist/api/index.d.ts",
20
+ "import": "./dist/api/index.mjs",
21
+ "require": "./dist/api/index.js"
71
22
  },
72
- "author": "",
73
- "license": "MIT",
74
- "bugs": {
75
- "url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
23
+ "./client": {
24
+ "types": "./dist/client/index.d.ts",
25
+ "import": "./dist/client/index.mjs",
26
+ "require": "./dist/client/index.js"
76
27
  },
77
- "homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
78
- "description": "",
79
- "devDependencies": {
80
- "@types/node": "^24.10.1",
81
- "@types/react": "^19",
82
- "@types/react-dom": "^19",
83
- "schema-dts": "^1.1.5",
84
- "tsup": "^8.5.1",
85
- "@react-router/dev": "^7.12.0",
86
- "typescript": "^5.7.3"
28
+ "./seo": {
29
+ "types": "./dist/seo/index.d.ts",
30
+ "import": "./dist/seo/index.mjs",
31
+ "require": "./dist/seo/index.js"
87
32
  },
88
- "dependencies": {
89
- "dn-react-text-editor": "^0.3.6",
90
- "dn-react-toolkit": "^0.2.49",
91
- "pg": "^8.16.3",
92
- "react-store-input": "^0.2.0",
93
- "uuid": "^13.0.0"
33
+ "./db": {
34
+ "types": "./dist/db/index.d.ts",
35
+ "import": "./dist/db/index.mjs",
36
+ "require": "./dist/db/index.js"
94
37
  },
95
- "peerDependencies": {
96
- "drizzle-orm": "^0.45.1",
97
- "react": "^19",
98
- "react-dom": "^19",
99
- "react-router": "^7.12.0"
38
+ "./db/backup": {
39
+ "types": "./dist/db/backup/index.d.ts",
40
+ "import": "./dist/db/backup/index.mjs",
41
+ "require": "./dist/db/backup/index.js"
42
+ },
43
+ "./table": {
44
+ "types": "./dist/table/index.d.ts",
45
+ "import": "./dist/table/index.mjs",
46
+ "require": "./dist/table/index.js"
47
+ },
48
+ "./crud": {
49
+ "types": "./dist/crud/index.d.ts",
50
+ "import": "./dist/crud/index.mjs",
51
+ "require": "./dist/crud/index.js"
52
+ },
53
+ "./post": {
54
+ "types": "./dist/post/index.d.ts",
55
+ "import": "./dist/post/index.mjs",
56
+ "require": "./dist/post/index.js"
57
+ },
58
+ "./form": {
59
+ "types": "./dist/form/index.d.ts",
60
+ "import": "./dist/form/index.mjs",
61
+ "require": "./dist/form/index.js"
100
62
  }
63
+ },
64
+ "scripts": {
65
+ "build": "tsup",
66
+ "dev": "tsup --watch"
67
+ },
68
+ "repository": {
69
+ "type": "git",
70
+ "url": "git+https://github.com/dndnsoft/dn-react-router-toolkit.git"
71
+ },
72
+ "author": "",
73
+ "license": "MIT",
74
+ "bugs": {
75
+ "url": "https://github.com/dndnsoft/dn-react-router-toolkit/issues"
76
+ },
77
+ "homepage": "https://github.com/dndnsoft/dn-react-router-toolkit#readme",
78
+ "description": "",
79
+ "devDependencies": {
80
+ "@types/node": "^24.10.1",
81
+ "@types/react": "^19",
82
+ "@types/react-dom": "^19",
83
+ "schema-dts": "^1.1.5",
84
+ "tsup": "^8.5.1",
85
+ "@react-router/dev": "^7.12.0",
86
+ "typescript": "^5.7.3"
87
+ },
88
+ "dependencies": {
89
+ "dn-react-text-editor": "^0.3.6",
90
+ "dn-react-toolkit": "^0.2.49",
91
+ "pg": "^8.16.3",
92
+ "react-store-input": "^0.2.0",
93
+ "uuid": "^13.0.0"
94
+ },
95
+ "peerDependencies": {
96
+ "drizzle-orm": "^0.45.1",
97
+ "react": "^19",
98
+ "react-dom": "^19",
99
+ "react-router": "^7.12.0"
100
+ }
101
101
  }