arkos 1.4.0-canary.92 → 1.4.1-canary.2

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 (151) hide show
  1. package/dist/cjs/app.js +1 -1
  2. package/dist/cjs/app.js.map +1 -1
  3. package/dist/cjs/exports/index.js.map +1 -1
  4. package/dist/cjs/modules/auth/auth.controller.js +1 -1
  5. package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
  6. package/dist/cjs/modules/auth/auth.service.js +2 -3
  7. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  8. package/dist/cjs/modules/auth/utils/services/auth-action.service.js +50 -8
  9. package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
  10. package/dist/cjs/modules/base/base.controller.js +6 -3
  11. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  12. package/dist/cjs/modules/base/base.middlewares.js +8 -4
  13. package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
  14. package/dist/cjs/modules/error-handler/error-handler.controller.js +2 -2
  15. package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
  16. package/dist/cjs/modules/error-handler/utils/catch-async.js.map +1 -1
  17. package/dist/cjs/modules/swagger/swagger.router.js +6 -4
  18. package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
  19. package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js +7 -0
  20. package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
  21. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +308 -183
  22. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  23. package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +357 -288
  24. package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  25. package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -5
  26. package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  27. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
  28. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
  29. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
  30. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
  31. package/dist/cjs/server.js +17 -15
  32. package/dist/cjs/server.js.map +1 -1
  33. package/dist/cjs/types/index.js.map +1 -1
  34. package/dist/cjs/types/new-arkos-config.js.map +1 -1
  35. package/dist/cjs/utils/arkos-router/index.js +32 -5
  36. package/dist/cjs/utils/arkos-router/index.js.map +1 -1
  37. package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
  38. package/dist/cjs/utils/arkos-router/utils/helpers/index.js +11 -0
  39. package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
  40. package/dist/cjs/utils/cli/dev.js +12 -53
  41. package/dist/cjs/utils/cli/dev.js.map +1 -1
  42. package/dist/cjs/utils/cli/export-auth-action.js +1 -1
  43. package/dist/cjs/utils/cli/export-auth-action.js.map +1 -1
  44. package/dist/cjs/utils/cli/generate.js +3 -3
  45. package/dist/cjs/utils/cli/generate.js.map +1 -1
  46. package/dist/cjs/utils/cli/index.js +1 -1
  47. package/dist/cjs/utils/cli/index.js.map +1 -1
  48. package/dist/cjs/utils/cli/start.js +14 -10
  49. package/dist/cjs/utils/cli/start.js.map +1 -1
  50. package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
  51. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +51 -6
  52. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  53. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
  54. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
  55. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
  56. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
  57. package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
  58. package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
  59. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +3 -1
  60. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  61. package/dist/cjs/utils/dotenv.helpers.js +10 -6
  62. package/dist/cjs/utils/dotenv.helpers.js.map +1 -1
  63. package/dist/cjs/utils/helpers/api.features.helpers.js +174 -81
  64. package/dist/cjs/utils/helpers/api.features.helpers.js.map +1 -1
  65. package/dist/cjs/utils/helpers/prisma.helpers.js +40 -1
  66. package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
  67. package/dist/cjs/utils/helpers/routers.helpers.js +0 -1
  68. package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
  69. package/dist/esm/app.js +1 -1
  70. package/dist/esm/app.js.map +1 -1
  71. package/dist/esm/exports/index.js.map +1 -1
  72. package/dist/esm/modules/auth/auth.controller.js +1 -1
  73. package/dist/esm/modules/auth/auth.controller.js.map +1 -1
  74. package/dist/esm/modules/auth/auth.service.js +3 -4
  75. package/dist/esm/modules/auth/auth.service.js.map +1 -1
  76. package/dist/esm/modules/auth/utils/services/auth-action.service.js +50 -5
  77. package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
  78. package/dist/esm/modules/base/base.controller.js +6 -3
  79. package/dist/esm/modules/base/base.controller.js.map +1 -1
  80. package/dist/esm/modules/base/base.middlewares.js +8 -4
  81. package/dist/esm/modules/base/base.middlewares.js.map +1 -1
  82. package/dist/esm/modules/error-handler/error-handler.controller.js +2 -2
  83. package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
  84. package/dist/esm/modules/error-handler/utils/catch-async.js.map +1 -1
  85. package/dist/esm/modules/swagger/swagger.router.js +6 -4
  86. package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
  87. package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js +5 -0
  88. package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
  89. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +308 -183
  90. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  91. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +357 -288
  92. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  93. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
  94. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  95. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
  96. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
  97. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
  98. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
  99. package/dist/esm/server.js +17 -15
  100. package/dist/esm/server.js.map +1 -1
  101. package/dist/esm/types/index.js.map +1 -1
  102. package/dist/esm/types/new-arkos-config.js.map +1 -1
  103. package/dist/esm/utils/arkos-router/index.js +33 -6
  104. package/dist/esm/utils/arkos-router/index.js.map +1 -1
  105. package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
  106. package/dist/esm/utils/arkos-router/utils/helpers/index.js +10 -0
  107. package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
  108. package/dist/esm/utils/cli/dev.js +13 -54
  109. package/dist/esm/utils/cli/dev.js.map +1 -1
  110. package/dist/esm/utils/cli/export-auth-action.js +1 -1
  111. package/dist/esm/utils/cli/export-auth-action.js.map +1 -1
  112. package/dist/esm/utils/cli/generate.js +3 -3
  113. package/dist/esm/utils/cli/generate.js.map +1 -1
  114. package/dist/esm/utils/cli/index.js +1 -1
  115. package/dist/esm/utils/cli/index.js.map +1 -1
  116. package/dist/esm/utils/cli/start.js +14 -10
  117. package/dist/esm/utils/cli/start.js.map +1 -1
  118. package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
  119. package/dist/esm/utils/cli/utils/runtime-cli-commander.js +52 -7
  120. package/dist/esm/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  121. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
  122. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
  123. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
  124. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
  125. package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
  126. package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
  127. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +3 -1
  128. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  129. package/dist/esm/utils/dotenv.helpers.js +10 -6
  130. package/dist/esm/utils/dotenv.helpers.js.map +1 -1
  131. package/dist/esm/utils/helpers/api.features.helpers.js +174 -81
  132. package/dist/esm/utils/helpers/api.features.helpers.js.map +1 -1
  133. package/dist/esm/utils/helpers/prisma.helpers.js +39 -1
  134. package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -1
  135. package/dist/esm/utils/helpers/routers.helpers.js +0 -1
  136. package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
  137. package/dist/types/exports/index.d.ts +2 -1
  138. package/dist/types/modules/auth/auth.router.d.ts +1 -1
  139. package/dist/types/modules/auth/auth.service.d.ts +2 -2
  140. package/dist/types/modules/base/base.router.d.ts +1 -1
  141. package/dist/types/modules/swagger/utils/built-in-route-path-object-manager.d.ts +4 -0
  142. package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +1 -1
  143. package/dist/types/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.d.ts +1 -1
  144. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.d.ts +1 -1
  145. package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +1 -1
  146. package/dist/types/types/index.d.ts +5 -5
  147. package/dist/types/types/new-arkos-config.d.ts +1 -1
  148. package/dist/types/utils/arkos-router/types/index.d.ts +15 -14
  149. package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +1 -0
  150. package/dist/types/utils/helpers/prisma.helpers.d.ts +1 -0
  151. package/package.json +2 -2
@@ -9,6 +9,15 @@ const pluralize_1 = __importDefault(require("pluralize"));
9
9
  const base_router_helpers_1 = require("../../../../../base/utils/helpers/base.router.helpers");
10
10
  const utils_1 = require("../../../../../../exports/utils");
11
11
  const dynamic_loader_1 = require("../../../../../../utils/dynamic-loader");
12
+ const arkos_config_helpers_1 = require("../../../../../../utils/helpers/arkos-config.helpers");
13
+ function getAuthErrorResponses() {
14
+ if (!(0, arkos_config_helpers_1.isAuthenticationEnabled)())
15
+ return {};
16
+ return {
17
+ "401": { description: "Authentication required" },
18
+ "403": { description: "Insufficient permissions" },
19
+ };
20
+ }
12
21
  function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
13
22
  const modelName = (0, utils_1.kebabCase)(model);
14
23
  const routeName = pluralize_1.default.plural(modelName);
@@ -32,15 +41,19 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
32
41
  return swaggerMode || "prisma";
33
42
  };
34
43
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "createOne")) {
35
- if (!paths[`/api/${routeName}`])
36
- paths[`/api/${routeName}`] = {};
44
+ const pathname = `/api/${routeName}`;
45
+ if (!paths[pathname])
46
+ paths[pathname] = {};
37
47
  const createMode = getSchemaMode("create");
38
- paths[`/api/${routeName}`].post = {
39
- tags: [humanReadableNamePlural],
40
- summary: `Create a new ${humanReadableName}`,
48
+ const currentPath = paths[pathname].post;
49
+ const defaultSpec = {
50
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
51
+ summary: currentPath?.summary === pathname || !currentPath?.summary
52
+ ? `Create a new ${humanReadableName}`
53
+ : currentPath?.summary,
41
54
  description: `Creates a new ${humanReadableName} record in the system`,
42
55
  operationId: `create${pascalModelName}`,
43
- requestBody: {
56
+ requestBody: currentPath?.requestBody || {
44
57
  description: `${humanReadableName} data to create`,
45
58
  required: true,
46
59
  content: {
@@ -52,7 +65,8 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
52
65
  },
53
66
  },
54
67
  responses: {
55
- "201": {
68
+ ...(currentPath?.responses || {}),
69
+ "201": currentPath?.responses?.["201"] || {
56
70
  description: `${humanReadableName} created successfully`,
57
71
  content: {
58
72
  "application/json": {
@@ -62,75 +76,70 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
62
76
  },
63
77
  },
64
78
  },
65
- "400": {
79
+ "400": currentPath?.responses?.["400"] || {
66
80
  description: "Invalid input data provided",
67
81
  },
68
- "401": {
69
- description: "Authentication required",
70
- },
71
- "403": {
72
- description: "Insufficient permissions",
73
- },
82
+ ...getAuthErrorResponses(),
74
83
  },
75
84
  security: [{ BearerAuth: [] }],
76
85
  };
86
+ paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
77
87
  }
78
88
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "findMany")) {
79
- if (!paths[`/api/${routeName}`])
80
- paths[`/api/${routeName}`] = {};
89
+ const pathname = `/api/${routeName}`;
90
+ if (!paths[pathname])
91
+ paths[pathname] = {};
81
92
  const findManyMode = getSchemaMode("findMany");
82
- paths[`/api/${routeName}`].get = {
83
- tags: [humanReadableNamePlural],
84
- summary: `Get ${humanReadableNamePlural}`,
93
+ const currentPath = paths[pathname].get;
94
+ const defaultParameters = [
95
+ {
96
+ name: "filters",
97
+ in: "query",
98
+ description: "Filter criteria in JSON format",
99
+ schema: { type: "string" },
100
+ },
101
+ {
102
+ name: "sort",
103
+ in: "query",
104
+ description: "Sort field (prefix with '-' for descending order)",
105
+ schema: { type: "string" },
106
+ },
107
+ {
108
+ name: "page",
109
+ in: "query",
110
+ description: "Page number (starts from 1)",
111
+ schema: { type: "integer", minimum: 1 },
112
+ },
113
+ {
114
+ name: "limit",
115
+ in: "query",
116
+ description: "Number of items per page",
117
+ schema: { type: "integer", minimum: 1, maximum: 100 },
118
+ },
119
+ {
120
+ name: "fields",
121
+ in: "query",
122
+ description: "Comma-separated list of fields to include in response",
123
+ schema: { type: "string" },
124
+ },
125
+ ];
126
+ const existingParams = currentPath?.parameters || [];
127
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
128
+ const mergedParameters = [
129
+ ...existingParams,
130
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
131
+ ];
132
+ const defaultSpec = {
133
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
134
+ summary: currentPath?.summary === pathname || !currentPath?.summary
135
+ ? `Get ${humanReadableNamePlural}`
136
+ : currentPath?.summary,
85
137
  description: `Retrieves a paginated list of ${humanReadableNamePlural} with optional filtering and sorting`,
86
138
  operationId: `find${pluralize_1.default.plural(pascalModelName)}`,
87
- parameters: [
88
- {
89
- name: "filters",
90
- in: "query",
91
- description: "Filter criteria in JSON format",
92
- schema: {
93
- type: "string",
94
- },
95
- },
96
- {
97
- name: "sort",
98
- in: "query",
99
- description: "Sort field (prefix with '-' for descending order)",
100
- schema: {
101
- type: "string",
102
- },
103
- },
104
- {
105
- name: "page",
106
- in: "query",
107
- description: "Page number (starts from 1)",
108
- schema: {
109
- type: "integer",
110
- minimum: 1,
111
- },
112
- },
113
- {
114
- name: "limit",
115
- in: "query",
116
- description: "Number of items per page",
117
- schema: {
118
- type: "integer",
119
- minimum: 1,
120
- maximum: 100,
121
- },
122
- },
123
- {
124
- name: "fields",
125
- in: "query",
126
- description: "Comma-separated list of fields to include in response",
127
- schema: {
128
- type: "string",
129
- },
130
- },
131
- ],
139
+ parameters: mergedParameters,
132
140
  responses: {
133
- "200": {
141
+ ...(currentPath?.responses || {}),
142
+ "200": currentPath?.responses?.["200"] || {
134
143
  description: `List of ${humanReadableNamePlural} retrieved successfully`,
135
144
  content: {
136
145
  "application/json": {
@@ -156,90 +165,96 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
156
165
  },
157
166
  },
158
167
  },
159
- "401": {
160
- description: "Authentication required",
161
- },
162
- "403": {
163
- description: "Insufficient permissions",
164
- },
168
+ ...getAuthErrorResponses(),
165
169
  },
166
170
  security: [{ BearerAuth: [] }],
167
171
  };
172
+ paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
168
173
  }
169
174
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "createMany")) {
175
+ const pathname = `/api/${routeName}/many`;
176
+ if (!paths[pathname])
177
+ paths[pathname] = {};
170
178
  const createManyMode = getSchemaMode("createMany");
171
- paths[`/api/${routeName}/many`] = {
172
- post: {
173
- tags: [humanReadableNamePlural],
174
- summary: `Create multiple ${humanReadableNamePlural}`,
175
- description: `Creates multiple ${humanReadableNamePlural} records in a single batch operation`,
176
- operationId: `createMany${pascalModelName}`,
177
- requestBody: {
178
- description: `Array of ${humanReadableName} data to create`,
179
- required: true,
180
- content: {
181
- "application/json": {
182
- schema: {
183
- type: "array",
184
- items: {
185
- $ref: (0, swagger_router_helpers_1.getSchemaRef)(`CreateMany${pascalModelName}`, createManyMode),
186
- },
179
+ const currentPath = paths[pathname].post;
180
+ const defaultSpec = {
181
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
182
+ summary: currentPath?.summary === pathname || !currentPath?.summary
183
+ ? `Create multiple ${humanReadableNamePlural}`
184
+ : currentPath?.summary,
185
+ description: `Creates multiple ${humanReadableNamePlural} records in a single batch operation`,
186
+ operationId: `createMany${pascalModelName}`,
187
+ requestBody: currentPath?.requestBody || {
188
+ description: `Array of ${humanReadableName} data to create`,
189
+ required: true,
190
+ content: {
191
+ "application/json": {
192
+ schema: {
193
+ type: "array",
194
+ items: {
195
+ $ref: (0, swagger_router_helpers_1.getSchemaRef)(`CreateMany${pascalModelName}`, createManyMode),
187
196
  },
188
197
  },
189
198
  },
190
199
  },
191
- responses: {
192
- "201": {
193
- description: `${humanReadableNamePlural} created successfully`,
194
- content: {
195
- "application/json": {
196
- schema: {
197
- type: "object",
198
- properties: {
199
- count: {
200
- type: "integer",
201
- description: "Number of records created",
202
- },
200
+ },
201
+ responses: {
202
+ ...(currentPath?.responses || {}),
203
+ "201": currentPath?.responses?.["201"] || {
204
+ description: `${humanReadableNamePlural} created successfully`,
205
+ content: {
206
+ "application/json": {
207
+ schema: {
208
+ type: "object",
209
+ properties: {
210
+ count: {
211
+ type: "integer",
212
+ description: "Number of records created",
203
213
  },
204
214
  },
205
215
  },
206
216
  },
207
217
  },
208
- "400": {
209
- description: "Invalid input data provided",
210
- },
211
- "401": {
212
- description: "Authentication required",
213
- },
214
- "403": {
215
- description: "Insufficient permissions",
216
- },
217
218
  },
218
- security: [{ BearerAuth: [] }],
219
+ "400": currentPath?.responses?.["400"] || {
220
+ description: "Invalid input data provided",
221
+ },
222
+ ...getAuthErrorResponses(),
219
223
  },
224
+ security: [{ BearerAuth: [] }],
220
225
  };
226
+ paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
221
227
  }
222
228
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "updateMany")) {
223
- if (!paths[`/api/${routeName}/many`])
224
- paths[`/api/${routeName}/many`] = {};
229
+ const pathname = `/api/${routeName}/many`;
230
+ if (!paths[pathname])
231
+ paths[pathname] = {};
225
232
  const updateManyMode = getSchemaMode("updateMany");
226
- paths[`/api/${routeName}/many`].patch = {
227
- tags: [humanReadableNamePlural],
228
- summary: `Update multiple ${humanReadableNamePlural}`,
233
+ const currentPath = paths[pathname].patch;
234
+ const defaultParameters = [
235
+ {
236
+ name: "filters",
237
+ in: "query",
238
+ description: "Filter criteria in JSON format (required)",
239
+ required: true,
240
+ schema: { type: "string" },
241
+ },
242
+ ];
243
+ const existingParams = currentPath?.parameters || [];
244
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
245
+ const mergedParameters = [
246
+ ...existingParams,
247
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
248
+ ];
249
+ const defaultSpec = {
250
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
251
+ summary: currentPath?.summary === pathname || !currentPath?.summary
252
+ ? `Update multiple ${humanReadableNamePlural}`
253
+ : currentPath?.summary,
229
254
  description: `Updates multiple ${humanReadableNamePlural} records that match the specified filter criteria`,
230
255
  operationId: `updateMany${pascalModelName}`,
231
- parameters: [
232
- {
233
- name: "filters",
234
- in: "query",
235
- description: "Filter criteria in JSON format (required)",
236
- required: true,
237
- schema: {
238
- type: "string",
239
- },
240
- },
241
- ],
242
- requestBody: {
256
+ parameters: mergedParameters,
257
+ requestBody: currentPath?.requestBody || {
243
258
  description: `Partial ${humanReadableName} data to update`,
244
259
  required: true,
245
260
  content: {
@@ -251,7 +266,8 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
251
266
  },
252
267
  },
253
268
  responses: {
254
- "200": {
269
+ ...(currentPath?.responses || {}),
270
+ "200": currentPath?.responses?.["200"] || {
255
271
  description: `${humanReadableNamePlural} updated successfully`,
256
272
  content: {
257
273
  "application/json": {
@@ -267,40 +283,46 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
267
283
  },
268
284
  },
269
285
  },
270
- "400": {
286
+ "400": currentPath?.responses?.["400"] || {
271
287
  description: "Invalid input data or missing filter criteria",
272
288
  },
273
- "401": {
274
- description: "Authentication required",
275
- },
276
- "403": {
277
- description: "Insufficient permissions",
278
- },
289
+ ...getAuthErrorResponses(),
279
290
  },
280
291
  security: [{ BearerAuth: [] }],
281
292
  };
293
+ paths[pathname].patch = { ...(currentPath || {}), ...defaultSpec };
282
294
  }
283
295
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "deleteMany")) {
284
- if (!paths[`/api/${routeName}/many`])
285
- paths[`/api/${routeName}/many`] = {};
286
- paths[`/api/${routeName}/many`].delete = {
287
- tags: [humanReadableNamePlural],
288
- summary: `Delete multiple ${humanReadableNamePlural}`,
296
+ const pathname = `/api/${routeName}/many`;
297
+ if (!paths[pathname])
298
+ paths[pathname] = {};
299
+ const currentPath = paths[pathname].delete;
300
+ const defaultParameters = [
301
+ {
302
+ name: "filters",
303
+ in: "query",
304
+ description: "Filter criteria in JSON format (required)",
305
+ required: true,
306
+ schema: { type: "string" },
307
+ },
308
+ ];
309
+ const existingParams = currentPath?.parameters || [];
310
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
311
+ const mergedParameters = [
312
+ ...existingParams,
313
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
314
+ ];
315
+ const defaultSpec = {
316
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
317
+ summary: currentPath?.summary === pathname || !currentPath?.summary
318
+ ? `Delete multiple ${humanReadableNamePlural}`
319
+ : currentPath?.summary,
289
320
  description: `Deletes multiple ${humanReadableNamePlural} records that match the specified filter criteria`,
290
321
  operationId: `deleteMany${pascalModelName}`,
291
- parameters: [
292
- {
293
- name: "filters",
294
- in: "query",
295
- description: "Filter criteria in JSON format (required)",
296
- required: true,
297
- schema: {
298
- type: "string",
299
- },
300
- },
301
- ],
322
+ parameters: mergedParameters,
302
323
  responses: {
303
- "200": {
324
+ ...(currentPath?.responses || {}),
325
+ "200": currentPath?.responses?.["200"] || {
304
326
  description: `${humanReadableNamePlural} deleted successfully`,
305
327
  content: {
306
328
  "application/json": {
@@ -316,84 +338,95 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
316
338
  },
317
339
  },
318
340
  },
319
- "400": {
341
+ "400": currentPath?.responses?.["400"] || {
320
342
  description: "Missing filter criteria",
321
343
  },
322
- "401": {
323
- description: "Authentication required",
324
- },
325
- "403": {
326
- description: "Insufficient permissions",
327
- },
344
+ ...getAuthErrorResponses(),
328
345
  },
329
346
  security: [{ BearerAuth: [] }],
330
347
  };
348
+ paths[pathname].delete = { ...(currentPath || {}), ...defaultSpec };
331
349
  }
332
350
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "findOne")) {
351
+ const pathname = `/api/${routeName}/{id}`;
352
+ if (!paths[pathname])
353
+ paths[pathname] = {};
333
354
  const findOneMode = getSchemaMode("findOne");
334
- paths[`/api/${routeName}/{id}`] = {
335
- get: {
336
- tags: [humanReadableNamePlural],
337
- summary: `Get ${humanReadableName} by ID`,
338
- description: `Retrieves a single ${humanReadableName} record by its unique identifier`,
339
- operationId: `find${pascalModelName}ById`,
340
- parameters: [
341
- {
342
- name: "id",
343
- in: "path",
344
- description: `Unique identifier of the ${humanReadableName}`,
345
- required: true,
346
- schema: {
347
- type: "string",
348
- },
349
- },
350
- ],
351
- responses: {
352
- "200": {
353
- description: `${humanReadableName} retrieved successfully`,
354
- content: {
355
- "application/json": {
356
- schema: {
357
- $ref: (0, swagger_router_helpers_1.getSchemaRef)(`FindOne${pascalModelName}`, findOneMode),
358
- },
355
+ const currentPath = paths[pathname].get;
356
+ const defaultParameters = [
357
+ {
358
+ name: "id",
359
+ in: "path",
360
+ description: `Unique identifier of the ${humanReadableName}`,
361
+ required: true,
362
+ schema: { type: "string" },
363
+ },
364
+ ];
365
+ const existingParams = currentPath?.parameters || [];
366
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
367
+ const mergedParameters = [
368
+ ...existingParams,
369
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
370
+ ];
371
+ const defaultSpec = {
372
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
373
+ summary: currentPath?.summary === pathname || !currentPath?.summary
374
+ ? `Get ${humanReadableName} by ID`
375
+ : currentPath?.summary,
376
+ description: `Retrieves a single ${humanReadableName} record by its unique identifier`,
377
+ operationId: `find${pascalModelName}ById`,
378
+ parameters: mergedParameters,
379
+ responses: {
380
+ ...(currentPath?.responses || {}),
381
+ "200": currentPath?.responses?.["200"] || {
382
+ description: `${humanReadableName} retrieved successfully`,
383
+ content: {
384
+ "application/json": {
385
+ schema: {
386
+ $ref: (0, swagger_router_helpers_1.getSchemaRef)(`FindOne${pascalModelName}`, findOneMode),
359
387
  },
360
388
  },
361
389
  },
362
- "401": {
363
- description: "Authentication required",
364
- },
365
- "403": {
366
- description: "Insufficient permissions",
367
- },
368
- "404": {
369
- description: `${humanReadableName} not found`,
370
- },
371
390
  },
372
- security: [{ BearerAuth: [] }],
391
+ ...getAuthErrorResponses(),
392
+ "404": currentPath?.responses?.["404"] || {
393
+ description: `${humanReadableName} not found`,
394
+ },
373
395
  },
396
+ security: [{ BearerAuth: [] }],
374
397
  };
398
+ paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
375
399
  }
376
400
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "updateOne")) {
377
- if (!paths[`/api/${routeName}/{id}`])
378
- paths[`/api/${routeName}/{id}`] = {};
401
+ const pathname = `/api/${routeName}/{id}`;
402
+ if (!paths[pathname])
403
+ paths[pathname] = {};
379
404
  const updateMode = getSchemaMode("update");
380
- paths[`/api/${routeName}/{id}`].patch = {
381
- tags: [humanReadableNamePlural],
382
- summary: `Update ${humanReadableName} by ID`,
405
+ const currentPath = paths[pathname].patch;
406
+ const defaultParameters = [
407
+ {
408
+ name: "id",
409
+ in: "path",
410
+ description: `Unique identifier of the ${humanReadableName}`,
411
+ required: true,
412
+ schema: { type: "string" },
413
+ },
414
+ ];
415
+ const existingParams = currentPath?.parameters || [];
416
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
417
+ const mergedParameters = [
418
+ ...existingParams,
419
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
420
+ ];
421
+ const defaultSpec = {
422
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
423
+ summary: currentPath?.summary === pathname || !currentPath?.summary
424
+ ? `Update ${humanReadableName} by ID`
425
+ : currentPath?.summary,
383
426
  description: `Updates a single ${humanReadableName} record by its unique identifier`,
384
427
  operationId: `update${pascalModelName}`,
385
- parameters: [
386
- {
387
- name: "id",
388
- in: "path",
389
- description: `Unique identifier of the ${humanReadableName}`,
390
- required: true,
391
- schema: {
392
- type: "string",
393
- },
394
- },
395
- ],
396
- requestBody: {
428
+ parameters: mergedParameters,
429
+ requestBody: currentPath?.requestBody || {
397
430
  description: `Partial ${humanReadableName} data to update`,
398
431
  required: true,
399
432
  content: {
@@ -405,7 +438,8 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
405
438
  },
406
439
  },
407
440
  responses: {
408
- "200": {
441
+ ...(currentPath?.responses || {}),
442
+ "200": currentPath?.responses?.["200"] || {
409
443
  description: `${humanReadableName} updated successfully`,
410
444
  content: {
411
445
  "application/json": {
@@ -415,57 +449,60 @@ function generatePrismaModelMainRoutesPaths(model, paths = {}, arkosConfig) {
415
449
  },
416
450
  },
417
451
  },
418
- "400": {
452
+ "400": currentPath?.responses?.["400"] || {
419
453
  description: "Invalid input data provided",
420
454
  },
421
- "401": {
422
- description: "Authentication required",
423
- },
424
- "403": {
425
- description: "Insufficient permissions",
426
- },
427
- "404": {
455
+ ...getAuthErrorResponses(),
456
+ "404": currentPath?.responses?.["404"] || {
428
457
  description: `${humanReadableName} not found`,
429
458
  },
430
459
  },
431
460
  security: [{ BearerAuth: [] }],
432
461
  };
462
+ paths[pathname].patch = { ...(currentPath || {}), ...defaultSpec };
433
463
  }
434
464
  if (!(0, base_router_helpers_1.isEndpointDisabled)(routerConfig, "deleteOne")) {
435
- if (!paths[`/api/${routeName}/{id}`])
436
- paths[`/api/${routeName}/{id}`] = {};
437
- paths[`/api/${routeName}/{id}`].delete = {
438
- tags: [humanReadableNamePlural],
439
- summary: `Delete ${humanReadableName} by ID`,
465
+ const pathname = `/api/${routeName}/{id}`;
466
+ if (!paths[pathname])
467
+ paths[pathname] = {};
468
+ const currentPath = paths[pathname].delete;
469
+ const defaultParameters = [
470
+ {
471
+ name: "id",
472
+ in: "path",
473
+ description: `Unique identifier of the ${humanReadableName}`,
474
+ required: true,
475
+ schema: { type: "string" },
476
+ },
477
+ ];
478
+ const existingParams = currentPath?.parameters || [];
479
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
480
+ const mergedParameters = [
481
+ ...existingParams,
482
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
483
+ ];
484
+ const defaultSpec = {
485
+ tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
486
+ summary: currentPath?.summary === pathname || !currentPath?.summary
487
+ ? `Delete ${humanReadableName} by ID`
488
+ : currentPath?.summary,
440
489
  description: `Permanently deletes a single ${humanReadableName} record by its unique identifier`,
441
490
  operationId: `delete${pascalModelName}`,
442
- parameters: [
443
- {
444
- name: "id",
445
- in: "path",
446
- description: `Unique identifier of the ${humanReadableName}`,
447
- required: true,
448
- schema: {
449
- type: "string",
450
- },
451
- },
452
- ],
491
+ parameters: mergedParameters,
453
492
  responses: {
454
- "204": {
493
+ ...(currentPath?.responses || {}),
494
+ "204": currentPath?.responses?.["204"] || {
455
495
  description: `${humanReadableName} deleted successfully`,
456
496
  },
457
- "401": {
458
- description: "Authentication required",
459
- },
460
- "403": {
461
- description: "Insufficient permissions",
462
- },
463
- "404": {
497
+ ...getAuthErrorResponses(),
498
+ "404": currentPath?.responses?.["404"] || {
464
499
  description: `${humanReadableName} not found`,
465
500
  },
466
501
  },
467
502
  security: [{ BearerAuth: [] }],
468
503
  };
504
+ paths[pathname].delete = { ...(currentPath || {}), ...defaultSpec };
469
505
  }
506
+ return paths;
470
507
  }
471
508
  //# sourceMappingURL=generate-prisma-model-main-routes-paths.js.map