create-prisma-php-app 1.20.3 → 1.20.500
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/bootstrap.php +38 -1
- package/dist/index.js +1109 -1
- package/dist/prisma-php.js +63 -1
- package/dist/settings/public-functions.php +26 -0
- package/dist/settings/request-methods.php +1 -0
- package/dist/settings/start-dev.js +132 -0
- package/dist/settings/swagger-setup.js +54 -0
- package/dist/src/Lib/FileManager/UploadFile.php +23 -19
- package/dist/src/app/swagger-docs/apis/pphp-swagger.json +259 -0
- package/dist/src/app/swagger-docs/apis/users.js +180 -0
- package/dist/src/app/swagger-docs/dist/favicon-16x16.png +0 -0
- package/dist/src/app/swagger-docs/dist/favicon-32x32.png +0 -0
- package/dist/src/app/swagger-docs/dist/index.css +16 -0
- package/dist/src/app/swagger-docs/dist/index.html +19 -0
- package/dist/src/app/swagger-docs/dist/oauth2-redirect.html +79 -0
- package/dist/src/app/swagger-docs/dist/swagger-initializer.js +36 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-bundle.js +2 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-bundle.js.map +1 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-es-bundle-core.js +3 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-es-bundle-core.js.map +1 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-es-bundle.js +2 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-es-bundle.js.map +1 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-standalone-preset.js +2 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui-standalone-preset.js.map +1 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui.css +3 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui.css.map +1 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui.js +2 -0
- package/dist/src/app/swagger-docs/dist/swagger-ui.js.map +1 -0
- package/dist/src/app/swagger-docs/index.php +16 -0
- package/dist/src/app/swagger-docs-layout.php +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @swagger
|
|
3
|
+
* tags:
|
|
4
|
+
* name: Users
|
|
5
|
+
* description: User management API
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @swagger
|
|
10
|
+
* /users:
|
|
11
|
+
* get:
|
|
12
|
+
* summary: Retrieve a list of users
|
|
13
|
+
* tags:
|
|
14
|
+
* - Users
|
|
15
|
+
* responses:
|
|
16
|
+
* 200:
|
|
17
|
+
* description: A list of users
|
|
18
|
+
* content:
|
|
19
|
+
* application/json:
|
|
20
|
+
* schema:
|
|
21
|
+
* type: array
|
|
22
|
+
* items:
|
|
23
|
+
* type: object
|
|
24
|
+
* properties:
|
|
25
|
+
* id:
|
|
26
|
+
* type: integer
|
|
27
|
+
* example: 1
|
|
28
|
+
* name:
|
|
29
|
+
* type: string
|
|
30
|
+
* example: "John Doe"
|
|
31
|
+
* email:
|
|
32
|
+
* type: string
|
|
33
|
+
* example: "johndoe@example.com"
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @swagger
|
|
38
|
+
* /users/{id}:
|
|
39
|
+
* get:
|
|
40
|
+
* summary: Retrieve a single user by ID
|
|
41
|
+
* tags:
|
|
42
|
+
* - Users
|
|
43
|
+
* parameters:
|
|
44
|
+
* - in: path
|
|
45
|
+
* name: id
|
|
46
|
+
* required: true
|
|
47
|
+
* description: The user ID
|
|
48
|
+
* schema:
|
|
49
|
+
* type: integer
|
|
50
|
+
* responses:
|
|
51
|
+
* 200:
|
|
52
|
+
* description: A single user object
|
|
53
|
+
* content:
|
|
54
|
+
* application/json:
|
|
55
|
+
* schema:
|
|
56
|
+
* type: object
|
|
57
|
+
* properties:
|
|
58
|
+
* id:
|
|
59
|
+
* type: integer
|
|
60
|
+
* example: 1
|
|
61
|
+
* name:
|
|
62
|
+
* type: string
|
|
63
|
+
* example: "John Doe"
|
|
64
|
+
* email:
|
|
65
|
+
* type: string
|
|
66
|
+
* example: "johndoe@example.com"
|
|
67
|
+
* 404:
|
|
68
|
+
* description: User not found
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @swagger
|
|
73
|
+
* /users:
|
|
74
|
+
* post:
|
|
75
|
+
* summary: Create a new user
|
|
76
|
+
* tags:
|
|
77
|
+
* - Users
|
|
78
|
+
* requestBody:
|
|
79
|
+
* required: true
|
|
80
|
+
* content:
|
|
81
|
+
* application/json:
|
|
82
|
+
* schema:
|
|
83
|
+
* type: object
|
|
84
|
+
* required:
|
|
85
|
+
* - name
|
|
86
|
+
* - email
|
|
87
|
+
* properties:
|
|
88
|
+
* name:
|
|
89
|
+
* type: string
|
|
90
|
+
* example: "Jane Doe"
|
|
91
|
+
* email:
|
|
92
|
+
* type: string
|
|
93
|
+
* example: "janedoe@example.com"
|
|
94
|
+
* responses:
|
|
95
|
+
* 201:
|
|
96
|
+
* description: The created user
|
|
97
|
+
* content:
|
|
98
|
+
* application/json:
|
|
99
|
+
* schema:
|
|
100
|
+
* type: object
|
|
101
|
+
* properties:
|
|
102
|
+
* id:
|
|
103
|
+
* type: integer
|
|
104
|
+
* example: 2
|
|
105
|
+
* name:
|
|
106
|
+
* type: string
|
|
107
|
+
* example: "Jane Doe"
|
|
108
|
+
* email:
|
|
109
|
+
* type: string
|
|
110
|
+
* example: "janedoe@example.com"
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @swagger
|
|
115
|
+
* /users/{id}:
|
|
116
|
+
* put:
|
|
117
|
+
* summary: Update a user by ID
|
|
118
|
+
* tags:
|
|
119
|
+
* - Users
|
|
120
|
+
* parameters:
|
|
121
|
+
* - in: path
|
|
122
|
+
* name: id
|
|
123
|
+
* required: true
|
|
124
|
+
* description: The user ID
|
|
125
|
+
* schema:
|
|
126
|
+
* type: integer
|
|
127
|
+
* requestBody:
|
|
128
|
+
* required: true
|
|
129
|
+
* content:
|
|
130
|
+
* application/json:
|
|
131
|
+
* schema:
|
|
132
|
+
* type: object
|
|
133
|
+
* properties:
|
|
134
|
+
* name:
|
|
135
|
+
* type: string
|
|
136
|
+
* example: "Updated Name"
|
|
137
|
+
* email:
|
|
138
|
+
* type: string
|
|
139
|
+
* example: "updatedemail@example.com"
|
|
140
|
+
* responses:
|
|
141
|
+
* 200:
|
|
142
|
+
* description: The updated user
|
|
143
|
+
* content:
|
|
144
|
+
* application/json:
|
|
145
|
+
* schema:
|
|
146
|
+
* type: object
|
|
147
|
+
* properties:
|
|
148
|
+
* id:
|
|
149
|
+
* type: integer
|
|
150
|
+
* example: 1
|
|
151
|
+
* name:
|
|
152
|
+
* type: string
|
|
153
|
+
* example: "Updated Name"
|
|
154
|
+
* email:
|
|
155
|
+
* type: string
|
|
156
|
+
* example: "updatedemail@example.com"
|
|
157
|
+
* 404:
|
|
158
|
+
* description: User not found
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @swagger
|
|
163
|
+
* /users/{id}:
|
|
164
|
+
* delete:
|
|
165
|
+
* summary: Delete a user by ID
|
|
166
|
+
* tags:
|
|
167
|
+
* - Users
|
|
168
|
+
* parameters:
|
|
169
|
+
* - in: path
|
|
170
|
+
* name: id
|
|
171
|
+
* required: true
|
|
172
|
+
* description: The user ID
|
|
173
|
+
* schema:
|
|
174
|
+
* type: integer
|
|
175
|
+
* responses:
|
|
176
|
+
* 204:
|
|
177
|
+
* description: User successfully deleted
|
|
178
|
+
* 404:
|
|
179
|
+
* description: User not found
|
|
180
|
+
*/
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- HTML for static distribution bundle build -->
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>Swagger UI</title>
|
|
7
|
+
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="index.css" />
|
|
9
|
+
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
|
10
|
+
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<div id="swagger-ui"></div>
|
|
15
|
+
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
|
16
|
+
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
|
17
|
+
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en-US">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Swagger UI: OAuth2 Redirect</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<script>
|
|
8
|
+
'use strict';
|
|
9
|
+
function run () {
|
|
10
|
+
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
|
11
|
+
var sentState = oauth2.state;
|
|
12
|
+
var redirectUrl = oauth2.redirectUrl;
|
|
13
|
+
var isValid, qp, arr;
|
|
14
|
+
|
|
15
|
+
if (/code|token|error/.test(window.location.hash)) {
|
|
16
|
+
qp = window.location.hash.substring(1).replace('?', '&');
|
|
17
|
+
} else {
|
|
18
|
+
qp = location.search.substring(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
arr = qp.split("&");
|
|
22
|
+
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
|
23
|
+
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
|
24
|
+
function (key, value) {
|
|
25
|
+
return key === "" ? value : decodeURIComponent(value);
|
|
26
|
+
}
|
|
27
|
+
) : {};
|
|
28
|
+
|
|
29
|
+
isValid = qp.state === sentState;
|
|
30
|
+
|
|
31
|
+
if ((
|
|
32
|
+
oauth2.auth.schema.get("flow") === "accessCode" ||
|
|
33
|
+
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
|
34
|
+
oauth2.auth.schema.get("flow") === "authorization_code"
|
|
35
|
+
) && !oauth2.auth.code) {
|
|
36
|
+
if (!isValid) {
|
|
37
|
+
oauth2.errCb({
|
|
38
|
+
authId: oauth2.auth.name,
|
|
39
|
+
source: "auth",
|
|
40
|
+
level: "warning",
|
|
41
|
+
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (qp.code) {
|
|
46
|
+
delete oauth2.state;
|
|
47
|
+
oauth2.auth.code = qp.code;
|
|
48
|
+
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
|
49
|
+
} else {
|
|
50
|
+
let oauthErrorMsg;
|
|
51
|
+
if (qp.error) {
|
|
52
|
+
oauthErrorMsg = "["+qp.error+"]: " +
|
|
53
|
+
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
|
54
|
+
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
oauth2.errCb({
|
|
58
|
+
authId: oauth2.auth.name,
|
|
59
|
+
source: "auth",
|
|
60
|
+
level: "error",
|
|
61
|
+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
|
66
|
+
}
|
|
67
|
+
window.close();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (document.readyState !== 'loading') {
|
|
71
|
+
run();
|
|
72
|
+
} else {
|
|
73
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
74
|
+
run();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
</body>
|
|
79
|
+
</html>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
window.onload = function () {
|
|
2
|
+
//<editor-fold desc="Changeable Configuration Block">
|
|
3
|
+
|
|
4
|
+
const host = window.location.hostname;
|
|
5
|
+
const port = window.location.port;
|
|
6
|
+
|
|
7
|
+
// Set the URL dynamically based on the environment
|
|
8
|
+
let swaggerUrl;
|
|
9
|
+
|
|
10
|
+
if (host === "localhost") {
|
|
11
|
+
// For local development, handle different possible ports
|
|
12
|
+
swaggerUrl = `http://${host}:${
|
|
13
|
+
port || 3000
|
|
14
|
+
}/swagger-docs/apis/pphp-swagger.json`;
|
|
15
|
+
} else {
|
|
16
|
+
// For production, use the domain without hardcoding the port
|
|
17
|
+
swaggerUrl = `https://${host}/swagger-docs/pphp-swagger.json`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
window.ui = SwaggerUIBundle({
|
|
21
|
+
url: swaggerUrl,
|
|
22
|
+
dom_id: "#swagger-ui",
|
|
23
|
+
deepLinking: true,
|
|
24
|
+
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
|
|
25
|
+
plugins: [SwaggerUIBundle.plugins.DownloadUrl],
|
|
26
|
+
layout: "StandaloneLayout",
|
|
27
|
+
|
|
28
|
+
// Add custom header using requestInterceptor
|
|
29
|
+
requestInterceptor: (request) => {
|
|
30
|
+
request.headers["HTTP_PPHP_X_FILE_REQUEST"] = "true"; // Set your custom header here
|
|
31
|
+
return request;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
//</editor-fold>
|
|
36
|
+
};
|