arkos 1.4.0-canary.91 → 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.
- package/dist/cjs/app.js +1 -1
- package/dist/cjs/app.js.map +1 -1
- package/dist/cjs/exports/index.js.map +1 -1
- package/dist/cjs/modules/auth/auth.controller.js +1 -1
- package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
- package/dist/cjs/modules/auth/auth.service.js +3 -4
- package/dist/cjs/modules/auth/auth.service.js.map +1 -1
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js +56 -8
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
- package/dist/cjs/modules/base/base.controller.js +6 -3
- package/dist/cjs/modules/base/base.controller.js.map +1 -1
- package/dist/cjs/modules/base/base.middlewares.js +17 -5
- package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
- package/dist/cjs/modules/error-handler/error-handler.controller.js +2 -2
- package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
- package/dist/cjs/modules/error-handler/utils/catch-async.js.map +1 -1
- package/dist/cjs/modules/swagger/swagger.router.js +6 -4
- package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js +7 -0
- package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +326 -183
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +374 -288
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -5
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js +3 -0
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
- package/dist/cjs/server.js +17 -15
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/new-arkos-config.js.map +1 -1
- package/dist/cjs/utils/arkos-router/index.js +50 -10
- package/dist/cjs/utils/arkos-router/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js +11 -0
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
- package/dist/cjs/utils/cli/dev.js +18 -57
- package/dist/cjs/utils/cli/dev.js.map +1 -1
- package/dist/cjs/utils/cli/export-auth-action.js +1 -1
- package/dist/cjs/utils/cli/export-auth-action.js.map +1 -1
- package/dist/cjs/utils/cli/generate.js +3 -3
- package/dist/cjs/utils/cli/generate.js.map +1 -1
- package/dist/cjs/utils/cli/index.js +1 -1
- package/dist/cjs/utils/cli/index.js.map +1 -1
- package/dist/cjs/utils/cli/start.js +19 -12
- package/dist/cjs/utils/cli/start.js.map +1 -1
- package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +51 -6
- package/dist/cjs/utils/cli/utils/runtime-cli-commander.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +3 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
- package/dist/cjs/utils/dotenv.helpers.js +15 -7
- package/dist/cjs/utils/dotenv.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/api.features.helpers.js +174 -81
- package/dist/cjs/utils/helpers/api.features.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/prisma.helpers.js +40 -1
- package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/routers.helpers.js +0 -1
- package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +19 -4
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js.map +1 -1
- package/dist/cjs/utils/validate-dto.js +1 -5
- package/dist/cjs/utils/validate-dto.js.map +1 -1
- package/dist/cjs/utils/validate-schema.js +2 -7
- package/dist/cjs/utils/validate-schema.js.map +1 -1
- package/dist/esm/app.js +1 -1
- package/dist/esm/app.js.map +1 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/modules/auth/auth.controller.js +1 -1
- package/dist/esm/modules/auth/auth.controller.js.map +1 -1
- package/dist/esm/modules/auth/auth.service.js +4 -5
- package/dist/esm/modules/auth/auth.service.js.map +1 -1
- package/dist/esm/modules/auth/utils/services/auth-action.service.js +56 -5
- package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
- package/dist/esm/modules/base/base.controller.js +6 -3
- package/dist/esm/modules/base/base.controller.js.map +1 -1
- package/dist/esm/modules/base/base.middlewares.js +17 -5
- package/dist/esm/modules/base/base.middlewares.js.map +1 -1
- package/dist/esm/modules/error-handler/error-handler.controller.js +2 -2
- package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
- package/dist/esm/modules/error-handler/utils/catch-async.js.map +1 -1
- package/dist/esm/modules/swagger/swagger.router.js +6 -4
- package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
- package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js +5 -0
- package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +326 -183
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +374 -288
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js +3 -0
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
- package/dist/esm/server.js +17 -15
- package/dist/esm/server.js.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/new-arkos-config.js.map +1 -1
- package/dist/esm/utils/arkos-router/index.js +51 -11
- package/dist/esm/utils/arkos-router/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/utils/helpers/index.js +10 -0
- package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
- package/dist/esm/utils/cli/dev.js +19 -58
- package/dist/esm/utils/cli/dev.js.map +1 -1
- package/dist/esm/utils/cli/export-auth-action.js +1 -1
- package/dist/esm/utils/cli/export-auth-action.js.map +1 -1
- package/dist/esm/utils/cli/generate.js +3 -3
- package/dist/esm/utils/cli/generate.js.map +1 -1
- package/dist/esm/utils/cli/index.js +1 -1
- package/dist/esm/utils/cli/index.js.map +1 -1
- package/dist/esm/utils/cli/start.js +19 -12
- package/dist/esm/utils/cli/start.js.map +1 -1
- package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/esm/utils/cli/utils/runtime-cli-commander.js +52 -7
- package/dist/esm/utils/cli/utils/runtime-cli-commander.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
- package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +3 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
- package/dist/esm/utils/dotenv.helpers.js +15 -7
- package/dist/esm/utils/dotenv.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/api.features.helpers.js +174 -81
- package/dist/esm/utils/helpers/api.features.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/prisma.helpers.js +39 -1
- package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/routers.helpers.js +0 -1
- package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js +19 -4
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -1
- package/dist/esm/utils/validate-dto.js +1 -2
- package/dist/esm/utils/validate-dto.js.map +1 -1
- package/dist/esm/utils/validate-schema.js +2 -4
- package/dist/esm/utils/validate-schema.js.map +1 -1
- package/dist/types/exports/index.d.ts +2 -1
- package/dist/types/modules/auth/auth.router.d.ts +1 -1
- package/dist/types/modules/auth/auth.service.d.ts +2 -2
- package/dist/types/modules/base/base.router.d.ts +1 -1
- package/dist/types/modules/swagger/utils/built-in-route-path-object-manager.d.ts +4 -0
- package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +1 -1
- package/dist/types/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.d.ts +1 -1
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.d.ts +1 -1
- package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +1 -1
- package/dist/types/types/index.d.ts +5 -5
- package/dist/types/types/new-arkos-config.d.ts +1 -1
- package/dist/types/utils/arkos-router/index.d.ts +2 -1
- package/dist/types/utils/arkos-router/types/index.d.ts +15 -14
- package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +1 -0
- package/dist/types/utils/cli/dev.d.ts +1 -1
- package/dist/types/utils/cli/start.d.ts +1 -1
- package/dist/types/utils/helpers/prisma.helpers.d.ts +1 -0
- 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[
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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[
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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("
|
|
145
|
+
$ref: getSchemaRef("User", userMode),
|
|
110
146
|
},
|
|
111
147
|
},
|
|
112
148
|
},
|
|
113
149
|
},
|
|
114
|
-
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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[
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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[
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
207
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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
|
-
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|
}
|