API-Handler commited on
Commit
184406c
·
verified ·
1 Parent(s): 165c542

Upload 5 files

Browse files
Files changed (5) hide show
  1. Dockerfile +27 -0
  2. package-lock.json +1103 -0
  3. package.json +11 -0
  4. src/apiHandler.js +168 -0
  5. src/server.js +148 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Node.js LTS version
2
+ FROM node:18-slim
3
+
4
+ # Switch to the "node" user for security
5
+ USER node
6
+
7
+ # Set home to the user's home directory and add local bin to PATH
8
+ ENV HOME=/home/node \
9
+ PATH=/home/node/.local/bin:$PATH
10
+
11
+ # Set the working directory to the user's home directory
12
+ WORKDIR $HOME/app
13
+
14
+ # Copy package files with correct ownership
15
+ COPY --chown=node:node package*.json ./
16
+
17
+ # Install dependencies
18
+ RUN npm install
19
+
20
+ # Copy the application code with correct ownership
21
+ COPY --chown=node:node . .
22
+
23
+ # Expose port 7860 (required for Hugging Face Spaces)
24
+ EXPOSE 7860
25
+
26
+ # Start the application using Node.js
27
+ CMD ["node", "src/server.js"]
package-lock.json ADDED
@@ -0,0 +1,1103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "NODE",
3
+ "lockfileVersion": 3,
4
+ "requires": true,
5
+ "packages": {
6
+ "": {
7
+ "dependencies": {
8
+ "body-parser": "^1.20.3",
9
+ "csv-parse": "^5.6.0",
10
+ "dotenv": "^16.4.7",
11
+ "express": "^4.21.2",
12
+ "fs": "^0.0.1-security",
13
+ "multer": "^1.4.5-lts.1",
14
+ "openai": "^4.76.0"
15
+ }
16
+ },
17
+ "node_modules/@types/node": {
18
+ "version": "18.19.67",
19
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.67.tgz",
20
+ "integrity": "sha512-wI8uHusga+0ZugNp0Ol/3BqQfEcCCNfojtO6Oou9iVNGPTL6QNSdnUdqq85fRgIorLhLMuPIKpsN98QE9Nh+KQ==",
21
+ "dependencies": {
22
+ "undici-types": "~5.26.4"
23
+ }
24
+ },
25
+ "node_modules/@types/node-fetch": {
26
+ "version": "2.6.12",
27
+ "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz",
28
+ "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==",
29
+ "dependencies": {
30
+ "@types/node": "*",
31
+ "form-data": "^4.0.0"
32
+ }
33
+ },
34
+ "node_modules/abort-controller": {
35
+ "version": "3.0.0",
36
+ "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
37
+ "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
38
+ "dependencies": {
39
+ "event-target-shim": "^5.0.0"
40
+ },
41
+ "engines": {
42
+ "node": ">=6.5"
43
+ }
44
+ },
45
+ "node_modules/accepts": {
46
+ "version": "1.3.8",
47
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
48
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
49
+ "dependencies": {
50
+ "mime-types": "~2.1.34",
51
+ "negotiator": "0.6.3"
52
+ },
53
+ "engines": {
54
+ "node": ">= 0.6"
55
+ }
56
+ },
57
+ "node_modules/agentkeepalive": {
58
+ "version": "4.5.0",
59
+ "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz",
60
+ "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==",
61
+ "dependencies": {
62
+ "humanize-ms": "^1.2.1"
63
+ },
64
+ "engines": {
65
+ "node": ">= 8.0.0"
66
+ }
67
+ },
68
+ "node_modules/append-field": {
69
+ "version": "1.0.0",
70
+ "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
71
+ "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw=="
72
+ },
73
+ "node_modules/array-flatten": {
74
+ "version": "1.1.1",
75
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
76
+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
77
+ },
78
+ "node_modules/asynckit": {
79
+ "version": "0.4.0",
80
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
81
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
82
+ },
83
+ "node_modules/body-parser": {
84
+ "version": "1.20.3",
85
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
86
+ "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
87
+ "dependencies": {
88
+ "bytes": "3.1.2",
89
+ "content-type": "~1.0.5",
90
+ "debug": "2.6.9",
91
+ "depd": "2.0.0",
92
+ "destroy": "1.2.0",
93
+ "http-errors": "2.0.0",
94
+ "iconv-lite": "0.4.24",
95
+ "on-finished": "2.4.1",
96
+ "qs": "6.13.0",
97
+ "raw-body": "2.5.2",
98
+ "type-is": "~1.6.18",
99
+ "unpipe": "1.0.0"
100
+ },
101
+ "engines": {
102
+ "node": ">= 0.8",
103
+ "npm": "1.2.8000 || >= 1.4.16"
104
+ }
105
+ },
106
+ "node_modules/buffer-from": {
107
+ "version": "1.1.2",
108
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
109
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
110
+ },
111
+ "node_modules/busboy": {
112
+ "version": "1.6.0",
113
+ "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
114
+ "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
115
+ "dependencies": {
116
+ "streamsearch": "^1.1.0"
117
+ },
118
+ "engines": {
119
+ "node": ">=10.16.0"
120
+ }
121
+ },
122
+ "node_modules/bytes": {
123
+ "version": "3.1.2",
124
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
125
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
126
+ "engines": {
127
+ "node": ">= 0.8"
128
+ }
129
+ },
130
+ "node_modules/call-bind": {
131
+ "version": "1.0.8",
132
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
133
+ "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==",
134
+ "dependencies": {
135
+ "call-bind-apply-helpers": "^1.0.0",
136
+ "es-define-property": "^1.0.0",
137
+ "get-intrinsic": "^1.2.4",
138
+ "set-function-length": "^1.2.2"
139
+ },
140
+ "engines": {
141
+ "node": ">= 0.4"
142
+ },
143
+ "funding": {
144
+ "url": "https://github.com/sponsors/ljharb"
145
+ }
146
+ },
147
+ "node_modules/call-bind-apply-helpers": {
148
+ "version": "1.0.1",
149
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz",
150
+ "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==",
151
+ "dependencies": {
152
+ "es-errors": "^1.3.0",
153
+ "function-bind": "^1.1.2"
154
+ },
155
+ "engines": {
156
+ "node": ">= 0.4"
157
+ }
158
+ },
159
+ "node_modules/combined-stream": {
160
+ "version": "1.0.8",
161
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
162
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
163
+ "dependencies": {
164
+ "delayed-stream": "~1.0.0"
165
+ },
166
+ "engines": {
167
+ "node": ">= 0.8"
168
+ }
169
+ },
170
+ "node_modules/concat-stream": {
171
+ "version": "1.6.2",
172
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
173
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
174
+ "engines": [
175
+ "node >= 0.8"
176
+ ],
177
+ "dependencies": {
178
+ "buffer-from": "^1.0.0",
179
+ "inherits": "^2.0.3",
180
+ "readable-stream": "^2.2.2",
181
+ "typedarray": "^0.0.6"
182
+ }
183
+ },
184
+ "node_modules/content-disposition": {
185
+ "version": "0.5.4",
186
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
187
+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
188
+ "dependencies": {
189
+ "safe-buffer": "5.2.1"
190
+ },
191
+ "engines": {
192
+ "node": ">= 0.6"
193
+ }
194
+ },
195
+ "node_modules/content-type": {
196
+ "version": "1.0.5",
197
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
198
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
199
+ "engines": {
200
+ "node": ">= 0.6"
201
+ }
202
+ },
203
+ "node_modules/cookie": {
204
+ "version": "0.7.1",
205
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz",
206
+ "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==",
207
+ "engines": {
208
+ "node": ">= 0.6"
209
+ }
210
+ },
211
+ "node_modules/cookie-signature": {
212
+ "version": "1.0.6",
213
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
214
+ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
215
+ },
216
+ "node_modules/core-util-is": {
217
+ "version": "1.0.3",
218
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
219
+ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
220
+ },
221
+ "node_modules/csv-parse": {
222
+ "version": "5.6.0",
223
+ "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.6.0.tgz",
224
+ "integrity": "sha512-l3nz3euub2QMg5ouu5U09Ew9Wf6/wQ8I++ch1loQ0ljmzhmfZYrH9fflS22i/PQEvsPvxCwxgz5q7UB8K1JO4Q=="
225
+ },
226
+ "node_modules/debug": {
227
+ "version": "2.6.9",
228
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
229
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
230
+ "dependencies": {
231
+ "ms": "2.0.0"
232
+ }
233
+ },
234
+ "node_modules/define-data-property": {
235
+ "version": "1.1.4",
236
+ "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
237
+ "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
238
+ "dependencies": {
239
+ "es-define-property": "^1.0.0",
240
+ "es-errors": "^1.3.0",
241
+ "gopd": "^1.0.1"
242
+ },
243
+ "engines": {
244
+ "node": ">= 0.4"
245
+ },
246
+ "funding": {
247
+ "url": "https://github.com/sponsors/ljharb"
248
+ }
249
+ },
250
+ "node_modules/delayed-stream": {
251
+ "version": "1.0.0",
252
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
253
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
254
+ "engines": {
255
+ "node": ">=0.4.0"
256
+ }
257
+ },
258
+ "node_modules/depd": {
259
+ "version": "2.0.0",
260
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
261
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
262
+ "engines": {
263
+ "node": ">= 0.8"
264
+ }
265
+ },
266
+ "node_modules/destroy": {
267
+ "version": "1.2.0",
268
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
269
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
270
+ "engines": {
271
+ "node": ">= 0.8",
272
+ "npm": "1.2.8000 || >= 1.4.16"
273
+ }
274
+ },
275
+ "node_modules/dotenv": {
276
+ "version": "16.4.7",
277
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz",
278
+ "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==",
279
+ "engines": {
280
+ "node": ">=12"
281
+ },
282
+ "funding": {
283
+ "url": "https://dotenvx.com"
284
+ }
285
+ },
286
+ "node_modules/dunder-proto": {
287
+ "version": "1.0.0",
288
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz",
289
+ "integrity": "sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==",
290
+ "dependencies": {
291
+ "call-bind-apply-helpers": "^1.0.0",
292
+ "es-errors": "^1.3.0",
293
+ "gopd": "^1.2.0"
294
+ },
295
+ "engines": {
296
+ "node": ">= 0.4"
297
+ }
298
+ },
299
+ "node_modules/ee-first": {
300
+ "version": "1.1.1",
301
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
302
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
303
+ },
304
+ "node_modules/encodeurl": {
305
+ "version": "2.0.0",
306
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
307
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
308
+ "engines": {
309
+ "node": ">= 0.8"
310
+ }
311
+ },
312
+ "node_modules/es-define-property": {
313
+ "version": "1.0.1",
314
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
315
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
316
+ "engines": {
317
+ "node": ">= 0.4"
318
+ }
319
+ },
320
+ "node_modules/es-errors": {
321
+ "version": "1.3.0",
322
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
323
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
324
+ "engines": {
325
+ "node": ">= 0.4"
326
+ }
327
+ },
328
+ "node_modules/escape-html": {
329
+ "version": "1.0.3",
330
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
331
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
332
+ },
333
+ "node_modules/etag": {
334
+ "version": "1.8.1",
335
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
336
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
337
+ "engines": {
338
+ "node": ">= 0.6"
339
+ }
340
+ },
341
+ "node_modules/event-target-shim": {
342
+ "version": "5.0.1",
343
+ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
344
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
345
+ "engines": {
346
+ "node": ">=6"
347
+ }
348
+ },
349
+ "node_modules/express": {
350
+ "version": "4.21.2",
351
+ "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
352
+ "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
353
+ "dependencies": {
354
+ "accepts": "~1.3.8",
355
+ "array-flatten": "1.1.1",
356
+ "body-parser": "1.20.3",
357
+ "content-disposition": "0.5.4",
358
+ "content-type": "~1.0.4",
359
+ "cookie": "0.7.1",
360
+ "cookie-signature": "1.0.6",
361
+ "debug": "2.6.9",
362
+ "depd": "2.0.0",
363
+ "encodeurl": "~2.0.0",
364
+ "escape-html": "~1.0.3",
365
+ "etag": "~1.8.1",
366
+ "finalhandler": "1.3.1",
367
+ "fresh": "0.5.2",
368
+ "http-errors": "2.0.0",
369
+ "merge-descriptors": "1.0.3",
370
+ "methods": "~1.1.2",
371
+ "on-finished": "2.4.1",
372
+ "parseurl": "~1.3.3",
373
+ "path-to-regexp": "0.1.12",
374
+ "proxy-addr": "~2.0.7",
375
+ "qs": "6.13.0",
376
+ "range-parser": "~1.2.1",
377
+ "safe-buffer": "5.2.1",
378
+ "send": "0.19.0",
379
+ "serve-static": "1.16.2",
380
+ "setprototypeof": "1.2.0",
381
+ "statuses": "2.0.1",
382
+ "type-is": "~1.6.18",
383
+ "utils-merge": "1.0.1",
384
+ "vary": "~1.1.2"
385
+ },
386
+ "engines": {
387
+ "node": ">= 0.10.0"
388
+ },
389
+ "funding": {
390
+ "type": "opencollective",
391
+ "url": "https://opencollective.com/express"
392
+ }
393
+ },
394
+ "node_modules/finalhandler": {
395
+ "version": "1.3.1",
396
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
397
+ "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
398
+ "dependencies": {
399
+ "debug": "2.6.9",
400
+ "encodeurl": "~2.0.0",
401
+ "escape-html": "~1.0.3",
402
+ "on-finished": "2.4.1",
403
+ "parseurl": "~1.3.3",
404
+ "statuses": "2.0.1",
405
+ "unpipe": "~1.0.0"
406
+ },
407
+ "engines": {
408
+ "node": ">= 0.8"
409
+ }
410
+ },
411
+ "node_modules/form-data": {
412
+ "version": "4.0.1",
413
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
414
+ "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
415
+ "dependencies": {
416
+ "asynckit": "^0.4.0",
417
+ "combined-stream": "^1.0.8",
418
+ "mime-types": "^2.1.12"
419
+ },
420
+ "engines": {
421
+ "node": ">= 6"
422
+ }
423
+ },
424
+ "node_modules/form-data-encoder": {
425
+ "version": "1.7.2",
426
+ "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz",
427
+ "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A=="
428
+ },
429
+ "node_modules/formdata-node": {
430
+ "version": "4.4.1",
431
+ "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz",
432
+ "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==",
433
+ "dependencies": {
434
+ "node-domexception": "1.0.0",
435
+ "web-streams-polyfill": "4.0.0-beta.3"
436
+ },
437
+ "engines": {
438
+ "node": ">= 12.20"
439
+ }
440
+ },
441
+ "node_modules/forwarded": {
442
+ "version": "0.2.0",
443
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
444
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
445
+ "engines": {
446
+ "node": ">= 0.6"
447
+ }
448
+ },
449
+ "node_modules/fresh": {
450
+ "version": "0.5.2",
451
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
452
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
453
+ "engines": {
454
+ "node": ">= 0.6"
455
+ }
456
+ },
457
+ "node_modules/fs": {
458
+ "version": "0.0.1-security",
459
+ "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
460
+ "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w=="
461
+ },
462
+ "node_modules/function-bind": {
463
+ "version": "1.1.2",
464
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
465
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
466
+ "funding": {
467
+ "url": "https://github.com/sponsors/ljharb"
468
+ }
469
+ },
470
+ "node_modules/get-intrinsic": {
471
+ "version": "1.2.5",
472
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.5.tgz",
473
+ "integrity": "sha512-Y4+pKa7XeRUPWFNvOOYHkRYrfzW07oraURSvjDmRVOJ748OrVmeXtpE4+GCEHncjCjkTxPNRt8kEbxDhsn6VTg==",
474
+ "dependencies": {
475
+ "call-bind-apply-helpers": "^1.0.0",
476
+ "dunder-proto": "^1.0.0",
477
+ "es-define-property": "^1.0.1",
478
+ "es-errors": "^1.3.0",
479
+ "function-bind": "^1.1.2",
480
+ "gopd": "^1.2.0",
481
+ "has-symbols": "^1.1.0",
482
+ "hasown": "^2.0.2"
483
+ },
484
+ "engines": {
485
+ "node": ">= 0.4"
486
+ },
487
+ "funding": {
488
+ "url": "https://github.com/sponsors/ljharb"
489
+ }
490
+ },
491
+ "node_modules/gopd": {
492
+ "version": "1.2.0",
493
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
494
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
495
+ "engines": {
496
+ "node": ">= 0.4"
497
+ },
498
+ "funding": {
499
+ "url": "https://github.com/sponsors/ljharb"
500
+ }
501
+ },
502
+ "node_modules/has-property-descriptors": {
503
+ "version": "1.0.2",
504
+ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
505
+ "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
506
+ "dependencies": {
507
+ "es-define-property": "^1.0.0"
508
+ },
509
+ "funding": {
510
+ "url": "https://github.com/sponsors/ljharb"
511
+ }
512
+ },
513
+ "node_modules/has-symbols": {
514
+ "version": "1.1.0",
515
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
516
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
517
+ "engines": {
518
+ "node": ">= 0.4"
519
+ },
520
+ "funding": {
521
+ "url": "https://github.com/sponsors/ljharb"
522
+ }
523
+ },
524
+ "node_modules/hasown": {
525
+ "version": "2.0.2",
526
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
527
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
528
+ "dependencies": {
529
+ "function-bind": "^1.1.2"
530
+ },
531
+ "engines": {
532
+ "node": ">= 0.4"
533
+ }
534
+ },
535
+ "node_modules/http-errors": {
536
+ "version": "2.0.0",
537
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
538
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
539
+ "dependencies": {
540
+ "depd": "2.0.0",
541
+ "inherits": "2.0.4",
542
+ "setprototypeof": "1.2.0",
543
+ "statuses": "2.0.1",
544
+ "toidentifier": "1.0.1"
545
+ },
546
+ "engines": {
547
+ "node": ">= 0.8"
548
+ }
549
+ },
550
+ "node_modules/humanize-ms": {
551
+ "version": "1.2.1",
552
+ "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
553
+ "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
554
+ "dependencies": {
555
+ "ms": "^2.0.0"
556
+ }
557
+ },
558
+ "node_modules/iconv-lite": {
559
+ "version": "0.4.24",
560
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
561
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
562
+ "dependencies": {
563
+ "safer-buffer": ">= 2.1.2 < 3"
564
+ },
565
+ "engines": {
566
+ "node": ">=0.10.0"
567
+ }
568
+ },
569
+ "node_modules/inherits": {
570
+ "version": "2.0.4",
571
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
572
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
573
+ },
574
+ "node_modules/ipaddr.js": {
575
+ "version": "1.9.1",
576
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
577
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
578
+ "engines": {
579
+ "node": ">= 0.10"
580
+ }
581
+ },
582
+ "node_modules/isarray": {
583
+ "version": "1.0.0",
584
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
585
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
586
+ },
587
+ "node_modules/media-typer": {
588
+ "version": "0.3.0",
589
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
590
+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
591
+ "engines": {
592
+ "node": ">= 0.6"
593
+ }
594
+ },
595
+ "node_modules/merge-descriptors": {
596
+ "version": "1.0.3",
597
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
598
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
599
+ "funding": {
600
+ "url": "https://github.com/sponsors/sindresorhus"
601
+ }
602
+ },
603
+ "node_modules/methods": {
604
+ "version": "1.1.2",
605
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
606
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
607
+ "engines": {
608
+ "node": ">= 0.6"
609
+ }
610
+ },
611
+ "node_modules/mime": {
612
+ "version": "1.6.0",
613
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
614
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
615
+ "bin": {
616
+ "mime": "cli.js"
617
+ },
618
+ "engines": {
619
+ "node": ">=4"
620
+ }
621
+ },
622
+ "node_modules/mime-db": {
623
+ "version": "1.52.0",
624
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
625
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
626
+ "engines": {
627
+ "node": ">= 0.6"
628
+ }
629
+ },
630
+ "node_modules/mime-types": {
631
+ "version": "2.1.35",
632
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
633
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
634
+ "dependencies": {
635
+ "mime-db": "1.52.0"
636
+ },
637
+ "engines": {
638
+ "node": ">= 0.6"
639
+ }
640
+ },
641
+ "node_modules/minimist": {
642
+ "version": "1.2.8",
643
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
644
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
645
+ "funding": {
646
+ "url": "https://github.com/sponsors/ljharb"
647
+ }
648
+ },
649
+ "node_modules/mkdirp": {
650
+ "version": "0.5.6",
651
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
652
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
653
+ "dependencies": {
654
+ "minimist": "^1.2.6"
655
+ },
656
+ "bin": {
657
+ "mkdirp": "bin/cmd.js"
658
+ }
659
+ },
660
+ "node_modules/ms": {
661
+ "version": "2.0.0",
662
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
663
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
664
+ },
665
+ "node_modules/multer": {
666
+ "version": "1.4.5-lts.1",
667
+ "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.5-lts.1.tgz",
668
+ "integrity": "sha512-ywPWvcDMeH+z9gQq5qYHCCy+ethsk4goepZ45GLD63fOu0YcNecQxi64nDs3qluZB+murG3/D4dJ7+dGctcCQQ==",
669
+ "dependencies": {
670
+ "append-field": "^1.0.0",
671
+ "busboy": "^1.0.0",
672
+ "concat-stream": "^1.5.2",
673
+ "mkdirp": "^0.5.4",
674
+ "object-assign": "^4.1.1",
675
+ "type-is": "^1.6.4",
676
+ "xtend": "^4.0.0"
677
+ },
678
+ "engines": {
679
+ "node": ">= 6.0.0"
680
+ }
681
+ },
682
+ "node_modules/negotiator": {
683
+ "version": "0.6.3",
684
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
685
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
686
+ "engines": {
687
+ "node": ">= 0.6"
688
+ }
689
+ },
690
+ "node_modules/node-domexception": {
691
+ "version": "1.0.0",
692
+ "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
693
+ "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
694
+ "funding": [
695
+ {
696
+ "type": "github",
697
+ "url": "https://github.com/sponsors/jimmywarting"
698
+ },
699
+ {
700
+ "type": "github",
701
+ "url": "https://paypal.me/jimmywarting"
702
+ }
703
+ ],
704
+ "engines": {
705
+ "node": ">=10.5.0"
706
+ }
707
+ },
708
+ "node_modules/node-fetch": {
709
+ "version": "2.7.0",
710
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
711
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
712
+ "dependencies": {
713
+ "whatwg-url": "^5.0.0"
714
+ },
715
+ "engines": {
716
+ "node": "4.x || >=6.0.0"
717
+ },
718
+ "peerDependencies": {
719
+ "encoding": "^0.1.0"
720
+ },
721
+ "peerDependenciesMeta": {
722
+ "encoding": {
723
+ "optional": true
724
+ }
725
+ }
726
+ },
727
+ "node_modules/object-assign": {
728
+ "version": "4.1.1",
729
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
730
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
731
+ "engines": {
732
+ "node": ">=0.10.0"
733
+ }
734
+ },
735
+ "node_modules/object-inspect": {
736
+ "version": "1.13.3",
737
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz",
738
+ "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==",
739
+ "engines": {
740
+ "node": ">= 0.4"
741
+ },
742
+ "funding": {
743
+ "url": "https://github.com/sponsors/ljharb"
744
+ }
745
+ },
746
+ "node_modules/on-finished": {
747
+ "version": "2.4.1",
748
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
749
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
750
+ "dependencies": {
751
+ "ee-first": "1.1.1"
752
+ },
753
+ "engines": {
754
+ "node": ">= 0.8"
755
+ }
756
+ },
757
+ "node_modules/openai": {
758
+ "version": "4.76.0",
759
+ "resolved": "https://registry.npmjs.org/openai/-/openai-4.76.0.tgz",
760
+ "integrity": "sha512-QBGIetjX1C9xDp5XGa/3mPnfKI9BgAe2xHQX6PmO98wuW9qQaurBaumcYptQWc9LHZZq7cH/Y1Rjnsr6uUDdVw==",
761
+ "dependencies": {
762
+ "@types/node": "^18.11.18",
763
+ "@types/node-fetch": "^2.6.4",
764
+ "abort-controller": "^3.0.0",
765
+ "agentkeepalive": "^4.2.1",
766
+ "form-data-encoder": "1.7.2",
767
+ "formdata-node": "^4.3.2",
768
+ "node-fetch": "^2.6.7"
769
+ },
770
+ "bin": {
771
+ "openai": "bin/cli"
772
+ },
773
+ "peerDependencies": {
774
+ "zod": "^3.23.8"
775
+ },
776
+ "peerDependenciesMeta": {
777
+ "zod": {
778
+ "optional": true
779
+ }
780
+ }
781
+ },
782
+ "node_modules/parseurl": {
783
+ "version": "1.3.3",
784
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
785
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
786
+ "engines": {
787
+ "node": ">= 0.8"
788
+ }
789
+ },
790
+ "node_modules/path-to-regexp": {
791
+ "version": "0.1.12",
792
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
793
+ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ=="
794
+ },
795
+ "node_modules/process-nextick-args": {
796
+ "version": "2.0.1",
797
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
798
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
799
+ },
800
+ "node_modules/proxy-addr": {
801
+ "version": "2.0.7",
802
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
803
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
804
+ "dependencies": {
805
+ "forwarded": "0.2.0",
806
+ "ipaddr.js": "1.9.1"
807
+ },
808
+ "engines": {
809
+ "node": ">= 0.10"
810
+ }
811
+ },
812
+ "node_modules/qs": {
813
+ "version": "6.13.0",
814
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
815
+ "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
816
+ "dependencies": {
817
+ "side-channel": "^1.0.6"
818
+ },
819
+ "engines": {
820
+ "node": ">=0.6"
821
+ },
822
+ "funding": {
823
+ "url": "https://github.com/sponsors/ljharb"
824
+ }
825
+ },
826
+ "node_modules/range-parser": {
827
+ "version": "1.2.1",
828
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
829
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
830
+ "engines": {
831
+ "node": ">= 0.6"
832
+ }
833
+ },
834
+ "node_modules/raw-body": {
835
+ "version": "2.5.2",
836
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
837
+ "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
838
+ "dependencies": {
839
+ "bytes": "3.1.2",
840
+ "http-errors": "2.0.0",
841
+ "iconv-lite": "0.4.24",
842
+ "unpipe": "1.0.0"
843
+ },
844
+ "engines": {
845
+ "node": ">= 0.8"
846
+ }
847
+ },
848
+ "node_modules/readable-stream": {
849
+ "version": "2.3.8",
850
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
851
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
852
+ "dependencies": {
853
+ "core-util-is": "~1.0.0",
854
+ "inherits": "~2.0.3",
855
+ "isarray": "~1.0.0",
856
+ "process-nextick-args": "~2.0.0",
857
+ "safe-buffer": "~5.1.1",
858
+ "string_decoder": "~1.1.1",
859
+ "util-deprecate": "~1.0.1"
860
+ }
861
+ },
862
+ "node_modules/readable-stream/node_modules/safe-buffer": {
863
+ "version": "5.1.2",
864
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
865
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
866
+ },
867
+ "node_modules/safe-buffer": {
868
+ "version": "5.2.1",
869
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
870
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
871
+ "funding": [
872
+ {
873
+ "type": "github",
874
+ "url": "https://github.com/sponsors/feross"
875
+ },
876
+ {
877
+ "type": "patreon",
878
+ "url": "https://www.patreon.com/feross"
879
+ },
880
+ {
881
+ "type": "consulting",
882
+ "url": "https://feross.org/support"
883
+ }
884
+ ]
885
+ },
886
+ "node_modules/safer-buffer": {
887
+ "version": "2.1.2",
888
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
889
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
890
+ },
891
+ "node_modules/send": {
892
+ "version": "0.19.0",
893
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
894
+ "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
895
+ "dependencies": {
896
+ "debug": "2.6.9",
897
+ "depd": "2.0.0",
898
+ "destroy": "1.2.0",
899
+ "encodeurl": "~1.0.2",
900
+ "escape-html": "~1.0.3",
901
+ "etag": "~1.8.1",
902
+ "fresh": "0.5.2",
903
+ "http-errors": "2.0.0",
904
+ "mime": "1.6.0",
905
+ "ms": "2.1.3",
906
+ "on-finished": "2.4.1",
907
+ "range-parser": "~1.2.1",
908
+ "statuses": "2.0.1"
909
+ },
910
+ "engines": {
911
+ "node": ">= 0.8.0"
912
+ }
913
+ },
914
+ "node_modules/send/node_modules/encodeurl": {
915
+ "version": "1.0.2",
916
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
917
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
918
+ "engines": {
919
+ "node": ">= 0.8"
920
+ }
921
+ },
922
+ "node_modules/send/node_modules/ms": {
923
+ "version": "2.1.3",
924
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
925
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
926
+ },
927
+ "node_modules/serve-static": {
928
+ "version": "1.16.2",
929
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
930
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
931
+ "dependencies": {
932
+ "encodeurl": "~2.0.0",
933
+ "escape-html": "~1.0.3",
934
+ "parseurl": "~1.3.3",
935
+ "send": "0.19.0"
936
+ },
937
+ "engines": {
938
+ "node": ">= 0.8.0"
939
+ }
940
+ },
941
+ "node_modules/set-function-length": {
942
+ "version": "1.2.2",
943
+ "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
944
+ "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
945
+ "dependencies": {
946
+ "define-data-property": "^1.1.4",
947
+ "es-errors": "^1.3.0",
948
+ "function-bind": "^1.1.2",
949
+ "get-intrinsic": "^1.2.4",
950
+ "gopd": "^1.0.1",
951
+ "has-property-descriptors": "^1.0.2"
952
+ },
953
+ "engines": {
954
+ "node": ">= 0.4"
955
+ }
956
+ },
957
+ "node_modules/setprototypeof": {
958
+ "version": "1.2.0",
959
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
960
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
961
+ },
962
+ "node_modules/side-channel": {
963
+ "version": "1.0.6",
964
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
965
+ "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
966
+ "dependencies": {
967
+ "call-bind": "^1.0.7",
968
+ "es-errors": "^1.3.0",
969
+ "get-intrinsic": "^1.2.4",
970
+ "object-inspect": "^1.13.1"
971
+ },
972
+ "engines": {
973
+ "node": ">= 0.4"
974
+ },
975
+ "funding": {
976
+ "url": "https://github.com/sponsors/ljharb"
977
+ }
978
+ },
979
+ "node_modules/statuses": {
980
+ "version": "2.0.1",
981
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
982
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
983
+ "engines": {
984
+ "node": ">= 0.8"
985
+ }
986
+ },
987
+ "node_modules/streamsearch": {
988
+ "version": "1.1.0",
989
+ "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
990
+ "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
991
+ "engines": {
992
+ "node": ">=10.0.0"
993
+ }
994
+ },
995
+ "node_modules/string_decoder": {
996
+ "version": "1.1.1",
997
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
998
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
999
+ "dependencies": {
1000
+ "safe-buffer": "~5.1.0"
1001
+ }
1002
+ },
1003
+ "node_modules/string_decoder/node_modules/safe-buffer": {
1004
+ "version": "5.1.2",
1005
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
1006
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
1007
+ },
1008
+ "node_modules/toidentifier": {
1009
+ "version": "1.0.1",
1010
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
1011
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
1012
+ "engines": {
1013
+ "node": ">=0.6"
1014
+ }
1015
+ },
1016
+ "node_modules/tr46": {
1017
+ "version": "0.0.3",
1018
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
1019
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
1020
+ },
1021
+ "node_modules/type-is": {
1022
+ "version": "1.6.18",
1023
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
1024
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
1025
+ "dependencies": {
1026
+ "media-typer": "0.3.0",
1027
+ "mime-types": "~2.1.24"
1028
+ },
1029
+ "engines": {
1030
+ "node": ">= 0.6"
1031
+ }
1032
+ },
1033
+ "node_modules/typedarray": {
1034
+ "version": "0.0.6",
1035
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
1036
+ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
1037
+ },
1038
+ "node_modules/undici-types": {
1039
+ "version": "5.26.5",
1040
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
1041
+ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
1042
+ },
1043
+ "node_modules/unpipe": {
1044
+ "version": "1.0.0",
1045
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
1046
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
1047
+ "engines": {
1048
+ "node": ">= 0.8"
1049
+ }
1050
+ },
1051
+ "node_modules/util-deprecate": {
1052
+ "version": "1.0.2",
1053
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
1054
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
1055
+ },
1056
+ "node_modules/utils-merge": {
1057
+ "version": "1.0.1",
1058
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
1059
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
1060
+ "engines": {
1061
+ "node": ">= 0.4.0"
1062
+ }
1063
+ },
1064
+ "node_modules/vary": {
1065
+ "version": "1.1.2",
1066
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
1067
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
1068
+ "engines": {
1069
+ "node": ">= 0.8"
1070
+ }
1071
+ },
1072
+ "node_modules/web-streams-polyfill": {
1073
+ "version": "4.0.0-beta.3",
1074
+ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz",
1075
+ "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==",
1076
+ "engines": {
1077
+ "node": ">= 14"
1078
+ }
1079
+ },
1080
+ "node_modules/webidl-conversions": {
1081
+ "version": "3.0.1",
1082
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
1083
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
1084
+ },
1085
+ "node_modules/whatwg-url": {
1086
+ "version": "5.0.0",
1087
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
1088
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
1089
+ "dependencies": {
1090
+ "tr46": "~0.0.3",
1091
+ "webidl-conversions": "^3.0.0"
1092
+ }
1093
+ },
1094
+ "node_modules/xtend": {
1095
+ "version": "4.0.2",
1096
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
1097
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
1098
+ "engines": {
1099
+ "node": ">=0.4"
1100
+ }
1101
+ }
1102
+ }
1103
+ }
package.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dependencies": {
3
+ "body-parser": "^1.20.3",
4
+ "csv-parse": "^5.6.0",
5
+ "dotenv": "^16.4.7",
6
+ "express": "^4.21.2",
7
+ "fs": "^0.0.1-security",
8
+ "multer": "^1.4.5-lts.1",
9
+ "openai": "^4.76.0"
10
+ }
11
+ }
src/apiHandler.js ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ==========================================
2
+ // API HANDLER FILE
3
+ // ==========================================
4
+
5
+ require('dotenv').config();
6
+ const OpenAI = require('openai');
7
+ const fs = require('fs');
8
+
9
+ // Initialize OpenAI client
10
+ const openai = new OpenAI({
11
+ apiKey: process.env.OPENAI_UNLIMITED_API_KEY,
12
+ });
13
+
14
+ // ------------------------------------------
15
+ // Chat Completions (Text Generation, Reasoning, Function Calling)
16
+ // ------------------------------------------
17
+
18
+ async function createChatCompletion(requestBody, res) {
19
+ if (requestBody.stream) {
20
+ // Handle streaming response
21
+ try {
22
+ const completion = await openai.chat.completions.create({
23
+ ...requestBody,
24
+ stream: true,
25
+ });
26
+
27
+ res.setHeader('Content-Type', 'text/event-stream');
28
+ res.setHeader('Cache-Control', 'no-cache');
29
+ res.flushHeaders();
30
+
31
+ for await (const part of completion) {
32
+ const data = JSON.stringify(part);
33
+ res.write(`data: ${data}\n\n`);
34
+ }
35
+ res.write('data: [DONE]\n\n');
36
+ res.end();
37
+ } catch (error) {
38
+ console.error('Error in createChatCompletion:', error);
39
+ if (!res.headersSent) {
40
+ res.status(500).json(error.response ? error.response.data : error);
41
+ } else {
42
+ res.write(`data: ${JSON.stringify({ error: error.message })}\n\n`);
43
+ res.end();
44
+ }
45
+ }
46
+ } else {
47
+ // Non-streaming case
48
+ try {
49
+ const completion = await openai.chat.completions.create(requestBody);
50
+ return completion;
51
+ } catch (error) {
52
+ throw error.response ? error.response.data : error;
53
+ }
54
+ }
55
+ }
56
+
57
+ // ------------------------------------------
58
+ // Image Generation
59
+ // ------------------------------------------
60
+
61
+ async function createImage(requestBody) {
62
+ try {
63
+ const response = await openai.images.generate(requestBody);
64
+ return response;
65
+ } catch (error) {
66
+ throw error.response ? error.response.data : error;
67
+ }
68
+ }
69
+
70
+ // ------------------------------------------
71
+ // Image Editing
72
+ // ------------------------------------------
73
+
74
+ async function createImageEdit(requestBody) {
75
+ try {
76
+ const response = await openai.images.edit({
77
+ image: fs.createReadStream(requestBody.image),
78
+ mask: fs.createReadStream(requestBody.mask),
79
+ prompt: requestBody.prompt,
80
+ n: requestBody.n,
81
+ size: requestBody.size,
82
+ });
83
+ return response;
84
+ } catch (error) {
85
+ throw error.response ? error.response.data : error;
86
+ }
87
+ }
88
+
89
+ // ------------------------------------------
90
+ // Image Variation
91
+ // ------------------------------------------
92
+
93
+ async function createImageVariation(requestBody) {
94
+ try {
95
+ const response = await openai.images.createVariation({
96
+ image: fs.createReadStream(requestBody.image),
97
+ n: requestBody.n,
98
+ size: requestBody.size,
99
+ });
100
+ return response;
101
+ } catch (error) {
102
+ throw error.response ? error.response.data : error;
103
+ }
104
+ }
105
+
106
+ // ------------------------------------------
107
+ // Audio Transcription
108
+ // ------------------------------------------
109
+
110
+ async function createTranscription(requestBody) {
111
+ try {
112
+ const response = await openai.audio.transcriptions.create({
113
+ file: fs.createReadStream(requestBody.file),
114
+ model: requestBody.model,
115
+ });
116
+ return response;
117
+ } catch (error) {
118
+ throw error.response ? error.response.data : error;
119
+ }
120
+ }
121
+
122
+ // ------------------------------------------
123
+ // Text to Speech
124
+ // ------------------------------------------
125
+
126
+ async function createSpeech(requestBody, res) {
127
+ try {
128
+ const response = await openai.audio.speech.create({
129
+ ...requestBody,
130
+ });
131
+
132
+ const arrayBuffer = await response.arrayBuffer();
133
+ res.setHeader('Content-Type', 'audio/mpeg');
134
+ res.send(Buffer.from(arrayBuffer));
135
+ } catch (error) {
136
+ console.error('Error in createSpeech:', error);
137
+ if (!res.headersSent) {
138
+ res.status(500).json(error.response ? error.response.data : error);
139
+ }
140
+ }
141
+ }
142
+
143
+ // ------------------------------------------
144
+ // Vision (Image Analysis)
145
+ // ------------------------------------------
146
+
147
+ async function createVisionAnalysis(requestBody) {
148
+ try {
149
+ const response = await openai.chat.completions.create(requestBody);
150
+ return response;
151
+ } catch (error) {
152
+ throw error.response ? error.response.data : error;
153
+ }
154
+ }
155
+
156
+ // ------------------------------------------
157
+ // Export Modules
158
+ // ------------------------------------------
159
+
160
+ module.exports = {
161
+ createChatCompletion,
162
+ createImage,
163
+ createImageEdit,
164
+ createImageVariation,
165
+ createTranscription,
166
+ createSpeech,
167
+ createVisionAnalysis,
168
+ };
src/server.js ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ==========================================
2
+ // SERVER WITH ENDPOINTS
3
+ // ==========================================
4
+
5
+ require('dotenv').config();
6
+ const express = require('express');
7
+ const app = express();
8
+ const port = process.env.PORT || 3000;
9
+ const apiHandler = require('./apiHandler');
10
+ const bodyParser = require('body-parser');
11
+ const fs = require('fs');
12
+
13
+ // Middleware to parse JSON bodies
14
+ app.use(bodyParser.json());
15
+
16
+ // Middleware to parse multipart/form-data for file uploads
17
+ const multer = require('multer');
18
+ const upload = multer({ dest: 'uploads/' });
19
+
20
+ // ------------------------------------------
21
+ // Chat Completions Endpoint
22
+ // ------------------------------------------
23
+
24
+ app.post('/v1/chat/completions', (req, res) => {
25
+ if (req.body.stream) {
26
+ // For streaming, the apiHandler manages the response and error handling
27
+ apiHandler.createChatCompletion(req.body, res);
28
+ } else {
29
+ // Non-streaming
30
+ apiHandler
31
+ .createChatCompletion(req.body)
32
+ .then((data) => {
33
+ res.json(data);
34
+ })
35
+ .catch((error) => {
36
+ res.status(500).json(error);
37
+ });
38
+ }
39
+ });
40
+
41
+ // ------------------------------------------
42
+ // Image Generation Endpoint
43
+ // ------------------------------------------
44
+
45
+ app.post('/v1/images/generations', async (req, res) => {
46
+ try {
47
+ const data = await apiHandler.createImage(req.body);
48
+ res.json(data);
49
+ } catch (error) {
50
+ res.status(500).json(error);
51
+ }
52
+ });
53
+
54
+ // ------------------------------------------
55
+ // Image Editing Endpoint
56
+ // ------------------------------------------
57
+
58
+ app.post('/v1/images/edits', upload.fields([{ name: 'image' }, { name: 'mask' }]), async (req, res) => {
59
+ try {
60
+ // Add file paths to request body
61
+ req.body.image = req.files['image'][0].path;
62
+ req.body.mask = req.files['mask'][0].path;
63
+
64
+ const data = await apiHandler.createImageEdit(req.body);
65
+ res.json(data);
66
+
67
+ // Clean up uploaded files
68
+ fs.unlinkSync(req.body.image);
69
+ fs.unlinkSync(req.body.mask);
70
+ } catch (error) {
71
+ res.status(500).json(error);
72
+ }
73
+ });
74
+
75
+ // ------------------------------------------
76
+ // Image Variations Endpoint
77
+ // ------------------------------------------
78
+
79
+ app.post('/v1/images/variations', upload.single('image'), async (req, res) => {
80
+ try {
81
+ // Add file path to request body
82
+ req.body.image = req.file.path;
83
+
84
+ const data = await apiHandler.createImageVariation(req.body);
85
+ res.json(data);
86
+
87
+ // Clean up uploaded file
88
+ fs.unlinkSync(req.body.image);
89
+ } catch (error) {
90
+ res.status(500).json(error);
91
+ }
92
+ });
93
+
94
+ // ------------------------------------------
95
+ // Audio Transcription Endpoint
96
+ // ------------------------------------------
97
+
98
+ app.post('/v1/audio/transcriptions', upload.single('file'), async (req, res) => {
99
+ try {
100
+ // Add file path to request body
101
+ req.body.file = req.file.path;
102
+
103
+ const data = await apiHandler.createTranscription(req.body);
104
+ res.json(data);
105
+
106
+ // Clean up uploaded file
107
+ fs.unlinkSync(req.body.file);
108
+ } catch (error) {
109
+ res.status(500).json(error);
110
+ }
111
+ });
112
+
113
+ // ------------------------------------------
114
+ // Text to Speech Endpoint
115
+ // ------------------------------------------
116
+
117
+ app.post('/v1/audio/speech', async (req, res) => {
118
+ try {
119
+ await apiHandler.createSpeech(req.body, res);
120
+ } catch (error) {
121
+ if (!res.headersSent) {
122
+ res.status(500).json(error);
123
+ } else {
124
+ console.error('Error after headers sent:', error);
125
+ }
126
+ }
127
+ });
128
+
129
+ // ------------------------------------------
130
+ // Vision Endpoint
131
+ // ------------------------------------------
132
+
133
+ app.post('/v1/vision', async (req, res) => {
134
+ try {
135
+ const data = await apiHandler.createVisionAnalysis(req.body);
136
+ res.json(data);
137
+ } catch (error) {
138
+ res.status(500).json(error);
139
+ }
140
+ });
141
+
142
+ // ------------------------------------------
143
+ // Start the Server
144
+ // ------------------------------------------
145
+
146
+ app.listen(port, () => {
147
+ console.log(`Server running on port ${port}`);
148
+ });