arkos 1.4.0-canary.92 → 1.4.1-beta

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 (170) 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 +3 -4
  7. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  8. package/dist/cjs/modules/auth/utils/services/auth-action.service.js +56 -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 +17 -5
  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 +326 -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 +374 -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/missing-json-schemas-generator.js +3 -0
  30. package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
  31. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
  32. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
  33. package/dist/cjs/server.js +17 -15
  34. package/dist/cjs/server.js.map +1 -1
  35. package/dist/cjs/types/index.js.map +1 -1
  36. package/dist/cjs/types/new-arkos-config.js.map +1 -1
  37. package/dist/cjs/utils/arkos-router/index.js +50 -10
  38. package/dist/cjs/utils/arkos-router/index.js.map +1 -1
  39. package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
  40. package/dist/cjs/utils/arkos-router/utils/helpers/index.js +11 -0
  41. package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
  42. package/dist/cjs/utils/cli/dev.js +13 -55
  43. package/dist/cjs/utils/cli/dev.js.map +1 -1
  44. package/dist/cjs/utils/cli/export-auth-action.js +1 -1
  45. package/dist/cjs/utils/cli/export-auth-action.js.map +1 -1
  46. package/dist/cjs/utils/cli/generate.js +3 -3
  47. package/dist/cjs/utils/cli/generate.js.map +1 -1
  48. package/dist/cjs/utils/cli/index.js +1 -1
  49. package/dist/cjs/utils/cli/index.js.map +1 -1
  50. package/dist/cjs/utils/cli/start.js +19 -12
  51. package/dist/cjs/utils/cli/start.js.map +1 -1
  52. package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
  53. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +51 -6
  54. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  55. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
  56. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
  57. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
  58. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
  59. package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
  60. package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
  61. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +3 -1
  62. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  63. package/dist/cjs/utils/dotenv.helpers.js +15 -7
  64. package/dist/cjs/utils/dotenv.helpers.js.map +1 -1
  65. package/dist/cjs/utils/helpers/api.features.helpers.js +174 -81
  66. package/dist/cjs/utils/helpers/api.features.helpers.js.map +1 -1
  67. package/dist/cjs/utils/helpers/prisma.helpers.js +40 -1
  68. package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
  69. package/dist/cjs/utils/helpers/routers.helpers.js +0 -1
  70. package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
  71. package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +19 -4
  72. package/dist/cjs/utils/prisma/prisma-json-schema-generator.js.map +1 -1
  73. package/dist/cjs/utils/validate-dto.js +1 -5
  74. package/dist/cjs/utils/validate-dto.js.map +1 -1
  75. package/dist/cjs/utils/validate-schema.js +2 -7
  76. package/dist/cjs/utils/validate-schema.js.map +1 -1
  77. package/dist/esm/app.js +1 -1
  78. package/dist/esm/app.js.map +1 -1
  79. package/dist/esm/exports/index.js.map +1 -1
  80. package/dist/esm/modules/auth/auth.controller.js +1 -1
  81. package/dist/esm/modules/auth/auth.controller.js.map +1 -1
  82. package/dist/esm/modules/auth/auth.service.js +4 -5
  83. package/dist/esm/modules/auth/auth.service.js.map +1 -1
  84. package/dist/esm/modules/auth/utils/services/auth-action.service.js +56 -5
  85. package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
  86. package/dist/esm/modules/base/base.controller.js +6 -3
  87. package/dist/esm/modules/base/base.controller.js.map +1 -1
  88. package/dist/esm/modules/base/base.middlewares.js +17 -5
  89. package/dist/esm/modules/base/base.middlewares.js.map +1 -1
  90. package/dist/esm/modules/error-handler/error-handler.controller.js +2 -2
  91. package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
  92. package/dist/esm/modules/error-handler/utils/catch-async.js.map +1 -1
  93. package/dist/esm/modules/swagger/swagger.router.js +6 -4
  94. package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
  95. package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js +5 -0
  96. package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
  97. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +326 -183
  98. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  99. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +374 -288
  100. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  101. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
  102. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  103. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
  104. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
  105. package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js +3 -0
  106. package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
  107. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
  108. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
  109. package/dist/esm/server.js +17 -15
  110. package/dist/esm/server.js.map +1 -1
  111. package/dist/esm/types/index.js.map +1 -1
  112. package/dist/esm/types/new-arkos-config.js.map +1 -1
  113. package/dist/esm/utils/arkos-router/index.js +51 -11
  114. package/dist/esm/utils/arkos-router/index.js.map +1 -1
  115. package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
  116. package/dist/esm/utils/arkos-router/utils/helpers/index.js +10 -0
  117. package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
  118. package/dist/esm/utils/cli/dev.js +14 -56
  119. package/dist/esm/utils/cli/dev.js.map +1 -1
  120. package/dist/esm/utils/cli/export-auth-action.js +1 -1
  121. package/dist/esm/utils/cli/export-auth-action.js.map +1 -1
  122. package/dist/esm/utils/cli/generate.js +3 -3
  123. package/dist/esm/utils/cli/generate.js.map +1 -1
  124. package/dist/esm/utils/cli/index.js +1 -1
  125. package/dist/esm/utils/cli/index.js.map +1 -1
  126. package/dist/esm/utils/cli/start.js +19 -12
  127. package/dist/esm/utils/cli/start.js.map +1 -1
  128. package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
  129. package/dist/esm/utils/cli/utils/runtime-cli-commander.js +52 -7
  130. package/dist/esm/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  131. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
  132. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
  133. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
  134. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
  135. package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
  136. package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
  137. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +3 -1
  138. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  139. package/dist/esm/utils/dotenv.helpers.js +15 -7
  140. package/dist/esm/utils/dotenv.helpers.js.map +1 -1
  141. package/dist/esm/utils/helpers/api.features.helpers.js +174 -81
  142. package/dist/esm/utils/helpers/api.features.helpers.js.map +1 -1
  143. package/dist/esm/utils/helpers/prisma.helpers.js +39 -1
  144. package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -1
  145. package/dist/esm/utils/helpers/routers.helpers.js +0 -1
  146. package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
  147. package/dist/esm/utils/prisma/prisma-json-schema-generator.js +19 -4
  148. package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -1
  149. package/dist/esm/utils/validate-dto.js +1 -2
  150. package/dist/esm/utils/validate-dto.js.map +1 -1
  151. package/dist/esm/utils/validate-schema.js +2 -4
  152. package/dist/esm/utils/validate-schema.js.map +1 -1
  153. package/dist/types/exports/index.d.ts +2 -1
  154. package/dist/types/modules/auth/auth.router.d.ts +1 -1
  155. package/dist/types/modules/auth/auth.service.d.ts +2 -2
  156. package/dist/types/modules/base/base.router.d.ts +1 -1
  157. package/dist/types/modules/swagger/utils/built-in-route-path-object-manager.d.ts +4 -0
  158. package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +1 -1
  159. package/dist/types/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.d.ts +1 -1
  160. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.d.ts +1 -1
  161. package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +1 -1
  162. package/dist/types/types/index.d.ts +5 -5
  163. package/dist/types/types/new-arkos-config.d.ts +1 -1
  164. package/dist/types/utils/arkos-router/index.d.ts +2 -1
  165. package/dist/types/utils/arkos-router/types/index.d.ts +15 -14
  166. package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +1 -0
  167. package/dist/types/utils/cli/dev.d.ts +1 -1
  168. package/dist/types/utils/cli/start.d.ts +1 -1
  169. package/dist/types/utils/helpers/prisma.helpers.d.ts +1 -0
  170. package/package.json +2 -2
@@ -14,8 +14,8 @@ export const getSchemaMode = (action, arkosConfig) => {
14
14
  return "prisma";
15
15
  return swaggerMode;
16
16
  };
17
- export default function getAuthenticationJsonSchemaPaths(arkosConfig) {
18
- const paths = {};
17
+ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPaths) {
18
+ const paths = { ...existingPaths };
19
19
  if (!arkosConfig.swagger?.mode)
20
20
  return paths;
21
21
  const AuthModuleComponents = getModuleComponents("auth");
@@ -27,201 +27,251 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig) {
27
27
  return isEndpointDisabled(routerConfig, endpoint);
28
28
  };
29
29
  if (!isAuthEndpointDisabled("login")) {
30
+ const pathname = "/api/auth/login";
31
+ if (!paths[pathname])
32
+ paths[pathname] = {};
30
33
  const loginMode = getSchemaMode("login", arkosConfig);
31
- paths["/api/auth/login"] = {
32
- post: {
33
- tags: ["Authentication"],
34
- summary: "Login to the system",
35
- description: "Authenticates a user and returns an access token",
36
- operationId: "login",
37
- requestBody: {
38
- description: "User credentials",
39
- required: true,
40
- content: {
41
- "application/json": {
42
- schema: {
43
- $ref: getSchemaRef("Login", loginMode),
44
- },
34
+ const currentPath = paths[pathname].post;
35
+ const defaultSpec = {
36
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
37
+ summary: currentPath?.summary === pathname || !currentPath?.summary
38
+ ? "Login to the system"
39
+ : currentPath?.summary,
40
+ description: currentPath?.description ||
41
+ "Authenticates a user and returns an access token",
42
+ operationId: currentPath?.operationId?.includes(pathname)
43
+ ? "login"
44
+ : currentPath?.operationId,
45
+ requestBody: currentPath?.requestBody || {
46
+ description: "User credentials",
47
+ required: true,
48
+ content: {
49
+ "application/json": {
50
+ schema: {
51
+ $ref: getSchemaRef("Login", loginMode),
45
52
  },
46
53
  },
47
54
  },
48
- responses: {
49
- "200": {
50
- description: "Login successful",
51
- content: {
52
- "application/json": {
53
- schema: {
54
- type: "object",
55
- properties: {
56
- accessToken: {
57
- type: "string",
58
- description: "JWT access token",
59
- },
55
+ },
56
+ responses: {
57
+ ...(currentPath?.responses || {}),
58
+ "200": currentPath?.responses?.["200"] || {
59
+ description: "Login successful",
60
+ content: {
61
+ "application/json": {
62
+ schema: {
63
+ type: "object",
64
+ properties: {
65
+ accessToken: {
66
+ type: "string",
67
+ description: "JWT access token",
60
68
  },
61
69
  },
62
70
  },
63
71
  },
64
72
  },
65
- "400": {
66
- description: "Invalid input data",
67
- },
68
- "401": {
69
- description: "Invalid credentials",
70
- },
73
+ },
74
+ "400": currentPath?.responses?.["400"] || {
75
+ description: "Invalid input data",
76
+ },
77
+ "401": currentPath?.responses?.["401"] || {
78
+ description: "Invalid credentials",
71
79
  },
72
80
  },
73
81
  };
82
+ paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
74
83
  }
75
84
  if (!isAuthEndpointDisabled("logout")) {
76
- paths["/api/auth/logout"] = {
77
- delete: {
78
- tags: ["Authentication"],
79
- summary: "Logout from the system",
80
- description: "Invalidates the current user's JWT token",
81
- operationId: "logout",
82
- security: [{ BearerAuth: [] }],
83
- responses: {
84
- "204": {
85
- description: "Logout successful",
86
- },
87
- "401": {
88
- description: "Authentication required",
89
- },
85
+ const pathname = "/api/auth/logout";
86
+ if (!paths[pathname])
87
+ paths[pathname] = {};
88
+ const currentPath = paths[pathname].delete;
89
+ const defaultSpec = {
90
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
91
+ summary: currentPath?.summary === pathname || !currentPath?.summary
92
+ ? "Logout from the system"
93
+ : currentPath?.summary,
94
+ description: currentPath?.description || "Invalidates the current user's JWT token",
95
+ operationId: currentPath?.operationId?.includes(pathname)
96
+ ? "logout"
97
+ : currentPath?.operationId,
98
+ security: [{ BearerAuth: [] }],
99
+ responses: {
100
+ ...(currentPath?.responses || {}),
101
+ "204": currentPath?.responses?.["204"] || {
102
+ description: "Logout successful",
103
+ },
104
+ "401": currentPath?.responses?.["401"] || {
105
+ description: "Authentication required",
90
106
  },
91
107
  },
92
108
  };
109
+ paths[pathname].delete = { ...(currentPath || {}), ...defaultSpec };
93
110
  }
94
111
  if (!isAuthEndpointDisabled("signup")) {
112
+ const pathname = "/api/auth/signup";
113
+ if (!paths[pathname])
114
+ paths[pathname] = {};
95
115
  const signupMode = getSchemaMode("signup", arkosConfig);
96
116
  const userMode = getSchemaMode("user", arkosConfig);
97
- paths["/api/auth/signup"] = {
98
- post: {
99
- tags: ["Authentication"],
100
- summary: "Register a new user",
101
- description: "Creates a new user account",
102
- operationId: "signup",
103
- requestBody: {
104
- description: "User registration data",
105
- required: true,
117
+ const currentPath = paths[pathname].post;
118
+ const defaultSpec = {
119
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
120
+ summary: currentPath?.summary === pathname || !currentPath?.summary
121
+ ? "Register a new user"
122
+ : currentPath?.summary,
123
+ description: currentPath?.description || "Creates a new user account",
124
+ operationId: currentPath?.operationId?.includes(pathname)
125
+ ? "signup"
126
+ : currentPath?.operationId,
127
+ requestBody: currentPath?.requestBody || {
128
+ description: "User registration data",
129
+ required: true,
130
+ content: {
131
+ "application/json": {
132
+ schema: {
133
+ $ref: getSchemaRef("Signup", signupMode),
134
+ },
135
+ },
136
+ },
137
+ },
138
+ responses: {
139
+ ...(currentPath?.responses || {}),
140
+ "201": currentPath?.responses?.["201"] || {
141
+ description: "User created successfully",
106
142
  content: {
107
143
  "application/json": {
108
144
  schema: {
109
- $ref: getSchemaRef("Signup", signupMode),
145
+ $ref: getSchemaRef("User", userMode),
110
146
  },
111
147
  },
112
148
  },
113
149
  },
114
- responses: {
115
- "201": {
116
- description: "User created successfully",
117
- content: {
118
- "application/json": {
119
- schema: {
120
- $ref: getSchemaRef("User", userMode),
121
- },
122
- },
123
- },
124
- },
125
- "400": {
126
- description: "Invalid input data",
127
- },
128
- "409": {
129
- description: "User already exists",
130
- },
150
+ "400": currentPath?.responses?.["400"] || {
151
+ description: "Invalid input data",
152
+ },
153
+ "409": currentPath?.responses?.["409"] || {
154
+ description: "User already exists",
131
155
  },
132
156
  },
133
157
  };
158
+ paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
134
159
  }
135
160
  if (!isAuthEndpointDisabled("updatePassword")) {
161
+ const pathname = "/api/auth/update-password";
162
+ if (!paths[pathname])
163
+ paths[pathname] = {};
136
164
  const updatePasswordMode = getSchemaMode("updatePassword", arkosConfig);
137
- paths["/api/auth/update-password"] = {
138
- post: {
139
- tags: ["Authentication"],
140
- summary: "Update user password",
141
- description: "Changes the password for the authenticated user",
142
- operationId: "updatePassword",
143
- security: [{ BearerAuth: [] }],
144
- requestBody: {
145
- description: "Current and new password",
146
- required: true,
147
- content: {
148
- "application/json": {
149
- schema: {
150
- $ref: getSchemaRef("UpdatePassword", updatePasswordMode),
151
- },
165
+ const currentPath = paths[pathname].post;
166
+ const defaultSpec = {
167
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
168
+ summary: currentPath?.summary === pathname || !currentPath?.summary
169
+ ? "Update user password"
170
+ : currentPath?.summary,
171
+ description: currentPath?.description ||
172
+ "Changes the password for the authenticated user",
173
+ operationId: currentPath?.operationId?.includes(pathname)
174
+ ? "updatePassword"
175
+ : currentPath?.operationId,
176
+ security: [{ BearerAuth: [] }],
177
+ requestBody: currentPath?.requestBody || {
178
+ description: "Current and new password",
179
+ required: true,
180
+ content: {
181
+ "application/json": {
182
+ schema: {
183
+ $ref: getSchemaRef("UpdatePassword", updatePasswordMode),
152
184
  },
153
185
  },
154
186
  },
155
- responses: {
156
- "200": {
157
- description: "Password updated successfully",
158
- content: {
159
- "application/json": {
160
- schema: {
161
- type: "object",
162
- properties: {
163
- status: {
164
- type: "string",
165
- example: "success",
166
- },
167
- message: {
168
- type: "string",
169
- example: "Password updated successfully!",
170
- },
187
+ },
188
+ responses: {
189
+ ...(currentPath?.responses || {}),
190
+ "200": currentPath?.responses?.["200"] || {
191
+ description: "Password updated successfully",
192
+ content: {
193
+ "application/json": {
194
+ schema: {
195
+ type: "object",
196
+ properties: {
197
+ status: {
198
+ type: "string",
199
+ example: "success",
200
+ },
201
+ message: {
202
+ type: "string",
203
+ example: "Password updated successfully!",
171
204
  },
172
205
  },
173
206
  },
174
207
  },
175
208
  },
176
- "400": {
177
- description: "Invalid input data or current password incorrect",
178
- },
179
- "401": {
180
- description: "Authentication required",
181
- },
209
+ },
210
+ "400": currentPath?.responses?.["400"] || {
211
+ description: "Invalid input data or current password incorrect",
212
+ },
213
+ "401": currentPath?.responses?.["401"] || {
214
+ description: "Authentication required",
182
215
  },
183
216
  },
184
217
  };
218
+ paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
185
219
  }
186
220
  if (!isAuthEndpointDisabled("getMe")) {
221
+ const pathname = "/api/users/me";
222
+ if (!paths[pathname])
223
+ paths[pathname] = {};
187
224
  const findMeMode = getSchemaMode("getMe", arkosConfig);
188
- paths["/api/users/me"] = {
189
- get: {
190
- tags: ["Authentication"],
191
- summary: "Get current user information",
192
- description: "Retrieves information about the currently authenticated user",
193
- operationId: "getMe",
194
- security: [{ BearerAuth: [] }],
195
- responses: {
196
- "200": {
197
- description: "User information retrieved successfully",
198
- content: {
199
- "application/json": {
200
- schema: {
201
- $ref: getSchemaRef("GetMe", findMeMode),
202
- },
225
+ const currentPath = paths[pathname].get;
226
+ const defaultSpec = {
227
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
228
+ summary: currentPath?.summary === pathname || !currentPath?.summary
229
+ ? "Get current user information"
230
+ : currentPath?.summary,
231
+ description: currentPath?.description ||
232
+ "Retrieves information about the currently authenticated user",
233
+ operationId: currentPath?.operationId?.includes(pathname)
234
+ ? "getMe"
235
+ : currentPath?.operationId,
236
+ security: [{ BearerAuth: [] }],
237
+ responses: {
238
+ ...(currentPath?.responses || {}),
239
+ "200": currentPath?.responses?.["200"] || {
240
+ description: "User information retrieved successfully",
241
+ content: {
242
+ "application/json": {
243
+ schema: {
244
+ $ref: getSchemaRef("GetMe", findMeMode),
203
245
  },
204
246
  },
205
247
  },
206
- "401": {
207
- description: "Authentication required",
208
- },
248
+ },
249
+ "401": currentPath?.responses?.["401"] || {
250
+ description: "Authentication required",
209
251
  },
210
252
  },
211
253
  };
254
+ paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
212
255
  }
213
256
  if (!isAuthEndpointDisabled("updateMe")) {
257
+ const pathname = "/api/users/me";
258
+ if (!paths[pathname])
259
+ paths[pathname] = {};
214
260
  const updateMeMode = getSchemaMode("updateMe", arkosConfig);
215
261
  const userMode = getSchemaMode("user", arkosConfig);
216
- if (!paths["/api/users/me"])
217
- paths["/api/users/me"] = {};
218
- paths["/api/users/me"].patch = {
219
- tags: ["Authentication"],
220
- summary: "Update current user information",
221
- description: "Updates information for the currently authenticated user",
222
- operationId: "updateMe",
262
+ const currentPath = paths[pathname].patch;
263
+ const defaultSpec = {
264
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
265
+ summary: currentPath?.summary === pathname || !currentPath?.summary
266
+ ? "Update current user information"
267
+ : currentPath?.summary,
268
+ description: currentPath?.description ||
269
+ "Updates information for the currently authenticated user",
270
+ operationId: currentPath?.operationId?.includes(pathname)
271
+ ? "updateMe"
272
+ : currentPath?.operationId,
223
273
  security: [{ BearerAuth: [] }],
224
- requestBody: {
274
+ requestBody: currentPath?.requestBody || {
225
275
  description: "User data to update",
226
276
  required: true,
227
277
  content: {
@@ -233,7 +283,8 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig) {
233
283
  },
234
284
  },
235
285
  responses: {
236
- "200": {
286
+ ...(currentPath?.responses || {}),
287
+ "200": currentPath?.responses?.["200"] || {
237
288
  description: "User updated successfully",
238
289
  content: {
239
290
  "application/json": {
@@ -243,26 +294,35 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig) {
243
294
  },
244
295
  },
245
296
  },
246
- "400": {
297
+ "400": currentPath?.responses?.["400"] || {
247
298
  description: "Invalid input data",
248
299
  },
249
- "401": {
300
+ "401": currentPath?.responses?.["401"] || {
250
301
  description: "Authentication required",
251
302
  },
252
303
  },
253
304
  };
305
+ paths[pathname].patch = { ...(currentPath || {}), ...defaultSpec };
254
306
  }
255
307
  if (!isAuthEndpointDisabled("deleteMe")) {
256
- if (!paths["/api/users/me"])
257
- paths["/api/users/me"] = {};
258
- paths["/api/users/me"].delete = {
259
- tags: ["Authentication"],
260
- summary: "Delete current user account",
261
- description: "Marks the current user's account as deleted",
262
- operationId: "deleteMe",
308
+ const pathname = "/api/users/me";
309
+ if (!paths[pathname])
310
+ paths[pathname] = {};
311
+ const currentPath = paths[pathname].delete;
312
+ const defaultSpec = {
313
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
314
+ summary: currentPath?.summary === pathname || !currentPath?.summary
315
+ ? "Delete current user account"
316
+ : currentPath?.summary,
317
+ description: currentPath?.description ||
318
+ "Marks the current user's account as deleted",
319
+ operationId: currentPath?.operationId?.includes(pathname)
320
+ ? "deleteMe"
321
+ : currentPath?.operationId,
263
322
  security: [{ BearerAuth: [] }],
264
323
  responses: {
265
- "200": {
324
+ ...(currentPath?.responses || {}),
325
+ "200": currentPath?.responses?.["200"] || {
266
326
  description: "Account deleted successfully",
267
327
  content: {
268
328
  "application/json": {
@@ -278,56 +338,139 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig) {
278
338
  },
279
339
  },
280
340
  },
281
- "401": {
341
+ "401": currentPath?.responses?.["401"] || {
282
342
  description: "Authentication required",
283
343
  },
284
344
  },
285
345
  };
346
+ paths[pathname].delete = { ...(currentPath || {}), ...defaultSpec };
286
347
  }
287
348
  if (!isAuthEndpointDisabled("findManyAuthAction")) {
288
- paths["/api/auth-actions"] = {
289
- get: {
290
- tags: ["Authentication"],
291
- summary: "Get all authentication actions",
292
- description: "Retrieves a list of all available authentication actions and permissions",
293
- operationId: "findManyAuthAction",
294
- security: [{ BearerAuth: [] }],
295
- responses: {
296
- "200": {
297
- description: "Auth actions retrieved successfully",
298
- content: {
299
- "application/json": {
300
- schema: {
301
- type: "object",
302
- properties: {
303
- total: {
304
- type: "number",
305
- description: "Total number of auth actions",
306
- },
307
- results: {
308
- type: "number",
309
- description: "Number of auth actions returned",
310
- },
311
- data: {
312
- type: "array",
313
- items: {
314
- $ref: "#/components/schemas/FindManyAuthActionSystemSchema",
315
- },
349
+ const pathname = "/api/auth-actions";
350
+ if (!paths[pathname])
351
+ paths[pathname] = {};
352
+ const currentPath = paths[pathname].get;
353
+ const defaultSpec = {
354
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
355
+ summary: currentPath?.summary === pathname || !currentPath?.summary
356
+ ? "Get all authentication actions"
357
+ : currentPath?.summary,
358
+ description: currentPath?.description ||
359
+ "Retrieves a list of all available authentication actions and permissions",
360
+ operationId: currentPath?.operationId?.includes(pathname)
361
+ ? "findManyAuthAction"
362
+ : currentPath?.operationId,
363
+ security: [{ BearerAuth: [] }],
364
+ responses: {
365
+ ...(currentPath?.responses || {}),
366
+ "200": currentPath?.responses?.["200"] || {
367
+ description: "Auth actions retrieved successfully",
368
+ content: {
369
+ "application/json": {
370
+ schema: {
371
+ type: "object",
372
+ properties: {
373
+ total: {
374
+ type: "number",
375
+ description: "Total number of auth actions",
376
+ },
377
+ results: {
378
+ type: "number",
379
+ description: "Number of auth actions returned",
380
+ },
381
+ data: {
382
+ type: "array",
383
+ items: {
384
+ $ref: "#/components/schemas/FindManyAuthActionSystemSchema",
316
385
  },
317
386
  },
318
387
  },
319
388
  },
320
389
  },
321
390
  },
322
- "401": {
323
- description: "Authentication required",
324
- },
325
- "403": {
326
- description: "Insufficient permissions",
391
+ },
392
+ "401": currentPath?.responses?.["401"] || {
393
+ description: "Authentication required",
394
+ },
395
+ "403": currentPath?.responses?.["403"] || {
396
+ description: "Insufficient permissions",
397
+ },
398
+ },
399
+ };
400
+ paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
401
+ }
402
+ if (!isAuthEndpointDisabled("findOneAuthAction")) {
403
+ const pathname = "/api/auth-actions/{resourceName}";
404
+ if (!paths[pathname])
405
+ paths[pathname] = {};
406
+ const currentPath = paths[pathname].get;
407
+ const defaultParameters = [
408
+ {
409
+ name: "resourceName",
410
+ in: "path",
411
+ description: "Name of the resource to retrieve auth actions for",
412
+ required: true,
413
+ schema: { type: "string" },
414
+ },
415
+ ];
416
+ const existingParams = currentPath?.parameters || [];
417
+ const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
418
+ const mergedParameters = [
419
+ ...existingParams,
420
+ ...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
421
+ ];
422
+ const defaultSpec = {
423
+ tags: ["Authentication", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
424
+ summary: currentPath?.summary === pathname || !currentPath?.summary
425
+ ? "Get authentication actions by resource"
426
+ : currentPath?.summary,
427
+ description: currentPath?.description ||
428
+ "Retrieves all authentication actions for a specific resource",
429
+ operationId: currentPath?.operationId?.includes(pathname)
430
+ ? "findOneAuthAction"
431
+ : currentPath?.operationId,
432
+ security: [{ BearerAuth: [] }],
433
+ parameters: mergedParameters,
434
+ responses: {
435
+ ...(currentPath?.responses || {}),
436
+ "200": currentPath?.responses?.["200"] || {
437
+ description: "Auth actions for resource retrieved successfully",
438
+ content: {
439
+ "application/json": {
440
+ schema: {
441
+ type: "object",
442
+ properties: {
443
+ total: {
444
+ type: "number",
445
+ description: "Total number of auth actions for this resource",
446
+ },
447
+ results: {
448
+ type: "number",
449
+ description: "Number of auth actions returned",
450
+ },
451
+ data: {
452
+ type: "array",
453
+ items: {
454
+ $ref: "#/components/schemas/FindManyAuthActionSystemSchema",
455
+ },
456
+ },
457
+ },
458
+ },
459
+ },
327
460
  },
328
461
  },
462
+ "401": currentPath?.responses?.["401"] || {
463
+ description: "Authentication required",
464
+ },
465
+ "403": currentPath?.responses?.["403"] || {
466
+ description: "Insufficient permissions",
467
+ },
468
+ "404": currentPath?.responses?.["404"] || {
469
+ description: "Resource not found",
470
+ },
329
471
  },
330
472
  };
473
+ paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
331
474
  }
332
475
  return paths;
333
476
  }