@ai0x0/utils 0.0.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 (122) hide show
  1. package/LICENSE +21 -0
  2. package/es/backend/actions/delete-action-fn.d.ts +7 -0
  3. package/es/backend/actions/delete-action-fn.d.ts.map +1 -0
  4. package/es/backend/actions/delete-action-fn.js +30 -0
  5. package/es/backend/actions/get-List-query.d.ts +30 -0
  6. package/es/backend/actions/get-List-query.d.ts.map +1 -0
  7. package/es/backend/actions/get-List-query.js +212 -0
  8. package/es/backend/actions/get-action-fn.d.ts +12 -0
  9. package/es/backend/actions/get-action-fn.d.ts.map +1 -0
  10. package/es/backend/actions/get-action-fn.js +75 -0
  11. package/es/backend/actions/get-list-action-fn.d.ts +12 -0
  12. package/es/backend/actions/get-list-action-fn.d.ts.map +1 -0
  13. package/es/backend/actions/get-list-action-fn.js +68 -0
  14. package/es/backend/actions/get-list-data.d.ts +8 -0
  15. package/es/backend/actions/get-list-data.d.ts.map +1 -0
  16. package/es/backend/actions/get-list-data.js +49 -0
  17. package/es/backend/actions/index.d.ts +6 -0
  18. package/es/backend/actions/index.d.ts.map +1 -0
  19. package/es/backend/actions/index.js +5 -0
  20. package/es/backend/actions/post-action-fn.d.ts +13 -0
  21. package/es/backend/actions/post-action-fn.d.ts.map +1 -0
  22. package/es/backend/actions/post-action-fn.js +35 -0
  23. package/es/backend/actions/put-action-fn.d.ts +9 -0
  24. package/es/backend/actions/put-action-fn.d.ts.map +1 -0
  25. package/es/backend/actions/put-action-fn.js +34 -0
  26. package/es/backend/actions/transform-body.d.ts +2 -0
  27. package/es/backend/actions/transform-body.d.ts.map +1 -0
  28. package/es/backend/actions/transform-body.js +11 -0
  29. package/es/backend/index.d.ts +3 -0
  30. package/es/backend/index.d.ts.map +1 -0
  31. package/es/backend/index.js +2 -0
  32. package/es/backend/route-operation/delete-operation.d.ts +10 -0
  33. package/es/backend/route-operation/delete-operation.d.ts.map +1 -0
  34. package/es/backend/route-operation/delete-operation.js +59 -0
  35. package/es/backend/route-operation/get-list-operation.d.ts +24 -0
  36. package/es/backend/route-operation/get-list-operation.d.ts.map +1 -0
  37. package/es/backend/route-operation/get-list-operation.js +83 -0
  38. package/es/backend/route-operation/get-operation.d.ts +17 -0
  39. package/es/backend/route-operation/get-operation.d.ts.map +1 -0
  40. package/es/backend/route-operation/get-operation.js +65 -0
  41. package/es/backend/route-operation/get-table-name.d.ts +4 -0
  42. package/es/backend/route-operation/get-table-name.d.ts.map +1 -0
  43. package/es/backend/route-operation/get-table-name.js +13 -0
  44. package/es/backend/route-operation/index.d.ts +6 -0
  45. package/es/backend/route-operation/index.d.ts.map +1 -0
  46. package/es/backend/route-operation/index.js +5 -0
  47. package/es/backend/route-operation/post-operation.d.ts +14 -0
  48. package/es/backend/route-operation/post-operation.d.ts.map +1 -0
  49. package/es/backend/route-operation/post-operation.js +84 -0
  50. package/es/backend/route-operation/put-operation.d.ts +14 -0
  51. package/es/backend/route-operation/put-operation.d.ts.map +1 -0
  52. package/es/backend/route-operation/put-operation.js +71 -0
  53. package/es/backend/schemas/index.d.ts +4674 -0
  54. package/es/backend/schemas/index.d.ts.map +1 -0
  55. package/es/backend/schemas/index.js +87 -0
  56. package/es/backend/types.d.ts +13 -0
  57. package/es/backend/types.d.ts.map +1 -0
  58. package/es/backend/types.js +1 -0
  59. package/es/index.d.ts +1 -0
  60. package/es/index.d.ts.map +1 -0
  61. package/es/index.js +0 -0
  62. package/lib/backend/actions/delete-action-fn.d.ts +7 -0
  63. package/lib/backend/actions/delete-action-fn.d.ts.map +1 -0
  64. package/lib/backend/actions/delete-action-fn.js +42 -0
  65. package/lib/backend/actions/get-List-query.d.ts +30 -0
  66. package/lib/backend/actions/get-List-query.d.ts.map +1 -0
  67. package/lib/backend/actions/get-List-query.js +162 -0
  68. package/lib/backend/actions/get-action-fn.d.ts +12 -0
  69. package/lib/backend/actions/get-action-fn.d.ts.map +1 -0
  70. package/lib/backend/actions/get-action-fn.js +75 -0
  71. package/lib/backend/actions/get-list-action-fn.d.ts +12 -0
  72. package/lib/backend/actions/get-list-action-fn.d.ts.map +1 -0
  73. package/lib/backend/actions/get-list-action-fn.js +74 -0
  74. package/lib/backend/actions/get-list-data.d.ts +8 -0
  75. package/lib/backend/actions/get-list-data.d.ts.map +1 -0
  76. package/lib/backend/actions/get-list-data.js +48 -0
  77. package/lib/backend/actions/index.d.ts +6 -0
  78. package/lib/backend/actions/index.d.ts.map +1 -0
  79. package/lib/backend/actions/index.js +41 -0
  80. package/lib/backend/actions/post-action-fn.d.ts +13 -0
  81. package/lib/backend/actions/post-action-fn.d.ts.map +1 -0
  82. package/lib/backend/actions/post-action-fn.js +49 -0
  83. package/lib/backend/actions/put-action-fn.d.ts +9 -0
  84. package/lib/backend/actions/put-action-fn.d.ts.map +1 -0
  85. package/lib/backend/actions/put-action-fn.js +43 -0
  86. package/lib/backend/actions/transform-body.d.ts +2 -0
  87. package/lib/backend/actions/transform-body.d.ts.map +1 -0
  88. package/lib/backend/actions/transform-body.js +47 -0
  89. package/lib/backend/index.d.ts +3 -0
  90. package/lib/backend/index.d.ts.map +1 -0
  91. package/lib/backend/index.js +25 -0
  92. package/lib/backend/route-operation/delete-operation.d.ts +10 -0
  93. package/lib/backend/route-operation/delete-operation.d.ts.map +1 -0
  94. package/lib/backend/route-operation/delete-operation.js +59 -0
  95. package/lib/backend/route-operation/get-list-operation.d.ts +24 -0
  96. package/lib/backend/route-operation/get-list-operation.d.ts.map +1 -0
  97. package/lib/backend/route-operation/get-list-operation.js +87 -0
  98. package/lib/backend/route-operation/get-operation.d.ts +17 -0
  99. package/lib/backend/route-operation/get-operation.d.ts.map +1 -0
  100. package/lib/backend/route-operation/get-operation.js +82 -0
  101. package/lib/backend/route-operation/get-table-name.d.ts +4 -0
  102. package/lib/backend/route-operation/get-table-name.d.ts.map +1 -0
  103. package/lib/backend/route-operation/get-table-name.js +35 -0
  104. package/lib/backend/route-operation/index.d.ts +6 -0
  105. package/lib/backend/route-operation/index.d.ts.map +1 -0
  106. package/lib/backend/route-operation/index.js +31 -0
  107. package/lib/backend/route-operation/post-operation.d.ts +14 -0
  108. package/lib/backend/route-operation/post-operation.d.ts.map +1 -0
  109. package/lib/backend/route-operation/post-operation.js +67 -0
  110. package/lib/backend/route-operation/put-operation.d.ts +14 -0
  111. package/lib/backend/route-operation/put-operation.d.ts.map +1 -0
  112. package/lib/backend/route-operation/put-operation.js +66 -0
  113. package/lib/backend/schemas/index.d.ts +4674 -0
  114. package/lib/backend/schemas/index.d.ts.map +1 -0
  115. package/lib/backend/schemas/index.js +98 -0
  116. package/lib/backend/types.d.ts +13 -0
  117. package/lib/backend/types.d.ts.map +1 -0
  118. package/lib/backend/types.js +17 -0
  119. package/lib/index.d.ts +1 -0
  120. package/lib/index.d.ts.map +1 -0
  121. package/lib/index.js +0 -0
  122. package/package.json +86 -0
@@ -0,0 +1,41 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/backend/actions/index.ts
20
+ var actions_exports = {};
21
+ __export(actions_exports, {
22
+ deleteActionFn: () => import_delete_action_fn.deleteActionFn,
23
+ getActionFn: () => import_get_action_fn.getActionFn,
24
+ getListActionFn: () => import_get_list_action_fn.getListActionFn,
25
+ postActionFn: () => import_post_action_fn.postActionFn,
26
+ putActionFn: () => import_put_action_fn.putActionFn
27
+ });
28
+ module.exports = __toCommonJS(actions_exports);
29
+ var import_delete_action_fn = require("./delete-action-fn");
30
+ var import_get_action_fn = require("./get-action-fn");
31
+ var import_get_list_action_fn = require("./get-list-action-fn");
32
+ var import_post_action_fn = require("./post-action-fn");
33
+ var import_put_action_fn = require("./put-action-fn");
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ deleteActionFn,
37
+ getActionFn,
38
+ getListActionFn,
39
+ postActionFn,
40
+ putActionFn
41
+ });
@@ -0,0 +1,13 @@
1
+ import { z, ZodSchema } from "zod";
2
+ import { PgTable } from "drizzle-orm/pg-core";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
+ export declare function postActionFn<T extends ZodSchema, TTable extends PgTable>({ bodySchema, table, db, }: {
5
+ bodySchema: T;
6
+ db: NodePgDatabase<any>;
7
+ table: TTable;
8
+ }): import("next-rest-framework/dist/index-Xbs7wi4f").R<"application/json", any, {
9
+ body: z.ZodArray<T, "many">;
10
+ contentType: "application/json";
11
+ status: number;
12
+ }[], true, Promise<T["_output"][]>>;
13
+ //# sourceMappingURL=post-action-fn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-action-fn.d.ts","sourceRoot":"","sources":["post-action-fn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,SAAS,OAAO,EAAE,EACxE,UAAU,EACV,KAAK,EACL,EAAE,GACH,EAAE;IACD,UAAU,EAAE,CAAC,CAAC;IACd,EAAE,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;;;;oCAgBA"}
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/backend/actions/post-action-fn.ts
20
+ var post_action_fn_exports = {};
21
+ __export(post_action_fn_exports, {
22
+ postActionFn: () => postActionFn
23
+ });
24
+ module.exports = __toCommonJS(post_action_fn_exports);
25
+ var import_zod = require("zod");
26
+ var import_next_rest_framework = require("next-rest-framework");
27
+ var import_transform_body = require("./transform-body");
28
+ function postActionFn({
29
+ bodySchema,
30
+ table,
31
+ db
32
+ }) {
33
+ return (0, import_next_rest_framework.rpcOperation)().input({
34
+ body: bodySchema,
35
+ contentType: "application/json"
36
+ }).outputs([
37
+ {
38
+ body: import_zod.z.array(bodySchema),
39
+ contentType: "application/json",
40
+ status: 200
41
+ }
42
+ ]).handler(async (body) => {
43
+ return db.insert(table).values((0, import_transform_body.transformBody)(body)).returning();
44
+ });
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ postActionFn
49
+ });
@@ -0,0 +1,9 @@
1
+ import { ZodSchema } from "zod";
2
+ import { PgTable } from "drizzle-orm/pg-core";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
+ export declare function putActionFn<T extends ZodSchema, TTable extends PgTable>({ db, bodySchema, table, }: {
5
+ bodySchema: T;
6
+ db: NodePgDatabase<any>;
7
+ table: TTable;
8
+ }): any;
9
+ //# sourceMappingURL=put-action-fn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-action-fn.d.ts","sourceRoot":"","sources":["put-action-fn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,SAAS,OAAO,EAAE,EACvE,EAAE,EACF,UAAU,EACV,KAAK,GACN,EAAE;IACD,UAAU,EAAE,CAAC,CAAC;IACd,EAAE,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,OAiBA"}
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/backend/actions/put-action-fn.ts
20
+ var put_action_fn_exports = {};
21
+ __export(put_action_fn_exports, {
22
+ putActionFn: () => putActionFn
23
+ });
24
+ module.exports = __toCommonJS(put_action_fn_exports);
25
+ var import_next_rest_framework = require("next-rest-framework");
26
+ var import_transform_body = require("./transform-body");
27
+ var import_drizzle_orm = require("drizzle-orm");
28
+ function putActionFn({
29
+ db,
30
+ bodySchema,
31
+ table
32
+ }) {
33
+ return (0, import_next_rest_framework.rpcOperation)().input({
34
+ body: bodySchema,
35
+ contentType: "application/json"
36
+ }).handler(async (body) => {
37
+ return db.update(table).set((0, import_transform_body.transformBody)(body)).where((0, import_drizzle_orm.eq)(table.id, body.id)).returning();
38
+ });
39
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ putActionFn
43
+ });
@@ -0,0 +1,2 @@
1
+ export declare const transformBody: (body: Record<string, any>) => any;
2
+ //# sourceMappingURL=transform-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-body.d.ts","sourceRoot":"","sources":["transform-body.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,SAAU,OAAO,MAAM,EAAE,GAAG,CAAC,KAAG,GASzD,CAAC"}
@@ -0,0 +1,47 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/backend/actions/transform-body.ts
30
+ var transform_body_exports = {};
31
+ __export(transform_body_exports, {
32
+ transformBody: () => transformBody
33
+ });
34
+ module.exports = __toCommonJS(transform_body_exports);
35
+ var import_dayjs = __toESM(require("dayjs"));
36
+ var transformBody = (body) => {
37
+ for (const key in body) {
38
+ if (key.endsWith("At")) {
39
+ body[key] = (0, import_dayjs.default)(body[key]).toDate();
40
+ }
41
+ }
42
+ return body;
43
+ };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ transformBody
47
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./route-operation";
2
+ export * from "./schemas";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/backend/index.ts
17
+ var backend_exports = {};
18
+ module.exports = __toCommonJS(backend_exports);
19
+ __reExport(backend_exports, require("./route-operation"), module.exports);
20
+ __reExport(backend_exports, require("./schemas"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./route-operation"),
24
+ ...require("./schemas")
25
+ });
@@ -0,0 +1,10 @@
1
+ import { BaseTable } from "../types";
2
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
+ export interface DeleteOperationOptions<TTable extends BaseTable> {
4
+ table: TTable;
5
+ summary?: string;
6
+ }
7
+ export declare const createDeleteOperation: <TTable extends BaseTable>({ db }: {
8
+ db: NodePgDatabase<any>;
9
+ }) => ({ table, summary }: DeleteOperationOptions<TTable>) => any;
10
+ //# sourceMappingURL=delete-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-operation.d.ts","sourceRoot":"","sources":["delete-operation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,iBAAwB;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,sBAAsB,CAAC,MAAM,SAAS,SAAS;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,eAAO,MAAM,qBAAqB;QACS,eAAe,GAAG,CAAC;iEAoB/C,CAAC"}
@@ -0,0 +1,59 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/backend/route-operation/delete-operation.ts
30
+ var delete_operation_exports = {};
31
+ __export(delete_operation_exports, {
32
+ createDeleteOperation: () => createDeleteOperation
33
+ });
34
+ module.exports = __toCommonJS(delete_operation_exports);
35
+ var import_next_rest_framework = require("next-rest-framework");
36
+ var import_zod = require("zod");
37
+ var import_get_table_name = __toESM(require("./get-table-name"));
38
+ var import_actions = require("../actions");
39
+ var createDeleteOperation = ({ db }) => ({ table, summary }) => (0, import_next_rest_framework.routeOperation)({
40
+ method: "DELETE",
41
+ openApiOperation: {
42
+ summary,
43
+ tags: [(0, import_get_table_name.default)(table)]
44
+ }
45
+ }).input({
46
+ body: import_zod.z.object({
47
+ id: import_zod.z.string()
48
+ }),
49
+ contentType: "application/json"
50
+ }).handler(async (req) => {
51
+ const { id } = await req.json();
52
+ return import_next_rest_framework.TypedNextResponse.json(await (0, import_actions.deleteActionFn)({ table, db })(id), {
53
+ status: 200
54
+ });
55
+ });
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ createDeleteOperation
59
+ });
@@ -0,0 +1,24 @@
1
+ import { z, ZodSchema } from "zod";
2
+ import { NextRequest } from "next/server";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
+ import { BaseTable, GetListRelations } from "../types";
5
+ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchema, TTable extends BaseTable> {
6
+ bodySchema: T;
7
+ jsonArrayFields?: string[];
8
+ querySchema: Q;
9
+ relations?: GetListRelations;
10
+ setParams?: (req: NextRequest) => Promise<Record<string, unknown>>;
11
+ summary?: string;
12
+ table: TTable;
13
+ transform?: <D extends T>(data: {
14
+ data: z.infer<D>[];
15
+ total: number;
16
+ }) => Promise<{
17
+ data: z.infer<T>[];
18
+ total: number;
19
+ }>;
20
+ }
21
+ export declare const createGetListOperation: <T extends z.ZodType<any, z.ZodTypeDef, any>, Q extends z.ZodType<any, z.ZodTypeDef, any>, TTable extends BaseTable>({ db, }: {
22
+ db: NodePgDatabase<any>;
23
+ }) => ({ querySchema, bodySchema, table, summary, relations, jsonArrayFields, setParams, transform, }: GetListOperationOptions<T, Q, TTable>) => any;
24
+ //# sourceMappingURL=get-list-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-list-operation.d.ts","sourceRoot":"","sources":["get-list-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAwB;AAE9D,MAAM,WAAW,uBAAuB,CACtC,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,MAAM,SAAS,SAAS;IAExB,UAAU,EAAE,CAAC,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,CAAC,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;QAC9B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,OAAO,CAAC;QACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,sBAAsB;QAI3B,eAAe,GAAG,CAAC;oJAkDZ,CAAC"}
@@ -0,0 +1,87 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/backend/route-operation/get-list-operation.ts
30
+ var get_list_operation_exports = {};
31
+ __export(get_list_operation_exports, {
32
+ createGetListOperation: () => createGetListOperation
33
+ });
34
+ module.exports = __toCommonJS(get_list_operation_exports);
35
+ var import_next_rest_framework = require("next-rest-framework");
36
+ var import_get_table_name = __toESM(require("./get-table-name"));
37
+ var import_schemas = require("../schemas");
38
+ var import_actions = require("../actions");
39
+ var createGetListOperation = ({
40
+ db
41
+ }) => ({
42
+ querySchema,
43
+ bodySchema,
44
+ table,
45
+ summary,
46
+ relations,
47
+ jsonArrayFields,
48
+ setParams,
49
+ transform
50
+ }) => (0, import_next_rest_framework.routeOperation)({
51
+ method: "GET",
52
+ openApiOperation: {
53
+ summary,
54
+ tags: [(0, import_get_table_name.default)(table)]
55
+ }
56
+ }).input({
57
+ query: querySchema
58
+ }).outputs([
59
+ {
60
+ body: (0, import_schemas.listBodySchema)(bodySchema),
61
+ contentType: "application/json",
62
+ status: 200
63
+ }
64
+ ]).handler(async (req) => {
65
+ const params = await (setParams == null ? void 0 : setParams(req)) || {};
66
+ let result = await (0, import_actions.getListActionFn)({
67
+ bodySchema,
68
+ db,
69
+ jsonArrayFields,
70
+ querySchema,
71
+ relations,
72
+ table
73
+ })(
74
+ Object.assign(
75
+ Object.fromEntries(new URL(req.url).searchParams),
76
+ params
77
+ )
78
+ );
79
+ if (transform) {
80
+ result = await transform(result);
81
+ }
82
+ return import_next_rest_framework.TypedNextResponse.json(result, { status: 200 });
83
+ });
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ createGetListOperation
87
+ });
@@ -0,0 +1,17 @@
1
+ import { ZodSchema } from "zod";
2
+ import { NextRequest } from "next/server";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
+ import { BaseTable, GetListRelations } from "../types";
5
+ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, TTable extends BaseTable> {
6
+ bodySchema: T;
7
+ jsonArrayFields?: string[];
8
+ querySchema: Q;
9
+ relations?: GetListRelations;
10
+ setParams?: (req: NextRequest) => Promise<Record<string, any>>;
11
+ summary?: string;
12
+ table: TTable;
13
+ }
14
+ export declare const createGetOperation: <T extends ZodSchema<any, import("zod").ZodTypeDef, any>, Q extends ZodSchema<any, import("zod").ZodTypeDef, any>, TTable extends BaseTable>({ db, }: {
15
+ db: NodePgDatabase<any>;
16
+ }) => ({ querySchema, bodySchema, table, summary, relations, setParams, jsonArrayFields, }: GetOperationOptions<T, Q, TTable>) => any;
17
+ //# sourceMappingURL=get-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-operation.d.ts","sourceRoot":"","sources":["get-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAwB;AAE9D,MAAM,WAAW,mBAAmB,CAClC,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,MAAM,SAAS,SAAS;IAExB,UAAU,EAAE,CAAC,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,CAAC,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,kBAAkB;QAIvB,eAAe,GAAG,CAAC;qIA4CZ,CAAC"}
@@ -0,0 +1,82 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/backend/route-operation/get-operation.ts
30
+ var get_operation_exports = {};
31
+ __export(get_operation_exports, {
32
+ createGetOperation: () => createGetOperation
33
+ });
34
+ module.exports = __toCommonJS(get_operation_exports);
35
+ var import_next_rest_framework = require("next-rest-framework");
36
+ var import_get_table_name = __toESM(require("./get-table-name"));
37
+ var import_actions = require("../actions");
38
+ var createGetOperation = ({
39
+ db
40
+ }) => ({
41
+ querySchema,
42
+ bodySchema,
43
+ table,
44
+ summary,
45
+ relations,
46
+ setParams,
47
+ jsonArrayFields
48
+ }) => (0, import_next_rest_framework.routeOperation)({
49
+ method: "GET",
50
+ openApiOperation: {
51
+ summary,
52
+ tags: [(0, import_get_table_name.default)(table)]
53
+ }
54
+ }).input({
55
+ query: querySchema
56
+ }).outputs([
57
+ {
58
+ body: bodySchema,
59
+ contentType: "application/json",
60
+ status: 200
61
+ }
62
+ ]).handler(async (req) => {
63
+ const params = await (setParams == null ? void 0 : setParams(req));
64
+ const result = await (0, import_actions.getActionFn)({
65
+ bodySchema,
66
+ db,
67
+ jsonArrayFields,
68
+ querySchema,
69
+ relations,
70
+ table
71
+ })(
72
+ Object.assign(
73
+ Object.fromEntries(new URL(req.url).searchParams),
74
+ params
75
+ )
76
+ );
77
+ return import_next_rest_framework.TypedNextResponse.json(result, { status: 200 });
78
+ });
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ createGetOperation
82
+ });
@@ -0,0 +1,4 @@
1
+ import { PgTable } from "drizzle-orm/pg-core";
2
+ declare function getTableName(table: PgTable): string;
3
+ export default getTableName;
4
+ //# sourceMappingURL=get-table-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-table-name.d.ts","sourceRoot":"","sources":["get-table-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,iBAAS,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAa5C;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/backend/route-operation/get-table-name.ts
20
+ var get_table_name_exports = {};
21
+ __export(get_table_name_exports, {
22
+ default: () => get_table_name_default
23
+ });
24
+ module.exports = __toCommonJS(get_table_name_exports);
25
+ function getTableName(table) {
26
+ const symbols = Object.getOwnPropertySymbols(table);
27
+ const nameSymbol = symbols.find(
28
+ (sym) => sym.toString() === "Symbol(drizzle:Name)"
29
+ );
30
+ if (nameSymbol) {
31
+ return table[nameSymbol];
32
+ }
33
+ return "";
34
+ }
35
+ var get_table_name_default = getTableName;
@@ -0,0 +1,6 @@
1
+ export * from "./get-operation";
2
+ export * from "./get-list-operation";
3
+ export * from "./delete-operation";
4
+ export * from "./post-operation";
5
+ export * from "./put-operation";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/backend/route-operation/index.ts
17
+ var route_operation_exports = {};
18
+ module.exports = __toCommonJS(route_operation_exports);
19
+ __reExport(route_operation_exports, require("./get-operation"), module.exports);
20
+ __reExport(route_operation_exports, require("./get-list-operation"), module.exports);
21
+ __reExport(route_operation_exports, require("./delete-operation"), module.exports);
22
+ __reExport(route_operation_exports, require("./post-operation"), module.exports);
23
+ __reExport(route_operation_exports, require("./put-operation"), module.exports);
24
+ // Annotate the CommonJS export names for ESM import in node:
25
+ 0 && (module.exports = {
26
+ ...require("./get-operation"),
27
+ ...require("./get-list-operation"),
28
+ ...require("./delete-operation"),
29
+ ...require("./post-operation"),
30
+ ...require("./put-operation")
31
+ });