@ai0x0/utils 0.0.17 → 0.0.18
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/es/backend/actions/create-delete-action.d.ts +4 -3
- package/es/backend/actions/create-get-action.d.ts +3 -2
- package/es/backend/actions/create-get-list-action.d.ts +3 -2
- package/es/backend/actions/create-post-action.d.ts +4 -4
- package/es/backend/actions/create-put-action.d.ts +3 -2
- package/es/backend/actions/get-list-query.d.ts +12 -4
- package/es/backend/actions/get-list-query.js +8 -11
- package/es/backend/route-operation/delete-operation.d.ts +3 -2
- package/es/backend/route-operation/get-list-operation.d.ts +3 -2
- package/es/backend/route-operation/get-operation.d.ts +3 -2
- package/es/backend/route-operation/get-table-name.d.ts +2 -2
- package/es/backend/route-operation/post-operation.d.ts +5 -5
- package/es/backend/route-operation/put-operation.d.ts +5 -4
- package/es/backend/schemas/index.d.ts +597 -598
- package/es/backend/schemas/index.js +31 -19
- package/es/backend/types.d.ts +8 -14
- package/lib/backend/actions/create-delete-action.d.ts +4 -3
- package/lib/backend/actions/create-get-action.d.ts +3 -2
- package/lib/backend/actions/create-get-list-action.d.ts +3 -2
- package/lib/backend/actions/create-post-action.d.ts +4 -4
- package/lib/backend/actions/create-post-action.js +4 -1
- package/lib/backend/actions/create-put-action.d.ts +3 -2
- package/lib/backend/actions/get-list-query.d.ts +12 -4
- package/lib/backend/actions/get-list-query.js +6 -7
- package/lib/backend/route-operation/delete-operation.d.ts +3 -2
- package/lib/backend/route-operation/get-list-operation.d.ts +3 -2
- package/lib/backend/route-operation/get-operation.d.ts +3 -2
- package/lib/backend/route-operation/get-table-name.d.ts +2 -2
- package/lib/backend/route-operation/post-operation.d.ts +5 -5
- package/lib/backend/route-operation/put-operation.d.ts +5 -4
- package/lib/backend/schemas/index.d.ts +597 -598
- package/lib/backend/schemas/index.js +21 -21
- package/lib/backend/types.d.ts +8 -14
- package/package.json +1 -1
|
@@ -21,29 +21,34 @@ var schemas_exports = {};
|
|
|
21
21
|
__export(schemas_exports, {
|
|
22
22
|
basicFields: () => basicFields,
|
|
23
23
|
createTableSchema: () => createTableSchema,
|
|
24
|
-
integer: () => import_sqlite_core.integer,
|
|
25
24
|
listBodySchema: () => listBodySchema,
|
|
26
|
-
queryListSchema: () => queryListSchema
|
|
27
|
-
text: () => import_sqlite_core.text
|
|
25
|
+
queryListSchema: () => queryListSchema
|
|
28
26
|
});
|
|
29
27
|
module.exports = __toCommonJS(schemas_exports);
|
|
30
28
|
var import_zod = require("zod");
|
|
31
|
-
var
|
|
29
|
+
var import_pg_core = require("drizzle-orm/pg-core");
|
|
32
30
|
var import_drizzle_zod = require("drizzle-zod");
|
|
33
|
-
var
|
|
31
|
+
var timestamptz = (name) => (0, import_pg_core.timestamp)(name, { withTimezone: true });
|
|
32
|
+
var createdAt = () => timestamptz("created_at").notNull().defaultNow();
|
|
33
|
+
var updatedAt = () => timestamptz("updated_at").notNull().defaultNow();
|
|
34
|
+
var accessedAt = () => timestamptz("accessed_at").notNull().defaultNow();
|
|
34
35
|
var basicFields = {
|
|
35
|
-
id: (0,
|
|
36
|
-
creatorId: (0,
|
|
37
|
-
editorId: (0,
|
|
38
|
-
accessedAt:
|
|
39
|
-
createdAt:
|
|
40
|
-
updatedAt:
|
|
36
|
+
id: (0, import_pg_core.uuid)("id").defaultRandom().primaryKey(),
|
|
37
|
+
creatorId: (0, import_pg_core.uuid)("creator_id"),
|
|
38
|
+
editorId: (0, import_pg_core.uuid)("editor_id"),
|
|
39
|
+
accessedAt: accessedAt(),
|
|
40
|
+
createdAt: createdAt(),
|
|
41
|
+
updatedAt: updatedAt()
|
|
41
42
|
};
|
|
42
43
|
var queryListSchema = (schema) => import_zod.z.object({
|
|
43
44
|
current: import_zod.z.string().optional().default("1"),
|
|
45
|
+
// 默认页码为 1
|
|
44
46
|
pageSize: import_zod.z.string().optional().default("10"),
|
|
47
|
+
// 默认每页条数为 10
|
|
45
48
|
createdAtFrom: import_zod.z.string().optional(),
|
|
49
|
+
// 筛选开始日期
|
|
46
50
|
createdAtTo: import_zod.z.string().optional(),
|
|
51
|
+
// 筛选结束日期
|
|
47
52
|
orderBy: import_zod.z.string().optional(),
|
|
48
53
|
creatorId: import_zod.z.string().optional(),
|
|
49
54
|
orderDir: import_zod.z.enum(["asc", "desc"]).optional()
|
|
@@ -58,7 +63,7 @@ var createTableSchema = ({
|
|
|
58
63
|
refineSchema,
|
|
59
64
|
extraConfig
|
|
60
65
|
}) => {
|
|
61
|
-
const table = (0,
|
|
66
|
+
const table = (0, import_pg_core.pgTable)(
|
|
62
67
|
name,
|
|
63
68
|
{
|
|
64
69
|
...basicFields,
|
|
@@ -70,12 +75,9 @@ var createTableSchema = ({
|
|
|
70
75
|
table,
|
|
71
76
|
refineSchema
|
|
72
77
|
);
|
|
73
|
-
const insertTable = (0,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
);
|
|
77
|
-
const updateTable = (0, import_sqlite_core.sqliteTable)(name, {
|
|
78
|
-
id: (0, import_sqlite_core.text)("id"),
|
|
78
|
+
const insertTable = (0, import_pg_core.pgTable)(name, columns);
|
|
79
|
+
const updateTable = (0, import_pg_core.pgTable)(name, {
|
|
80
|
+
id: (0, import_pg_core.uuid)(),
|
|
79
81
|
...columns
|
|
80
82
|
});
|
|
81
83
|
return {
|
|
@@ -101,8 +103,6 @@ var createTableSchema = ({
|
|
|
101
103
|
0 && (module.exports = {
|
|
102
104
|
basicFields,
|
|
103
105
|
createTableSchema,
|
|
104
|
-
integer,
|
|
105
106
|
listBodySchema,
|
|
106
|
-
queryListSchema
|
|
107
|
-
text
|
|
107
|
+
queryListSchema
|
|
108
108
|
});
|
package/lib/backend/types.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PgColumn, PgTable } from "drizzle-orm/pg-core";
|
|
2
2
|
import { SQL } from "drizzle-orm";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
id: SQLiteColumn;
|
|
11
|
-
creatorId: SQLiteColumn;
|
|
12
|
-
editorId: SQLiteColumn;
|
|
13
|
-
accessedAt: SQLiteColumn;
|
|
14
|
-
createdAt: SQLiteColumn;
|
|
15
|
-
updatedAt: SQLiteColumn;
|
|
3
|
+
export interface BaseTable extends PgTable {
|
|
4
|
+
id: PgColumn;
|
|
5
|
+
creatorId: PgColumn;
|
|
6
|
+
editorId: PgColumn;
|
|
7
|
+
accessedAt: PgColumn;
|
|
8
|
+
createdAt: PgColumn;
|
|
9
|
+
updatedAt: PgColumn;
|
|
16
10
|
}
|
|
17
11
|
export type GetListRelations = {
|
|
18
12
|
groupBy?: boolean;
|