1
+ module . exports =
2
+ /******/ ( function ( modules ) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = { } ;
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__ ( moduleId ) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if ( installedModules [ moduleId ] ) {
11
+ /******/ return installedModules [ moduleId ] . exports ;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules [ moduleId ] = {
15
+ /******/ i : moduleId ,
16
+ /******/ l : false ,
17
+ /******/ exports : { }
18
+ /******/ } ;
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ var threw = true ;
22
+ /******/ try {
23
+ /******/ modules [ moduleId ] . call ( module . exports , module , module . exports , __webpack_require__ ) ;
24
+ /******/ threw = false ;
25
+ /******/ } finally {
26
+ /******/ if ( threw ) delete installedModules [ moduleId ] ;
27
+ /******/ }
28
+ /******/
29
+ /******/ // Flag the module as loaded
30
+ /******/ module . l = true ;
31
+ /******/
32
+ /******/ // Return the exports of the module
33
+ /******/ return module . exports ;
34
+ /******/ }
35
+ /******/
36
+ /******/
37
+ /******/ // expose the modules object (__webpack_modules__)
38
+ /******/ __webpack_require__ . m = modules ;
39
+ /******/
40
+ /******/ // expose the module cache
41
+ /******/ __webpack_require__ . c = installedModules ;
42
+ /******/
43
+ /******/ // define getter function for harmony exports
44
+ /******/ __webpack_require__ . d = function ( exports , name , getter ) {
45
+ /******/ if ( ! __webpack_require__ . o ( exports , name ) ) {
46
+ /******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
47
+ /******/ }
48
+ /******/ } ;
49
+ /******/
50
+ /******/ // define __esModule on exports
51
+ /******/ __webpack_require__ . r = function ( exports ) {
52
+ /******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
53
+ /******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
54
+ /******/ }
55
+ /******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
56
+ /******/ } ;
57
+ /******/
58
+ /******/ // create a fake namespace object
59
+ /******/ // mode & 1: value is a module id, require it
60
+ /******/ // mode & 2: merge all properties of value into the ns
61
+ /******/ // mode & 4: return value when already ns object
62
+ /******/ // mode & 8|1: behave like require
63
+ /******/ __webpack_require__ . t = function ( value , mode ) {
64
+ /******/ if ( mode & 1 ) value = __webpack_require__ ( value ) ;
65
+ /******/ if ( mode & 8 ) return value ;
66
+ /******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . __esModule ) return value ;
67
+ /******/ var ns = Object . create ( null ) ;
68
+ /******/ __webpack_require__ . r ( ns ) ;
69
+ /******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
70
+ /******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) __webpack_require__ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
71
+ /******/ return ns ;
72
+ /******/ } ;
73
+ /******/
74
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
75
+ /******/ __webpack_require__ . n = function ( module ) {
76
+ /******/ var getter = module && module . __esModule ?
77
+ /******/ function getDefault ( ) { return module [ 'default' ] ; } :
78
+ /******/ function getModuleExports ( ) { return module ; } ;
79
+ /******/ __webpack_require__ . d ( getter , 'a' , getter ) ;
80
+ /******/ return getter ;
81
+ /******/ } ;
82
+ /******/
83
+ /******/ // Object.prototype.hasOwnProperty.call
84
+ /******/ __webpack_require__ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
85
+ /******/
86
+ /******/ // __webpack_public_path__
87
+ /******/ __webpack_require__ . p = "" ;
88
+ /******/
89
+ /******/
90
+ /******/ // Load entry module and return exports
91
+ /******/ return __webpack_require__ ( __webpack_require__ . s = "rLki" ) ;
92
+ /******/ } )
93
+ /************************************************************************/
94
+ /******/ ( {
95
+
96
+ /***/ "+/F5" :
97
+ /***/ ( function ( module , exports ) {
98
+
99
+ module . exports = require ( "next/dist/next-server/server/api-utils" ) ;
100
+
101
+ /***/ } ) ,
102
+
103
+ /***/ "1N0Q" :
104
+ /***/ ( function ( module , exports ) {
105
+
106
+ module . exports = require ( "@prisma/client" ) ;
107
+
108
+ /***/ } ) ,
109
+
110
+ /***/ "3fKi" :
111
+ /***/ ( function ( module , exports ) {
112
+
113
+ module . exports = require ( "@next/env" ) ;
114
+
115
+ /***/ } ) ,
116
+
117
+ /***/ "7Sw3" :
118
+ /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
119
+
120
+ "use strict" ;
121
+ __webpack_require__ . r ( __webpack_exports__ ) ;
122
+ /* harmony export (binding) */ __webpack_require__ . d ( __webpack_exports__ , "default" , function ( ) { return handler ; } ) ;
123
+ const {
124
+ PrismaClient
125
+ } = __webpack_require__ ( "1N0Q" ) ;
126
+
127
+ const prisma = new PrismaClient ( ) ;
128
+ async function handler ( req , res ) {
129
+ try {
130
+ await Promise . all ( [ prisma . profile . deleteMany ( ) , prisma . post . deleteMany ( ) ] ) ;
131
+ await prisma . user . deleteMany ( ) ;
132
+ const createdUser = await prisma . user . create ( {
133
+ data : seedUser
134
+ } ) ;
135
+ const createdUser2 = await prisma . user . create ( {
136
+ data : seedUser2
137
+ } ) ;
138
+ res . statusCode = 200 ;
139
+ res . json ( {
140
+ success : "true"
141
+ } ) ;
142
+ } catch ( error ) {
143
+ console . error ( error ) ;
144
+ res . statusCode = 500 ;
145
+ res . json ( {
146
+ error : error . message
147
+ } ) ;
148
+ }
149
+ }
150
+ const seedUser = {
151
+
152
+ name : "Jane" ,
153
+ profile : {
154
+ create : {
155
+ bio : "Health Enthusiast"
156
+ }
157
+ } ,
158
+ posts : {
159
+ create : [ {
160
+ title : "Comparing Database Types: How Database Types Evolved to Meet Different Needs" ,
161
+ content : "https://www.prisma.io/blog/comparison-of-database-models-1iz9u29nwn37/"
162
+ } , {
163
+ title : "Analysing Sleep Patterns: The Quantified Self" ,
164
+ content : "https://quantifiedself.com/get-started/"
165
+ } , {
166
+ title : "Prisma 2 Docs" ,
167
+ content : "https://www.prisma.io/docs/"
168
+ } ]
169
+ }
170
+ } ;
171
+ const seedUser2 = {
172
+
173
+ name : "Toru Takemitsu" ,
174
+ profile : {
175
+ create : {
176
+ bio : "Musician"
177
+ }
178
+ } ,
179
+ posts : {
180
+ create : [ {
181
+ title : "Requiem for String Orchestra" ,
182
+ content : ""
183
+ } , {
184
+ title : "Music of Tree" ,
185
+ content : ""
186
+ } , {
187
+ title : "Waves for clarinet, horn, two trombones and bass drum " ,
188
+ content : ""
189
+ } ]
190
+ }
191
+ } ;
192
+
193
+ /***/ } ) ,
194
+
195
+ /***/ "GX0O" :
196
+ /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
197
+
198
+ "use strict" ;
199
+ __webpack_require__ . r ( __webpack_exports__ ) ;
200
+
201
+
202
+
203
+ /* harmony default export */ __webpack_exports__ [ "default" ] = ( function ( ctx ) {
204
+ return Promise . all ( [ ] )
205
+ } ) ;
206
+
207
+
208
+ /***/ } ) ,
209
+
210
+ /***/ "Jt6k" :
211
+ /***/ ( function ( module , exports ) {
212
+
213
+ module . exports = require ( "next/dist/next-server/lib/router/utils/path-match" ) ;
214
+
215
+ /***/ } ) ,
216
+
217
+ /***/ "KqAr" :
218
+ /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
219
+
220
+ "use strict" ;
221
+ __webpack_require__ . r ( __webpack_exports__ ) ;
222
+
223
+
224
+
225
+ /* harmony default export */ __webpack_exports__ [ "default" ] = ( function ( ctx ) {
226
+ return Promise . all ( [ ] )
227
+ } ) ;
228
+
229
+
230
+ /***/ } ) ,
231
+
232
+ /***/ "Skye" :
233
+ /***/ ( function ( module ) {
234
+
235
+ module . exports = JSON . parse ( "{\"version\":3,\"pages404\":true,\"basePath\":\"\",\"redirects\":[{\"source\":\"/:path+/\",\"destination\":\"/:path+\",\"statusCode\":308,\"regex\":\"^(?:/((?:[^/]+?)(?:/(?:[^/]+?))*))/$\"}],\"rewrites\":[],\"headers\":[],\"dynamicRoutes\":[],\"dataRoutes\":[]}" ) ;
236
+
237
+ /***/ } ) ,
238
+
239
+ /***/ "bzos" :
240
+ /***/ ( function ( module , exports ) {
241
+
242
+ module . exports = require ( "url" ) ;
243
+
244
+ /***/ } ) ,
245
+
246
+ /***/ "mctB" :
247
+ /***/ ( function ( module , exports ) {
248
+
249
+ module . exports = require ( "next/dist/next-server/server/node-polyfill-fetch" ) ;
250
+
251
+ /***/ } ) ,
252
+
253
+ /***/ "rLki" :
254
+ /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
255
+
256
+ "use strict" ;
257
+ __webpack_require__ . r ( __webpack_exports__ ) ;
258
+ /* harmony import */ var next_plugin_loader_middleware_on_init_server___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__ ( "GX0O" ) ;
259
+ /* harmony import */ var next_plugin_loader_middleware_on_error_server___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__ ( "KqAr" ) ;
260
+ /* harmony import */ var next_dist_next_server_server_node_polyfill_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__ ( "mctB" ) ;
261
+ /* harmony import */ var next_dist_next_server_server_node_polyfill_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__ . n ( next_dist_next_server_server_node_polyfill_fetch__WEBPACK_IMPORTED_MODULE_2__ ) ;
262
+
263
+
264
+
265
+
266
+
267
+
268
+ const { processEnv } = __webpack_require__ ( "3fKi" )
269
+ processEnv ( [ ] )
270
+
271
+
272
+ const runtimeConfig = { }
273
+
274
+ const { parse : parseUrl } = __webpack_require__ ( "bzos" )
275
+ const { apiResolver } = __webpack_require__ ( "+/F5" )
276
+
277
+ const { rewrites } = __webpack_require__ ( "Skye" )
278
+ const { pathToRegexp, default : pathMatch } = __webpack_require__ ( "Jt6k" )
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+ const getCustomRouteMatcher = pathMatch ( true )
289
+ const prepareDestination = __webpack_require__ ( "tO8J" ) . default
290
+
291
+ function handleRewrites ( parsedUrl ) {
292
+ for ( const rewrite of rewrites ) {
293
+ const matcher = getCustomRouteMatcher ( rewrite . source )
294
+ const params = matcher ( parsedUrl . pathname )
295
+
296
+ if ( params ) {
297
+ const { parsedDestination } = prepareDestination (
298
+ rewrite . destination ,
299
+ params ,
300
+ parsedUrl . query ,
301
+ true ,
302
+ ""
303
+ )
304
+
305
+ Object . assign ( parsedUrl . query , parsedDestination . query )
306
+ delete parsedDestination . query
307
+
308
+ Object . assign ( parsedUrl , parsedDestination )
309
+
310
+ if ( parsedUrl . pathname === '/api/test' ) {
311
+ break
312
+ }
313
+
314
+ }
315
+ }
316
+
317
+ return parsedUrl
318
+ }
319
+
320
+
321
+ /* harmony default export */ __webpack_exports__ [ "default" ] = ( async ( req , res ) => {
322
+ try {
323
+ await Object ( next_plugin_loader_middleware_on_init_server___WEBPACK_IMPORTED_MODULE_0__ [ "default" ] ) ( )
324
+
325
+ // We need to trust the dynamic route params from the proxy
326
+ // to ensure we are using the correct values
327
+ const trustQuery = req . headers [ 'x-vercel-id' ]
328
+ const parsedUrl = handleRewrites ( parseUrl ( req . url , true ) )
329
+
330
+
331
+
332
+ const params = { }
333
+
334
+ const resolver = __webpack_require__ ( "7Sw3" )
335
+ await apiResolver (
336
+ req ,
337
+ res ,
338
+ Object . assign ( { } , parsedUrl . query , params ) ,
339
+ resolver ,
340
+ { previewModeId :"ecc8a452633006e1bae37e89cba562e8" , previewModeSigningKey :"4593d6e33371dd69b1358b72e85afdec01824d89aededfd819e8fc5013c8e08f" , previewModeEncryptionKey :"173bc061962779a8d766149abcd84840537d30d89c98a5c2948cd8086348c512" } ,
341
+ true ,
342
+ next_plugin_loader_middleware_on_error_server___WEBPACK_IMPORTED_MODULE_1__ [ "default" ]
343
+ )
344
+ } catch ( err ) {
345
+ console . error ( err )
346
+ await Object ( next_plugin_loader_middleware_on_error_server___WEBPACK_IMPORTED_MODULE_1__ [ "default" ] ) ( err )
347
+
348
+ // TODO: better error for DECODE_FAILED?
349
+ if ( err . code === 'DECODE_FAILED' ) {
350
+ res . statusCode = 400
351
+ res . end ( 'Bad Request' )
352
+ } else {
353
+ // Throw the error to crash the serverless function
354
+ throw err
355
+ }
356
+ }
357
+ } ) ;
358
+
359
+
360
+ /***/ } ) ,
361
+
362
+ /***/ "tO8J" :
363
+ /***/ ( function ( module , exports ) {
364
+
365
+ module . exports = require ( "next/dist/next-server/lib/router/utils/prepare-destination" ) ;
366
+
367
+ /***/ } )
368
+
369
+ /******/ } ) ;
0 commit comments