@mrxsys/mrx-core 2.11.1-1-and-275-20251023 → 2.12.0-1-and-289-20251215
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/CHANGELOG.md +0 -0
- package/dist/{chunk-0d0zd2yg.js → chunk-037vwvd4.js} +2 -2
- package/dist/{chunk-jksb9ers.js → chunk-10w8mg8e.js} +1 -1
- package/dist/{chunk-dre2fgj0.js → chunk-2z8amjqt.js} +1 -1
- package/dist/{chunk-afyz8rg5.js → chunk-47yta3gd.js} +34 -22
- package/dist/chunk-4t7sy5qt.js +10 -0
- package/dist/chunk-642xajvx.js +59 -0
- package/dist/chunk-6hs00zfd.js +13 -0
- package/dist/chunk-8pw0syzf.js +9 -0
- package/dist/{chunk-eeb7yskp.js → chunk-awphtyzp.js} +4 -4
- package/dist/{chunk-8tffnbpn.js → chunk-ayyrgqyv.js} +1 -1
- package/dist/{chunk-12qzn7jw.js → chunk-dmsev7vs.js} +1 -1
- package/dist/{chunk-afd82epa.js → chunk-hnds0krm.js} +13 -13
- package/dist/{chunk-gtn1kn0z.js → chunk-hv6g22kf.js} +4 -4
- package/dist/chunk-hwfebx4x.js +11 -0
- package/dist/chunk-j7dyc5ks.js +101 -0
- package/dist/chunk-jz3wd472.js +23 -0
- package/dist/{chunk-fs3wm3p4.js → chunk-r7yr9p57.js} +6 -6
- package/dist/chunk-txazb0xn.js +27 -0
- package/dist/chunk-y5dtkmnp.js +8 -0
- package/dist/chunk-yrt0ffvf.js +9 -0
- package/dist/chunk-zn2nm5gg.js +9 -0
- package/dist/{chunk-7t524zqh.js → chunk-zv4ta4fb.js} +3 -3
- package/dist/errors/{base-error.d.ts → app-error.d.ts} +2 -1
- package/dist/errors/http-error.d.ts +2 -2
- package/dist/errors/index.d.ts +2 -1
- package/dist/errors/index.js +6 -4
- package/dist/errors/internal-error.d.ts +4 -0
- package/dist/modules/data/data.d.ts +5 -5
- package/dist/modules/data/enums/data-error-keys.d.ts +1 -1
- package/dist/modules/data/enums/index.js +1 -1
- package/dist/modules/data/index.js +3 -3
- package/dist/modules/database/enums/database-error-keys.d.ts +26 -26
- package/dist/modules/database/enums/index.js +1 -1
- package/dist/modules/database/enums/mssql-error-code.d.ts +23 -23
- package/dist/modules/database/index.js +5 -5
- package/dist/modules/database/mssql.d.ts +9 -9
- package/dist/modules/elysia/cache/cache.d.ts +1 -1
- package/dist/modules/elysia/cache/index.js +3 -3
- package/dist/modules/elysia/db-resolver/enums/db-resolver-error-keys.d.ts +1 -1
- package/dist/modules/elysia/db-resolver/enums/index.js +1 -1
- package/dist/modules/elysia/db-resolver/index.js +53 -10
- package/dist/modules/elysia/error/enums/error.keys.d.ts +4 -4
- package/dist/modules/elysia/error/enums/index.js +1 -1
- package/dist/modules/elysia/error/error.d.ts +5 -5
- package/dist/modules/elysia/error/index.js +14 -14
- package/dist/modules/elysia/microservice/enums/index.js +1 -1
- package/dist/modules/elysia/microservice/enums/microservice-success-keys.d.ts +2 -2
- package/dist/modules/elysia/microservice/index.js +1 -1
- package/dist/modules/elysia/rate-limit/enums/index.js +1 -1
- package/dist/modules/elysia/rate-limit/enums/rate-limit-error-keys.d.ts +1 -1
- package/dist/modules/elysia/rate-limit/index.js +7 -6
- package/dist/modules/elysia/rate-limit/rate-limit.d.ts +1 -1
- package/dist/modules/jwt/enums/index.js +2 -2
- package/dist/modules/jwt/enums/jwt-error-keys.d.ts +3 -3
- package/dist/modules/jwt/enums/parse-human-time-to-seconds-error-keys.d.ts +1 -1
- package/dist/modules/jwt/index.js +10 -12
- package/dist/modules/jwt/utils/index.js +3 -3
- package/dist/modules/jwt/utils/parse-human-time-to-seconds.d.ts +1 -1
- package/dist/modules/kv-store/bun-redis/index.js +25 -17
- package/dist/modules/kv-store/enums/index.js +1 -1
- package/dist/modules/kv-store/enums/kv-store-error-keys.d.ts +3 -3
- package/dist/modules/kv-store/ioredis/index.js +17 -17
- package/dist/modules/kv-store/memory/index.js +4 -98
- package/dist/modules/logger/enums/index.js +1 -1
- package/dist/modules/logger/enums/logger-error-keys.d.ts +7 -7
- package/dist/modules/logger/events/logger-events.d.ts +4 -4
- package/dist/modules/logger/index.js +91 -20
- package/dist/modules/logger/logger.d.ts +2 -2
- package/dist/modules/logger/sinks/console-logger.d.ts +1 -1
- package/dist/modules/logger/sinks/file-logger/enums/file-logger-error-keys.d.ts +1 -1
- package/dist/modules/logger/sinks/file-logger/file-logger.d.ts +3 -3
- package/dist/modules/logger/sinks/index.js +10 -11
- package/dist/modules/logger/types/logger-options.d.ts +1 -1
- package/dist/modules/logger/types/logger-sink.d.ts +1 -1
- package/dist/modules/logger/worker-logger.d.ts +1 -0
- package/dist/modules/mailer/enums/index.js +1 -1
- package/dist/modules/mailer/enums/mailer-error-keys.d.ts +3 -3
- package/dist/modules/mailer/index.js +6 -6
- package/dist/modules/mailer/smtp.d.ts +4 -4
- package/dist/modules/repository/index.js +4 -4
- package/dist/modules/repository/repository.d.ts +29 -13
- package/dist/modules/repository/types/filter.d.ts +2 -5
- package/dist/modules/repository/types/global-search.d.ts +12 -0
- package/dist/modules/repository/types/index.d.ts +2 -1
- package/dist/modules/repository/types/{order-by-item.d.ts → order-by.d.ts} +3 -3
- package/dist/modules/repository/types/query-options.d.ts +4 -5
- package/dist/modules/schema-builder/build-adaptive-where-clause-schema.d.ts +17 -0
- package/dist/modules/schema-builder/build-count-schema.d.ts +12 -0
- package/dist/modules/{elysia/crud/utils/create-delete-schema.d.ts → schema-builder/build-delete-schema.d.ts} +3 -3
- package/dist/modules/schema-builder/build-filters-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-find-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-global-search-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-insert-schema.d.ts +3 -0
- package/dist/modules/schema-builder/build-order-by-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-selected-fields.d.ts +12 -0
- package/dist/modules/schema-builder/build-update-one-schema.d.ts +12 -0
- package/dist/modules/schema-builder/build-update-schema.d.ts +12 -0
- package/dist/modules/schema-builder/clean-schema.d.ts +2 -0
- package/dist/modules/schema-builder/index.d.ts +12 -0
- package/dist/modules/schema-builder/index.js +232 -0
- package/dist/modules/schema-builder/types/adaptive-where-clause-schema.d.ts +34 -0
- package/dist/modules/{elysia/crud → schema-builder}/types/count-schema.d.ts +3 -3
- package/dist/modules/schema-builder/types/delete-schema.d.ts +12 -0
- package/dist/modules/schema-builder/types/filter-schema.d.ts +12 -0
- package/dist/modules/schema-builder/types/find-schema.d.ts +16 -0
- package/dist/modules/{elysia/crud/types/q-schema.d.ts → schema-builder/types/global-search-schema.d.ts} +1 -1
- package/dist/modules/schema-builder/types/index.d.ts +12 -0
- package/dist/modules/{elysia/crud → schema-builder}/types/insert-schema.d.ts +1 -1
- package/dist/modules/schema-builder/types/order-by-schema.d.ts +5 -0
- package/dist/modules/{elysia/crud → schema-builder}/types/update-schema.d.ts +4 -4
- package/dist/{shared → modules/schema-builder}/utils/flatten.d.ts +1 -1
- package/dist/modules/schema-builder/utils/index.d.ts +2 -0
- package/dist/modules/schema-builder/utils/index.js +9 -0
- package/dist/modules/singleton-manager/enums/index.js +1 -1
- package/dist/modules/singleton-manager/enums/singleton-manager-error-keys.d.ts +2 -2
- package/dist/modules/singleton-manager/index.js +3 -3
- package/dist/modules/singleton-manager/singleton-manager.d.ts +3 -3
- package/dist/modules/totp/enums/index.js +1 -1
- package/dist/modules/totp/enums/totp-error-keys.d.ts +5 -5
- package/dist/modules/totp/index.js +6 -6
- package/dist/modules/totp/otp-auth-uri.d.ts +1 -1
- package/dist/modules/totp/utils/base32.d.ts +1 -1
- package/dist/modules/totp/utils/generate-secret-bytes.d.ts +1 -1
- package/dist/modules/totp/utils/index.js +5 -5
- package/dist/shared/types/index.d.ts +0 -1
- package/dist/shared/utils/env.d.ts +1 -1
- package/dist/shared/utils/index.d.ts +0 -1
- package/dist/shared/utils/index.js +4 -8
- package/package.json +19 -22
- package/dist/chunk-441xs5k1.js +0 -53
- package/dist/chunk-4v86f7gp.js +0 -59
- package/dist/chunk-6w9ja96e.js +0 -9
- package/dist/chunk-9cgzhc50.js +0 -15
- package/dist/chunk-9d3zvgp6.js +0 -9
- package/dist/chunk-9dzsj7f2.js +0 -23
- package/dist/chunk-9r5anep5.js +0 -11
- package/dist/chunk-p14h6jfs.js +0 -365
- package/dist/chunk-pjv1ekwr.js +0 -284
- package/dist/chunk-rz5p4j3p.js +0 -13
- package/dist/chunk-spnh9dzk.js +0 -10
- package/dist/chunk-w7h898m3.js +0 -14
- package/dist/chunk-xhhj1gvj.js +0 -9
- package/dist/chunk-z0ct35ft.js +0 -8
- package/dist/errors/utils/index.d.ts +0 -1
- package/dist/errors/utils/index.js +0 -16
- package/dist/errors/utils/is-nowarajs-error.ts.d.ts +0 -4
- package/dist/modules/elysia/crud/crud-schema.d.ts +0 -18
- package/dist/modules/elysia/crud/crud.d.ts +0 -38
- package/dist/modules/elysia/crud/enums/crud-success-keys.d.ts +0 -10
- package/dist/modules/elysia/crud/enums/index.d.ts +0 -1
- package/dist/modules/elysia/crud/enums/index.js +0 -7
- package/dist/modules/elysia/crud/index.d.ts +0 -2
- package/dist/modules/elysia/crud/index.js +0 -153
- package/dist/modules/elysia/crud/operations/count.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/delete.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/deleteOne.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/find.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/findOne.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/index.d.ts +0 -8
- package/dist/modules/elysia/crud/operations/index.js +0 -34
- package/dist/modules/elysia/crud/operations/insert.d.ts +0 -258
- package/dist/modules/elysia/crud/operations/update.d.ts +0 -268
- package/dist/modules/elysia/crud/operations/updateOne.d.ts +0 -268
- package/dist/modules/elysia/crud/operations/utils/get-db-injection.d.ts +0 -8
- package/dist/modules/elysia/crud/types/adaptive-where-clause-schema.d.ts +0 -31
- package/dist/modules/elysia/crud/types/count-response-200-schema.d.ts +0 -5
- package/dist/modules/elysia/crud/types/crud-operation-base.d.ts +0 -4
- package/dist/modules/elysia/crud/types/crud-operation-count.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-delete-one.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-delete.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-find-one.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-find.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-insert.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operation-update-one.d.ts +0 -16
- package/dist/modules/elysia/crud/types/crud-operation-update.d.ts +0 -14
- package/dist/modules/elysia/crud/types/crud-operations.d.ts +0 -19
- package/dist/modules/elysia/crud/types/crud-options.d.ts +0 -44
- package/dist/modules/elysia/crud/types/crud-schema-models-type.d.ts +0 -12
- package/dist/modules/elysia/crud/types/crud-schema-operations.d.ts +0 -10
- package/dist/modules/elysia/crud/types/crud-schema-options.d.ts +0 -13
- package/dist/modules/elysia/crud/types/delete-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/types/filter-schema.d.ts +0 -9
- package/dist/modules/elysia/crud/types/find-schema.d.ts +0 -16
- package/dist/modules/elysia/crud/types/id-param-schema.d.ts +0 -4
- package/dist/modules/elysia/crud/types/index.d.ts +0 -29
- package/dist/modules/elysia/crud/types/order-schema.d.ts +0 -11
- package/dist/modules/elysia/crud/types/properties-schema.d.ts +0 -9
- package/dist/modules/elysia/crud/types/response-200-schema.d.ts +0 -11
- package/dist/modules/elysia/crud/utils/create-adaptive-where-clause-schema.d.ts +0 -17
- package/dist/modules/elysia/crud/utils/create-count-response-200-schema.d.ts +0 -8
- package/dist/modules/elysia/crud/utils/create-count-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-filters-schema.d.ts +0 -14
- package/dist/modules/elysia/crud/utils/create-find-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-id-param-schema.d.ts +0 -2
- package/dist/modules/elysia/crud/utils/create-insert-schema.d.ts +0 -8
- package/dist/modules/elysia/crud/utils/create-order-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-properties-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-q-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-response-200-schema.d.ts +0 -3
- package/dist/modules/elysia/crud/utils/create-selected-fields-schema.d.ts +0 -12
- package/dist/modules/elysia/crud/utils/create-update-one-schema.d.ts +0 -3
- package/dist/modules/elysia/crud/utils/create-update-schema.d.ts +0 -3
- package/dist/modules/elysia/crud/utils/index.d.ts +0 -16
- package/dist/modules/elysia/crud/utils/index.js +0 -41
- /package/dist/modules/{elysia/crud → schema-builder}/types/index.js +0 -0
- /package/dist/modules/{elysia/crud/types/selected-field-schema.d.ts → schema-builder/types/selected-fields-schema.d.ts} +0 -0
- /package/dist/{shared → modules/schema-builder}/types/tflatten.d.ts +0 -0
- /package/dist/modules/{elysia/crud → schema-builder}/types/update-one-schema.d.ts +0 -0
- /package/dist/modules/{elysia/crud → schema-builder}/utils/is-date-from-elysia-typebox.d.ts +0 -0
package/dist/chunk-pjv1ekwr.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
dbResolver
|
|
4
|
-
} from "./chunk-441xs5k1.js";
|
|
5
|
-
import {
|
|
6
|
-
CRUD_SUCCESS_KEYS
|
|
7
|
-
} from "./chunk-w7h898m3.js";
|
|
8
|
-
|
|
9
|
-
// source/modules/elysia/crud/operations/count.ts
|
|
10
|
-
import { Elysia } from "elysia";
|
|
11
|
-
|
|
12
|
-
// source/modules/elysia/crud/operations/utils/get-db-injection.ts
|
|
13
|
-
var getDbInjection = (database) => typeof database === "string" ? {
|
|
14
|
-
injectStaticDB: database
|
|
15
|
-
} : {
|
|
16
|
-
injectDynamicDB: database
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// source/modules/elysia/crud/operations/count.ts
|
|
20
|
-
var count = (database, tableName, {
|
|
21
|
-
hook,
|
|
22
|
-
method = "POST",
|
|
23
|
-
path = "/count"
|
|
24
|
-
}) => new Elysia({
|
|
25
|
-
name: `count[${tableName}]`
|
|
26
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
27
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
28
|
-
const body = ctx.body;
|
|
29
|
-
const data = await db.getRepository(tableName).count({
|
|
30
|
-
...body.queryOptions,
|
|
31
|
-
throwIfNoResult: true
|
|
32
|
-
});
|
|
33
|
-
return {
|
|
34
|
-
message: CRUD_SUCCESS_KEYS.COUNT_RESPONSE,
|
|
35
|
-
content: data
|
|
36
|
-
};
|
|
37
|
-
}, {
|
|
38
|
-
detail: {
|
|
39
|
-
summary: "Count",
|
|
40
|
-
description: `Count ${tableName} records based on query options.`
|
|
41
|
-
},
|
|
42
|
-
...getDbInjection(database),
|
|
43
|
-
body: `${tableName}Count`,
|
|
44
|
-
response: `${tableName}CountResponse200`,
|
|
45
|
-
...hook
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// source/modules/elysia/crud/operations/delete.ts
|
|
49
|
-
import { Elysia as Elysia2 } from "elysia";
|
|
50
|
-
var batchDelete = (database, tableName, {
|
|
51
|
-
hook,
|
|
52
|
-
method = "DELETE",
|
|
53
|
-
path = "/"
|
|
54
|
-
}) => new Elysia2({
|
|
55
|
-
name: `delete[${tableName}]`
|
|
56
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
57
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
58
|
-
const body = ctx.body;
|
|
59
|
-
const selectedFields = body.queryOptions?.selectedFields ?? "*";
|
|
60
|
-
const data = await db.getRepository(tableName).delete({
|
|
61
|
-
filters: body.queryOptions.filters,
|
|
62
|
-
selectedFields,
|
|
63
|
-
throwIfNoResult: true
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
message: CRUD_SUCCESS_KEYS.DELETE_RESPONSE,
|
|
67
|
-
content: data
|
|
68
|
-
};
|
|
69
|
-
}, {
|
|
70
|
-
detail: {
|
|
71
|
-
summary: "Delete",
|
|
72
|
-
description: `Delete ${tableName} records based on query options.`
|
|
73
|
-
},
|
|
74
|
-
...getDbInjection(database),
|
|
75
|
-
body: `${tableName}Delete`,
|
|
76
|
-
response: `${tableName}Response200`,
|
|
77
|
-
...hook
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// source/modules/elysia/crud/operations/deleteOne.ts
|
|
81
|
-
import { Elysia as Elysia3 } from "elysia";
|
|
82
|
-
var deleteOne = (database, tableName, {
|
|
83
|
-
hook,
|
|
84
|
-
method = "DELETE",
|
|
85
|
-
path = "/:id"
|
|
86
|
-
}) => new Elysia3({
|
|
87
|
-
name: `deleteOne[${tableName}]`
|
|
88
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
89
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
90
|
-
const { id } = ctx.params;
|
|
91
|
-
const [primaryKey] = db.getTable(tableName).primaryKey;
|
|
92
|
-
const data = await db.getRepository(tableName).delete({
|
|
93
|
-
selectedFields: "*",
|
|
94
|
-
filters: {
|
|
95
|
-
[primaryKey]: id
|
|
96
|
-
},
|
|
97
|
-
throwIfNoResult: {
|
|
98
|
-
httpStatusCode: "NOT_FOUND",
|
|
99
|
-
message: `Record with id ${id} not found in ${tableName}`
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
message: CRUD_SUCCESS_KEYS.DELETE_ONE_RESPONSE,
|
|
104
|
-
content: data
|
|
105
|
-
};
|
|
106
|
-
}, {
|
|
107
|
-
detail: {
|
|
108
|
-
summary: "Delete One",
|
|
109
|
-
description: `Delete a single ${tableName} record by its primary key.`
|
|
110
|
-
},
|
|
111
|
-
...getDbInjection(database),
|
|
112
|
-
params: `${tableName}IdParam`,
|
|
113
|
-
response: `${tableName}Response200`,
|
|
114
|
-
...hook
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// source/modules/elysia/crud/operations/find.ts
|
|
118
|
-
import { Elysia as Elysia4 } from "elysia";
|
|
119
|
-
var find = (database, tableName, {
|
|
120
|
-
hook,
|
|
121
|
-
method = "POST",
|
|
122
|
-
path = "/find"
|
|
123
|
-
}) => new Elysia4({
|
|
124
|
-
name: `find[${tableName}]`
|
|
125
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
126
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
127
|
-
const body = ctx.body;
|
|
128
|
-
const data = await db.getRepository(tableName).find({
|
|
129
|
-
...body?.queryOptions || {},
|
|
130
|
-
throwIfNoResult: false
|
|
131
|
-
});
|
|
132
|
-
return {
|
|
133
|
-
message: CRUD_SUCCESS_KEYS.FIND_RESPONSE,
|
|
134
|
-
content: data
|
|
135
|
-
};
|
|
136
|
-
}, {
|
|
137
|
-
detail: {
|
|
138
|
-
summary: "Find",
|
|
139
|
-
description: `Find ${tableName} records based on query options.`
|
|
140
|
-
},
|
|
141
|
-
...getDbInjection(database),
|
|
142
|
-
body: `${tableName}Find`,
|
|
143
|
-
response: `${tableName}Response200`,
|
|
144
|
-
...hook
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// source/modules/elysia/crud/operations/findOne.ts
|
|
148
|
-
import { Elysia as Elysia5 } from "elysia";
|
|
149
|
-
var findOne = (database, tableName, {
|
|
150
|
-
hook,
|
|
151
|
-
method = "GET",
|
|
152
|
-
path = "/:id"
|
|
153
|
-
}) => new Elysia5({
|
|
154
|
-
name: `findOne[${tableName}]`
|
|
155
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
156
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
157
|
-
const { id } = ctx.params;
|
|
158
|
-
const [primaryKey] = db.getTable(tableName).primaryKey;
|
|
159
|
-
const data = await db.getRepository(tableName).find({
|
|
160
|
-
filters: {
|
|
161
|
-
[primaryKey]: id
|
|
162
|
-
},
|
|
163
|
-
throwIfNoResult: {
|
|
164
|
-
httpStatusCode: "NOT_FOUND",
|
|
165
|
-
message: `Record with id ${id} not found in ${tableName}`
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
return {
|
|
169
|
-
message: CRUD_SUCCESS_KEYS.FIND_ONE_RESPONSE,
|
|
170
|
-
content: data
|
|
171
|
-
};
|
|
172
|
-
}, {
|
|
173
|
-
detail: {
|
|
174
|
-
summary: "Find One",
|
|
175
|
-
description: `Find a single ${tableName} record by its primary key.`
|
|
176
|
-
},
|
|
177
|
-
...getDbInjection(database),
|
|
178
|
-
params: `${tableName}IdParam`,
|
|
179
|
-
response: `${tableName}Response200`,
|
|
180
|
-
...hook
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// source/modules/elysia/crud/operations/insert.ts
|
|
184
|
-
import { Elysia as Elysia6 } from "elysia";
|
|
185
|
-
var insert = (database, tableName, {
|
|
186
|
-
hook,
|
|
187
|
-
method = "POST",
|
|
188
|
-
path = "/"
|
|
189
|
-
}) => new Elysia6({
|
|
190
|
-
name: `insert[${tableName}]`
|
|
191
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
192
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
193
|
-
const body = ctx.body;
|
|
194
|
-
const selectedFields = body.queryOptions?.selectedFields ?? "*";
|
|
195
|
-
const data = await db.getRepository(tableName).insert(body.data, {
|
|
196
|
-
selectedFields,
|
|
197
|
-
throwIfNoResult: true
|
|
198
|
-
});
|
|
199
|
-
return {
|
|
200
|
-
message: CRUD_SUCCESS_KEYS.INSERT_RESPONSE,
|
|
201
|
-
content: data
|
|
202
|
-
};
|
|
203
|
-
}, {
|
|
204
|
-
detail: {
|
|
205
|
-
summary: "Insert",
|
|
206
|
-
description: `Insert one or more records into the ${tableName} table.`
|
|
207
|
-
},
|
|
208
|
-
...getDbInjection(database),
|
|
209
|
-
body: `${tableName}Insert`,
|
|
210
|
-
response: `${tableName}Response200`,
|
|
211
|
-
...hook
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
// source/modules/elysia/crud/operations/update.ts
|
|
215
|
-
import { Elysia as Elysia7 } from "elysia";
|
|
216
|
-
var update = (database, tableName, {
|
|
217
|
-
hook,
|
|
218
|
-
method = "PATCH",
|
|
219
|
-
path = "/"
|
|
220
|
-
}) => new Elysia7({
|
|
221
|
-
name: `update[${tableName}]`
|
|
222
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
223
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
224
|
-
const body = ctx.body;
|
|
225
|
-
const data = await db.getRepository(tableName).update(body.data, {
|
|
226
|
-
filters: body.queryOptions.filters,
|
|
227
|
-
selectedFields: body.queryOptions.selectedFields ?? "*",
|
|
228
|
-
throwIfNoResult: true
|
|
229
|
-
});
|
|
230
|
-
return {
|
|
231
|
-
message: CRUD_SUCCESS_KEYS.UPDATE_RESPONSE,
|
|
232
|
-
content: data
|
|
233
|
-
};
|
|
234
|
-
}, {
|
|
235
|
-
detail: {
|
|
236
|
-
summary: "Update",
|
|
237
|
-
description: `Update one or more ${tableName} records based on query options.`
|
|
238
|
-
},
|
|
239
|
-
...getDbInjection(database),
|
|
240
|
-
body: `${tableName}Update`,
|
|
241
|
-
response: `${tableName}Response200`,
|
|
242
|
-
...hook
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
// source/modules/elysia/crud/operations/updateOne.ts
|
|
246
|
-
import { Elysia as Elysia8 } from "elysia";
|
|
247
|
-
var updateOne = (database, tableName, {
|
|
248
|
-
hook,
|
|
249
|
-
method = "PATCH",
|
|
250
|
-
path = "/:id"
|
|
251
|
-
}) => new Elysia8({
|
|
252
|
-
name: `updateOne[${tableName}]`
|
|
253
|
-
}).use(dbResolver("database:")).route(method, path, async (ctx) => {
|
|
254
|
-
const db = ctx.dynamicDB || ctx.staticDB;
|
|
255
|
-
const { id } = ctx.params;
|
|
256
|
-
const body = ctx.body;
|
|
257
|
-
const [primaryKey] = db.getTable(tableName).primaryKey;
|
|
258
|
-
const data = await db.getRepository(tableName).update(body.data, {
|
|
259
|
-
selectedFields: "*",
|
|
260
|
-
filters: {
|
|
261
|
-
[primaryKey]: id
|
|
262
|
-
},
|
|
263
|
-
throwIfNoResult: {
|
|
264
|
-
httpStatusCode: "NOT_FOUND",
|
|
265
|
-
message: `Record with id ${id} not found in ${tableName}`
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
return {
|
|
269
|
-
message: CRUD_SUCCESS_KEYS.UPDATE_ONE_RESPONSE,
|
|
270
|
-
content: data
|
|
271
|
-
};
|
|
272
|
-
}, {
|
|
273
|
-
detail: {
|
|
274
|
-
summary: "Update Single Record",
|
|
275
|
-
description: `Update a single record in the ${tableName} table by its primary key.`
|
|
276
|
-
},
|
|
277
|
-
...getDbInjection(database),
|
|
278
|
-
params: `${tableName}IdParam`,
|
|
279
|
-
body: `${tableName}UpdateOne`,
|
|
280
|
-
response: `${tableName}Response200`,
|
|
281
|
-
...hook
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
export { count, batchDelete, deleteOne, find, findOne, insert, update, updateOne };
|
package/dist/chunk-rz5p4j3p.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/logger/enums/logger-error-keys.ts
|
|
3
|
-
var LOGGER_ERROR_KEYS = {
|
|
4
|
-
BEFORE_EXIT_CLOSE_ERROR: "mrx-core.logger.error.before_exit_close_error",
|
|
5
|
-
BEFORE_EXIT_FLUSH_ERROR: "mrx-core.logger.error.before_exit_flush_error",
|
|
6
|
-
NO_SINKS_PROVIDED: "mrx-core.logger.error.no_sinks_provided",
|
|
7
|
-
REGISTER_SINK_ERROR: "mrx-core.logger.error.register_sink_error",
|
|
8
|
-
SINK_ALREADY_ADDED: "mrx-core.logger.error.sink_already_added",
|
|
9
|
-
SINK_CLOSE_ERROR: "mrx-core.logger.error.sink_close_error",
|
|
10
|
-
SINK_LOG_ERROR: "mrx-core.logger.error.sink_log_error"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { LOGGER_ERROR_KEYS };
|
package/dist/chunk-spnh9dzk.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/elysia/error/enums/error.keys.ts
|
|
3
|
-
var ERROR_KEYS = {
|
|
4
|
-
CORE_ERROR_VALIDATION: "mrx-core.error.validation",
|
|
5
|
-
CORE_ERROR_NOT_FOUND: "mrx-core.error.not_found",
|
|
6
|
-
CORE_ERROR_PARSE: "mrx-core.error.parse",
|
|
7
|
-
CORE_ERROR_INTERNAL_SERVER_ERROR: "mrx-core.error.internal_server_error"
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { ERROR_KEYS };
|
package/dist/chunk-w7h898m3.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/elysia/crud/enums/crud-success-keys.ts
|
|
3
|
-
var CRUD_SUCCESS_KEYS = {
|
|
4
|
-
COUNT_RESPONSE: "mrx-core.crud.success.count_response",
|
|
5
|
-
DELETE_RESPONSE: "mrx-core.crud.success.delete_response",
|
|
6
|
-
DELETE_ONE_RESPONSE: "mrx-core.crud.success.delete_one_response",
|
|
7
|
-
FIND_RESPONSE: "mrx-core.crud.success.find_response",
|
|
8
|
-
FIND_ONE_RESPONSE: "mrx-core.crud.success.find_one_response",
|
|
9
|
-
INSERT_RESPONSE: "mrx-core.crud.success.insert_response",
|
|
10
|
-
UPDATE_RESPONSE: "mrx-core.crud.success.update_response",
|
|
11
|
-
UPDATE_ONE_RESPONSE: "mrx-core.crud.success.update_one_response"
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { CRUD_SUCCESS_KEYS };
|
package/dist/chunk-xhhj1gvj.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/kv-store/enums/kv-store-error-keys.ts
|
|
3
|
-
var KV_STORE_ERROR_KEYS = {
|
|
4
|
-
CLOSING_CONNECTION_FAILED: "mrx-core.kv-store.error.closing_connection_failed",
|
|
5
|
-
CONNECTION_FAILED: "mrx-core.kv-store.error.connection_failed",
|
|
6
|
-
NOT_INTEGER: "mrx-core.kv-store.error.not_integer"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { KV_STORE_ERROR_KEYS };
|
package/dist/chunk-z0ct35ft.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// source/modules/singleton-manager/enums/singleton-manager-error-keys.ts
|
|
3
|
-
var SINGLETON_MANAGER_ERROR_KEYS = {
|
|
4
|
-
CLASS_INSTANCE_ALREADY_REGISTERED: "mrx-core.singleton-manager.error.class_instance_already_registered",
|
|
5
|
-
CLASS_INSTANCE_NOT_REGISTERED: "mrx-core.singleton-manager.error.class_instance_not_registered"
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export { SINGLETON_MANAGER_ERROR_KEYS };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { isBaseError, isHttpError } from './is-nowarajs-error.ts';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
HttpError
|
|
4
|
-
} from "../../chunk-7t524zqh.js";
|
|
5
|
-
import"../../chunk-sqts8vyk.js";
|
|
6
|
-
import {
|
|
7
|
-
BaseError
|
|
8
|
-
} from "../../chunk-9cgzhc50.js";
|
|
9
|
-
|
|
10
|
-
// source/errors/utils/is-nowarajs-error.ts.ts
|
|
11
|
-
var isBaseError = (e) => e instanceof BaseError;
|
|
12
|
-
var isHttpError = (e) => e instanceof HttpError;
|
|
13
|
-
export {
|
|
14
|
-
isHttpError,
|
|
15
|
-
isBaseError
|
|
16
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { TObject } from '@sinclair/typebox/type';
|
|
2
|
-
import { Elysia, type SingletonBase } from 'elysia';
|
|
3
|
-
import type { CrudSchemaModelsType } from './types/crud-schema-models-type';
|
|
4
|
-
import type { CrudSchemaOperations } from './types/crud-schema-operations';
|
|
5
|
-
import type { CrudSchemaOptions } from './types/crud-schema-options';
|
|
6
|
-
export declare const crudSchema: <const TSourceSchemaName extends string, const TSourceSchema extends TObject, const TSourceInsertSchema extends TObject = TSourceSchema, const TSourceFindSchema extends TObject = TSourceSchema, const TSourceCountSchema extends TObject = TSourceSchema, const TSourceUpdateSchema extends TObject = TSourceSchema, const TSourceDeleteSchema extends TObject = TSourceSchema, const TSourceResponseSchema extends TObject = TSourceSchema, const TOperations extends CrudSchemaOperations = {
|
|
7
|
-
count: true;
|
|
8
|
-
find: true;
|
|
9
|
-
findOne: true;
|
|
10
|
-
insert: true;
|
|
11
|
-
update: true;
|
|
12
|
-
updateOne: true;
|
|
13
|
-
delete: true;
|
|
14
|
-
deleteOne: true;
|
|
15
|
-
}>({ sourceSchemaName, sourceSchema, sourceInsertSchema, sourceFindSchema, sourceCountSchema, sourceUpdateSchema, sourceDeleteSchema, sourceResponseSchema, operations }: CrudSchemaOptions<TSourceSchemaName, TSourceSchema, TSourceInsertSchema, TSourceFindSchema, TSourceCountSchema, TSourceUpdateSchema, TSourceDeleteSchema, TSourceResponseSchema, TOperations>) => Elysia<TSourceSchemaName, SingletonBase, {
|
|
16
|
-
typebox: CrudSchemaModelsType<TSourceSchemaName, TOperations, TSourceInsertSchema, TSourceFindSchema, TSourceCountSchema, TSourceUpdateSchema, TSourceDeleteSchema, TSourceResponseSchema>;
|
|
17
|
-
error: {};
|
|
18
|
-
}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { TObject, TString } from '@sinclair/typebox';
|
|
2
|
-
import { Elysia, type SingletonBase } from 'elysia';
|
|
3
|
-
import type { MSSQLDatabaseOptions } from '../../../modules/database/types/mssql-database-option';
|
|
4
|
-
import type { CrudSchemaModelsType } from '../../../modules/elysia/crud/types/crud-schema-models-type';
|
|
5
|
-
import type { CrudOperationCount } from './types/crud-operation-count';
|
|
6
|
-
import type { CrudOperationDelete } from './types/crud-operation-delete';
|
|
7
|
-
import type { CrudOperationDeleteOne } from './types/crud-operation-delete-one';
|
|
8
|
-
import type { CrudOperationFind } from './types/crud-operation-find';
|
|
9
|
-
import type { CrudOperationFindOne } from './types/crud-operation-find-one';
|
|
10
|
-
import type { CrudOperationInsert } from './types/crud-operation-insert';
|
|
11
|
-
import type { CrudOperationUpdate } from './types/crud-operation-update';
|
|
12
|
-
import type { CrudOperationUpdateOne } from './types/crud-operation-update-one';
|
|
13
|
-
import type { CrudOperations } from './types/crud-operations';
|
|
14
|
-
import type { CrudOptions } from './types/crud-options';
|
|
15
|
-
export declare const crud: <const TDatabase extends Omit<MSSQLDatabaseOptions, "databaseName"> | string, const TTableName extends string, const TSourceSchema extends TObject, const TSourceFindSchema extends TObject = TSourceSchema, const TSourceCountSchema extends TObject = TSourceSchema, const TSourceInsertSchema extends TObject = TSourceSchema, const TSourceUpdateSchema extends TObject = TSourceSchema, const TSourceDeleteSchema extends TObject = TSourceSchema, const TSourceResponseSchema extends TObject = TSourceSchema, const THeaderSchema extends TObject = (TDatabase extends string ? TObject<{}> : TObject<{
|
|
16
|
-
"database-using": TString;
|
|
17
|
-
}>), const TOperations extends CrudOperations<THeaderSchema, TSourceSchema, TSourceFindSchema, TSourceCountSchema, TSourceInsertSchema, TSourceUpdateSchema, TSourceDeleteSchema, TSourceResponseSchema> = {
|
|
18
|
-
find: CrudOperationFind<THeaderSchema, TSourceFindSchema, TSourceResponseSchema> | true;
|
|
19
|
-
findOne: CrudOperationFindOne<THeaderSchema, TSourceResponseSchema> | true;
|
|
20
|
-
insert: CrudOperationInsert<THeaderSchema, TSourceInsertSchema, TSourceResponseSchema> | true;
|
|
21
|
-
update: CrudOperationUpdate<THeaderSchema, TSourceUpdateSchema, TSourceResponseSchema> | true;
|
|
22
|
-
updateOne: CrudOperationUpdateOne<THeaderSchema, TSourceUpdateSchema, TSourceResponseSchema> | true;
|
|
23
|
-
delete: CrudOperationDelete<THeaderSchema, TSourceDeleteSchema, TSourceResponseSchema> | true;
|
|
24
|
-
deleteOne: CrudOperationDeleteOne<THeaderSchema, TSourceResponseSchema> | true;
|
|
25
|
-
count: CrudOperationCount<THeaderSchema, TSourceCountSchema> | true;
|
|
26
|
-
}>({ database, tableName, schema, operations, tags, prefix }: CrudOptions<TDatabase, TTableName, TSourceSchema, TSourceFindSchema, TSourceCountSchema, TSourceInsertSchema, TSourceUpdateSchema, TSourceDeleteSchema, TSourceResponseSchema, THeaderSchema, TOperations>) => Elysia<TTableName, SingletonBase, {
|
|
27
|
-
typebox: CrudSchemaModelsType<TTableName, {
|
|
28
|
-
find: TOperations["find"] extends true | CrudOperationFind<THeaderSchema, TSourceFindSchema, TSourceResponseSchema> ? true : false;
|
|
29
|
-
findOne: TOperations["findOne"] extends true | CrudOperationFindOne<THeaderSchema, TSourceResponseSchema> ? true : false;
|
|
30
|
-
insert: TOperations["insert"] extends true | CrudOperationInsert<THeaderSchema, TSourceInsertSchema, TSourceResponseSchema> ? true : false;
|
|
31
|
-
update: TOperations["update"] extends true | CrudOperationUpdate<THeaderSchema, TSourceUpdateSchema, TSourceResponseSchema> ? true : false;
|
|
32
|
-
updateOne: TOperations["updateOne"] extends true | CrudOperationUpdateOne<THeaderSchema, TSourceUpdateSchema, TSourceResponseSchema> ? true : false;
|
|
33
|
-
delete: TOperations["delete"] extends true | CrudOperationDelete<THeaderSchema, TSourceDeleteSchema, TSourceResponseSchema> ? true : false;
|
|
34
|
-
deleteOne: TOperations["deleteOne"] extends true | CrudOperationDeleteOne<THeaderSchema, TSourceResponseSchema> ? true : false;
|
|
35
|
-
count: TOperations["count"] extends true | CrudOperationCount<THeaderSchema, TSourceCountSchema> ? true : false;
|
|
36
|
-
}, TSourceInsertSchema, TSourceFindSchema, TSourceCountSchema, TSourceUpdateSchema, TSourceDeleteSchema, TSourceResponseSchema>;
|
|
37
|
-
error: {};
|
|
38
|
-
}>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const CRUD_SUCCESS_KEYS: {
|
|
2
|
-
readonly COUNT_RESPONSE: "mrx-core.crud.success.count_response";
|
|
3
|
-
readonly DELETE_RESPONSE: "mrx-core.crud.success.delete_response";
|
|
4
|
-
readonly DELETE_ONE_RESPONSE: "mrx-core.crud.success.delete_one_response";
|
|
5
|
-
readonly FIND_RESPONSE: "mrx-core.crud.success.find_response";
|
|
6
|
-
readonly FIND_ONE_RESPONSE: "mrx-core.crud.success.find_one_response";
|
|
7
|
-
readonly INSERT_RESPONSE: "mrx-core.crud.success.insert_response";
|
|
8
|
-
readonly UPDATE_RESPONSE: "mrx-core.crud.success.update_response";
|
|
9
|
-
readonly UPDATE_ONE_RESPONSE: "mrx-core.crud.success.update_one_response";
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CRUD_SUCCESS_KEYS } from './crud-success-keys';
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
createCountResponse200Schema,
|
|
4
|
-
createCountSchema,
|
|
5
|
-
createDeleteSchema,
|
|
6
|
-
createFindSchema,
|
|
7
|
-
createIdParamSchema,
|
|
8
|
-
createInsertSchema,
|
|
9
|
-
createResponse200Schema,
|
|
10
|
-
createUpdateOneSchema,
|
|
11
|
-
createUpdateSchema
|
|
12
|
-
} from "../../../chunk-p14h6jfs.js";
|
|
13
|
-
import"../../../chunk-9dzsj7f2.js";
|
|
14
|
-
import {
|
|
15
|
-
batchDelete,
|
|
16
|
-
count,
|
|
17
|
-
deleteOne,
|
|
18
|
-
find,
|
|
19
|
-
findOne,
|
|
20
|
-
insert,
|
|
21
|
-
update,
|
|
22
|
-
updateOne
|
|
23
|
-
} from "../../../chunk-pjv1ekwr.js";
|
|
24
|
-
import"../../../chunk-441xs5k1.js";
|
|
25
|
-
import"../../../chunk-fs3wm3p4.js";
|
|
26
|
-
import"../../../chunk-z0ct35ft.js";
|
|
27
|
-
import"../../../chunk-8tffnbpn.js";
|
|
28
|
-
import"../../../chunk-w7h898m3.js";
|
|
29
|
-
import"../../../chunk-gtn1kn0z.js";
|
|
30
|
-
import"../../../chunk-jksb9ers.js";
|
|
31
|
-
import"../../../chunk-afd82epa.js";
|
|
32
|
-
import"../../../chunk-afyz8rg5.js";
|
|
33
|
-
import"../../../chunk-grfyngq0.js";
|
|
34
|
-
import"../../../chunk-mvrxngm7.js";
|
|
35
|
-
import"../../../chunk-4v86f7gp.js";
|
|
36
|
-
import"../../../chunk-7t524zqh.js";
|
|
37
|
-
import"../../../chunk-sqts8vyk.js";
|
|
38
|
-
import"../../../chunk-9cgzhc50.js";
|
|
39
|
-
|
|
40
|
-
// source/modules/elysia/crud/crud.ts
|
|
41
|
-
import { Elysia as Elysia2 } from "elysia";
|
|
42
|
-
|
|
43
|
-
// source/modules/elysia/crud/crud-schema.ts
|
|
44
|
-
import { Elysia } from "elysia";
|
|
45
|
-
var crudSchema = ({
|
|
46
|
-
sourceSchemaName,
|
|
47
|
-
sourceSchema,
|
|
48
|
-
sourceInsertSchema = sourceSchema,
|
|
49
|
-
sourceFindSchema = sourceSchema,
|
|
50
|
-
sourceCountSchema = sourceSchema,
|
|
51
|
-
sourceUpdateSchema = sourceSchema,
|
|
52
|
-
sourceDeleteSchema = sourceSchema,
|
|
53
|
-
sourceResponseSchema = sourceSchema,
|
|
54
|
-
operations = {
|
|
55
|
-
count: true,
|
|
56
|
-
find: true,
|
|
57
|
-
findOne: true,
|
|
58
|
-
insert: true,
|
|
59
|
-
update: true,
|
|
60
|
-
updateOne: true,
|
|
61
|
-
delete: true,
|
|
62
|
-
deleteOne: true
|
|
63
|
-
}
|
|
64
|
-
}) => {
|
|
65
|
-
const models = {};
|
|
66
|
-
if (operations.insert)
|
|
67
|
-
models[`${sourceSchemaName}Insert`] = createInsertSchema(sourceInsertSchema);
|
|
68
|
-
if (operations.find)
|
|
69
|
-
models[`${sourceSchemaName}Find`] = createFindSchema(sourceFindSchema);
|
|
70
|
-
if (operations.count)
|
|
71
|
-
models[`${sourceSchemaName}Count`] = createCountSchema(sourceCountSchema);
|
|
72
|
-
if (operations.update)
|
|
73
|
-
models[`${sourceSchemaName}Update`] = createUpdateSchema(sourceUpdateSchema);
|
|
74
|
-
if (operations.updateOne)
|
|
75
|
-
models[`${sourceSchemaName}UpdateOne`] = createUpdateOneSchema(sourceUpdateSchema);
|
|
76
|
-
if (operations.delete)
|
|
77
|
-
models[`${sourceSchemaName}Delete`] = createDeleteSchema(sourceDeleteSchema);
|
|
78
|
-
if (operations.findOne || operations.updateOne || operations.deleteOne)
|
|
79
|
-
models[`${sourceSchemaName}IdParam`] = createIdParamSchema();
|
|
80
|
-
if (operations.find || operations.findOne || operations.insert || operations.update || operations.updateOne || operations.delete || operations.deleteOne)
|
|
81
|
-
models[`${sourceSchemaName}Response200`] = createResponse200Schema(sourceResponseSchema);
|
|
82
|
-
if (operations.count)
|
|
83
|
-
models[`${sourceSchemaName}CountResponse200`] = createCountResponse200Schema();
|
|
84
|
-
const app = new Elysia({
|
|
85
|
-
name: `crudSchemaPlugin-${sourceSchemaName}`
|
|
86
|
-
}).model(models);
|
|
87
|
-
return app;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// source/modules/elysia/crud/crud.ts
|
|
91
|
-
var crud = ({
|
|
92
|
-
database,
|
|
93
|
-
tableName,
|
|
94
|
-
schema,
|
|
95
|
-
operations = {
|
|
96
|
-
find: true,
|
|
97
|
-
findOne: true,
|
|
98
|
-
insert: true,
|
|
99
|
-
update: true,
|
|
100
|
-
updateOne: true,
|
|
101
|
-
delete: true,
|
|
102
|
-
deleteOne: true,
|
|
103
|
-
count: true
|
|
104
|
-
},
|
|
105
|
-
tags = [tableName],
|
|
106
|
-
prefix = ""
|
|
107
|
-
}) => {
|
|
108
|
-
const app = new Elysia2({
|
|
109
|
-
name: `crudPlugin[${tableName}]`,
|
|
110
|
-
tags,
|
|
111
|
-
prefix
|
|
112
|
-
}).use(crudSchema({
|
|
113
|
-
sourceSchemaName: tableName,
|
|
114
|
-
sourceSchema: schema.sourceSchema,
|
|
115
|
-
sourceInsertSchema: schema.sourceInsertSchema || schema.sourceSchema,
|
|
116
|
-
sourceFindSchema: schema.sourceFindSchema || schema.sourceSchema,
|
|
117
|
-
sourceCountSchema: schema.sourceCountSchema || schema.sourceSchema,
|
|
118
|
-
sourceUpdateSchema: schema.sourceUpdateSchema || schema.sourceSchema,
|
|
119
|
-
sourceDeleteSchema: schema.sourceDeleteSchema || schema.sourceSchema,
|
|
120
|
-
sourceResponseSchema: schema.sourceResponseSchema || schema.sourceSchema,
|
|
121
|
-
operations: {
|
|
122
|
-
find: operations.find ? true : false,
|
|
123
|
-
findOne: operations.findOne ? true : false,
|
|
124
|
-
insert: operations.insert ? true : false,
|
|
125
|
-
update: operations.update ? true : false,
|
|
126
|
-
updateOne: operations.updateOne ? true : false,
|
|
127
|
-
delete: operations.delete ? true : false,
|
|
128
|
-
deleteOne: operations.deleteOne ? true : false,
|
|
129
|
-
count: operations.count ? true : false
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
if (operations.insert)
|
|
133
|
-
app.use(insert(database, tableName, operations.insert && typeof operations.insert === "object" ? operations.insert : {}));
|
|
134
|
-
if (operations.find)
|
|
135
|
-
app.use(find(database, tableName, operations.find && typeof operations.find === "object" ? operations.find : {}));
|
|
136
|
-
if (operations.findOne)
|
|
137
|
-
app.use(findOne(database, tableName, operations.findOne && typeof operations.findOne === "object" ? operations.findOne : {}));
|
|
138
|
-
if (operations.update)
|
|
139
|
-
app.use(update(database, tableName, operations.update && typeof operations.update === "object" ? operations.update : {}));
|
|
140
|
-
if (operations.updateOne)
|
|
141
|
-
app.use(updateOne(database, tableName, operations.updateOne && typeof operations.updateOne === "object" ? operations.updateOne : {}));
|
|
142
|
-
if (operations.delete)
|
|
143
|
-
app.use(batchDelete(database, tableName, operations.delete && typeof operations.delete === "object" ? operations.delete : {}));
|
|
144
|
-
if (operations.deleteOne)
|
|
145
|
-
app.use(deleteOne(database, tableName, operations.deleteOne && typeof operations.deleteOne === "object" ? operations.deleteOne : {}));
|
|
146
|
-
if (operations.count)
|
|
147
|
-
app.use(count(database, tableName, operations.count && typeof operations.count === "object" ? operations.count : {}));
|
|
148
|
-
return app;
|
|
149
|
-
};
|
|
150
|
-
export {
|
|
151
|
-
crudSchema,
|
|
152
|
-
crud
|
|
153
|
-
};
|