@platformatic/next 2.0.0-alpha.8 → 2.0.0

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/config.d.ts CHANGED
@@ -7,83 +7,48 @@
7
7
 
8
8
  export interface PlatformaticNextJsStackable {
9
9
  $schema?: string;
10
- server?: {
11
- hostname?: string;
12
- port?: number | string;
13
- pluginTimeout?: number;
14
- healthCheck?:
15
- | boolean
10
+ logger?: {
11
+ level: (
12
+ | ("fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent")
16
13
  | {
17
- enabled?: boolean;
18
- interval?: number;
19
14
  [k: string]: unknown;
20
- };
21
- ignoreTrailingSlash?: boolean;
22
- ignoreDuplicateSlashes?: boolean;
23
- connectionTimeout?: number;
24
- keepAliveTimeout?: number;
25
- maxRequestsPerSocket?: number;
26
- forceCloseConnections?: boolean | string;
27
- requestTimeout?: number;
28
- bodyLimit?: number;
29
- maxParamLength?: number;
30
- disableRequestLogging?: boolean;
31
- exposeHeadRoutes?: boolean;
32
- logger?:
33
- | boolean
15
+ }
16
+ ) &
17
+ string;
18
+ transport?:
34
19
  | {
35
- level?: string;
36
- transport?:
37
- | {
38
- target?: string;
39
- options?: {
40
- [k: string]: unknown;
41
- };
42
- }
43
- | {
44
- targets?: {
45
- target?: string;
46
- options?: {
47
- [k: string]: unknown;
48
- };
49
- level?: string;
50
- additionalProperties?: never;
51
- [k: string]: unknown;
52
- }[];
53
- options?: {
54
- [k: string]: unknown;
55
- };
56
- };
57
- pipeline?: {
20
+ target?: string;
21
+ options?: {
22
+ [k: string]: unknown;
23
+ };
24
+ }
25
+ | {
26
+ targets?: {
58
27
  target?: string;
59
28
  options?: {
60
29
  [k: string]: unknown;
61
30
  };
31
+ level?: string;
32
+ additionalProperties?: never;
33
+ [k: string]: unknown;
34
+ }[];
35
+ options?: {
36
+ [k: string]: unknown;
62
37
  };
63
- [k: string]: unknown;
64
38
  };
65
- serializerOpts?: {
66
- schema?: {
67
- [k: string]: unknown;
68
- };
69
- ajv?: {
39
+ pipeline?: {
40
+ target?: string;
41
+ options?: {
70
42
  [k: string]: unknown;
71
43
  };
72
- rounding?: "floor" | "ceil" | "round" | "trunc";
73
- debugMode?: boolean;
74
- mode?: "debug" | "standalone";
75
- largeArraySize?: number | string;
76
- largeArrayMechanism?: "default" | "json-stringify";
77
- [k: string]: unknown;
78
44
  };
79
- caseSensitive?: boolean;
80
- requestIdHeader?: string | false;
81
- requestIdLogLabel?: string;
82
- jsonShorthand?: boolean;
83
- trustProxy?: boolean | string | string[] | number;
45
+ [k: string]: unknown;
46
+ };
47
+ server?: {
48
+ hostname?: string;
49
+ port?: number | string;
84
50
  http2?: boolean;
85
51
  https?: {
86
- allowHTTP1?: boolean;
87
52
  key:
88
53
  | string
89
54
  | {
@@ -106,37 +71,6 @@ export interface PlatformaticNextJsStackable {
106
71
  path?: string;
107
72
  }
108
73
  )[];
109
- requestCert?: boolean;
110
- rejectUnauthorized?: boolean;
111
- };
112
- cors?: {
113
- origin?:
114
- | boolean
115
- | string
116
- | (
117
- | string
118
- | {
119
- regexp: string;
120
- [k: string]: unknown;
121
- }
122
- )[]
123
- | {
124
- regexp: string;
125
- [k: string]: unknown;
126
- };
127
- methods?: string[];
128
- /**
129
- * Comma separated string of allowed headers.
130
- */
131
- allowedHeaders?: string;
132
- exposedHeaders?: string[] | string;
133
- credentials?: boolean;
134
- maxAge?: number;
135
- preflightContinue?: boolean;
136
- optionsSuccessStatus?: number;
137
- preflight?: boolean;
138
- strictPreflight?: boolean;
139
- hideOptionsRoute?: boolean;
140
74
  };
141
75
  };
142
76
  watch?:
package/index.js CHANGED
@@ -141,7 +141,8 @@ export class NextStackable extends BaseStackable {
141
141
  // Always use URL to avoid serialization problem in Windows
142
142
  root: pathToFileURL(this.root).toString(),
143
143
  basePath: this.#basePath,
144
- logLevel: this.logger.level
144
+ logLevel: this.logger.level,
145
+ port: false
145
146
  }
146
147
  })
147
148
 
@@ -238,7 +239,13 @@ function transformConfig () {
238
239
  export async function buildStackable (opts) {
239
240
  const root = opts.context.directory
240
241
 
241
- const configManager = new ConfigManager({ schema, source: opts.config ?? {}, schemaOptions, transformConfig })
242
+ const configManager = new ConfigManager({
243
+ schema,
244
+ source: opts.config ?? {},
245
+ schemaOptions,
246
+ transformConfig,
247
+ dirname: root
248
+ })
242
249
  await configManager.parseAndValidate()
243
250
 
244
251
  return new NextStackable(opts, root, configManager)
package/lib/schema.js CHANGED
@@ -13,9 +13,10 @@ export const schema = {
13
13
  $schema: {
14
14
  type: 'string'
15
15
  },
16
+ logger: utilsSchemaComponents.logger,
16
17
  server: utilsSchemaComponents.server,
17
18
  watch: schemaComponents.watch,
18
- application: schemaComponents.application,
19
+ application: schemaComponents.application
19
20
  },
20
21
  additionalProperties: false
21
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/next",
3
- "version": "2.0.0-alpha.8",
3
+ "version": "2.0.0",
4
4
  "description": "Platformatic Next.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -20,14 +20,15 @@
20
20
  "@babel/traverse": "^7.25.3",
21
21
  "@babel/types": "^7.25.2",
22
22
  "semver": "^7.6.3",
23
- "@platformatic/basic": "2.0.0-alpha.8",
24
- "@platformatic/config": "2.0.0-alpha.8",
25
- "@platformatic/utils": "2.0.0-alpha.8"
23
+ "@platformatic/basic": "2.0.0",
24
+ "@platformatic/config": "2.0.0",
25
+ "@platformatic/utils": "2.0.0"
26
26
  },
27
27
  "devDependencies": {
28
+ "@fastify/reply-from": "^11.0.0",
28
29
  "borp": "^0.17.0",
29
30
  "eslint": "9",
30
- "fastify": "^4.28.1",
31
+ "fastify": "^5.0.0",
31
32
  "json-schema-to-typescript": "^15.0.1",
32
33
  "neostandard": "^0.11.1",
33
34
  "next": "^14.2.5",
@@ -35,8 +36,8 @@
35
36
  "react-dom": "^18.3.1",
36
37
  "typescript": "^5.5.4",
37
38
  "ws": "^8.18.0",
38
- "@platformatic/composer": "2.0.0-alpha.8",
39
- "@platformatic/service": "2.0.0-alpha.8"
39
+ "@platformatic/composer": "2.0.0",
40
+ "@platformatic/service": "2.0.0"
40
41
  },
41
42
  "scripts": {
42
43
  "test": "npm run lint && borp --concurrency=1 --no-timeout",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/next/2.0.0-alpha.8.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/2.0.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Stackable",
5
5
  "type": "object",
@@ -7,246 +7,108 @@
7
7
  "$schema": {
8
8
  "type": "string"
9
9
  },
10
- "server": {
10
+ "logger": {
11
11
  "type": "object",
12
12
  "properties": {
13
- "hostname": {
14
- "type": "string"
15
- },
16
- "port": {
17
- "anyOf": [
13
+ "level": {
14
+ "type": "string",
15
+ "default": "info",
16
+ "oneOf": [
18
17
  {
19
- "type": "integer"
18
+ "enum": [
19
+ "fatal",
20
+ "error",
21
+ "warn",
22
+ "info",
23
+ "debug",
24
+ "trace",
25
+ "silent"
26
+ ]
20
27
  },
21
28
  {
22
- "type": "string"
29
+ "pattern": "^\\{.+\\}$"
23
30
  }
24
31
  ]
25
32
  },
26
- "pluginTimeout": {
27
- "type": "integer"
28
- },
29
- "healthCheck": {
33
+ "transport": {
30
34
  "anyOf": [
31
- {
32
- "type": "boolean"
33
- },
34
35
  {
35
36
  "type": "object",
36
37
  "properties": {
37
- "enabled": {
38
- "type": "boolean"
38
+ "target": {
39
+ "type": "string",
40
+ "resolveModule": true
39
41
  },
40
- "interval": {
41
- "type": "integer"
42
+ "options": {
43
+ "type": "object"
42
44
  }
43
45
  },
44
- "additionalProperties": true
45
- }
46
- ]
47
- },
48
- "ignoreTrailingSlash": {
49
- "type": "boolean"
50
- },
51
- "ignoreDuplicateSlashes": {
52
- "type": "boolean"
53
- },
54
- "connectionTimeout": {
55
- "type": "integer"
56
- },
57
- "keepAliveTimeout": {
58
- "type": "integer",
59
- "default": 5000
60
- },
61
- "maxRequestsPerSocket": {
62
- "type": "integer"
63
- },
64
- "forceCloseConnections": {
65
- "anyOf": [
66
- {
67
- "type": "boolean"
68
- },
69
- {
70
- "type": "string",
71
- "pattern": "^idle$"
72
- }
73
- ]
74
- },
75
- "requestTimeout": {
76
- "type": "integer"
77
- },
78
- "bodyLimit": {
79
- "type": "integer"
80
- },
81
- "maxParamLength": {
82
- "type": "integer"
83
- },
84
- "disableRequestLogging": {
85
- "type": "boolean"
86
- },
87
- "exposeHeadRoutes": {
88
- "type": "boolean"
89
- },
90
- "logger": {
91
- "anyOf": [
92
- {
93
- "type": "boolean"
46
+ "additionalProperties": false
94
47
  },
95
48
  {
96
49
  "type": "object",
97
50
  "properties": {
98
- "level": {
99
- "type": "string"
100
- },
101
- "transport": {
102
- "anyOf": [
103
- {
104
- "type": "object",
105
- "properties": {
106
- "target": {
107
- "type": "string",
108
- "resolveModule": true
109
- },
110
- "options": {
111
- "type": "object"
112
- }
51
+ "targets": {
52
+ "type": "array",
53
+ "items": {
54
+ "type": "object",
55
+ "properties": {
56
+ "target": {
57
+ "type": "string",
58
+ "resolveModule": true
113
59
  },
114
- "additionalProperties": false
115
- },
116
- {
117
- "type": "object",
118
- "properties": {
119
- "targets": {
120
- "type": "array",
121
- "items": {
122
- "type": "object",
123
- "properties": {
124
- "target": {
125
- "type": "string",
126
- "resolveModule": true
127
- },
128
- "options": {
129
- "type": "object"
130
- },
131
- "level": {
132
- "type": "string"
133
- },
134
- "additionalProperties": false
135
- }
136
- }
137
- },
138
- "options": {
139
- "type": "object"
140
- }
60
+ "options": {
61
+ "type": "object"
62
+ },
63
+ "level": {
64
+ "type": "string"
141
65
  },
142
66
  "additionalProperties": false
143
67
  }
144
- ]
68
+ }
145
69
  },
146
- "pipeline": {
147
- "type": "object",
148
- "properties": {
149
- "target": {
150
- "type": "string",
151
- "resolveModule": true
152
- },
153
- "options": {
154
- "type": "object"
155
- }
156
- },
157
- "additionalProperties": false
70
+ "options": {
71
+ "type": "object"
158
72
  }
159
73
  },
160
- "additionalProperties": true
74
+ "additionalProperties": false
161
75
  }
162
76
  ]
163
77
  },
164
- "serializerOpts": {
78
+ "pipeline": {
165
79
  "type": "object",
166
80
  "properties": {
167
- "schema": {
168
- "type": "object"
169
- },
170
- "ajv": {
171
- "type": "object"
172
- },
173
- "rounding": {
81
+ "target": {
174
82
  "type": "string",
175
- "enum": [
176
- "floor",
177
- "ceil",
178
- "round",
179
- "trunc"
180
- ],
181
- "default": "trunc"
83
+ "resolveModule": true
182
84
  },
183
- "debugMode": {
184
- "type": "boolean"
185
- },
186
- "mode": {
187
- "type": "string",
188
- "enum": [
189
- "debug",
190
- "standalone"
191
- ]
192
- },
193
- "largeArraySize": {
194
- "anyOf": [
195
- {
196
- "type": "integer"
197
- },
198
- {
199
- "type": "string"
200
- }
201
- ],
202
- "default": 20000
203
- },
204
- "largeArrayMechanism": {
205
- "type": "string",
206
- "enum": [
207
- "default",
208
- "json-stringify"
209
- ],
210
- "default": "default"
211
- }
212
- }
213
- },
214
- "caseSensitive": {
215
- "type": "boolean"
216
- },
217
- "requestIdHeader": {
218
- "anyOf": [
219
- {
220
- "type": "string"
221
- },
222
- {
223
- "type": "boolean",
224
- "const": false
85
+ "options": {
86
+ "type": "object"
225
87
  }
226
- ]
227
- },
228
- "requestIdLogLabel": {
229
- "type": "string"
230
- },
231
- "jsonShorthand": {
232
- "type": "boolean"
88
+ },
89
+ "additionalProperties": false
90
+ }
91
+ },
92
+ "required": [
93
+ "level"
94
+ ],
95
+ "default": {},
96
+ "additionalProperties": true
97
+ },
98
+ "server": {
99
+ "type": "object",
100
+ "properties": {
101
+ "hostname": {
102
+ "type": "string",
103
+ "default": "127.0.0.1"
233
104
  },
234
- "trustProxy": {
105
+ "port": {
235
106
  "anyOf": [
236
107
  {
237
- "type": "boolean"
108
+ "type": "integer"
238
109
  },
239
110
  {
240
111
  "type": "string"
241
- },
242
- {
243
- "type": "array",
244
- "items": {
245
- "type": "string"
246
- }
247
- },
248
- {
249
- "type": "integer"
250
112
  }
251
113
  ]
252
114
  },
@@ -256,9 +118,6 @@
256
118
  "https": {
257
119
  "type": "object",
258
120
  "properties": {
259
- "allowHTTP1": {
260
- "type": "boolean"
261
- },
262
121
  "key": {
263
122
  "anyOf": [
264
123
  {
@@ -332,12 +191,6 @@
332
191
  }
333
192
  }
334
193
  ]
335
- },
336
- "requestCert": {
337
- "type": "boolean"
338
- },
339
- "rejectUnauthorized": {
340
- "type": "boolean"
341
194
  }
342
195
  },
343
196
  "additionalProperties": false,
@@ -345,105 +198,6 @@
345
198
  "key",
346
199
  "cert"
347
200
  ]
348
- },
349
- "cors": {
350
- "type": "object",
351
- "$comment": "See https://github.com/fastify/fastify-cors",
352
- "properties": {
353
- "origin": {
354
- "anyOf": [
355
- {
356
- "type": "boolean"
357
- },
358
- {
359
- "type": "string"
360
- },
361
- {
362
- "type": "array",
363
- "items": {
364
- "anyOf": [
365
- {
366
- "type": "string"
367
- },
368
- {
369
- "type": "object",
370
- "properties": {
371
- "regexp": {
372
- "type": "string"
373
- }
374
- },
375
- "required": [
376
- "regexp"
377
- ]
378
- }
379
- ]
380
- }
381
- },
382
- {
383
- "type": "object",
384
- "properties": {
385
- "regexp": {
386
- "type": "string"
387
- }
388
- },
389
- "required": [
390
- "regexp"
391
- ]
392
- }
393
- ]
394
- },
395
- "methods": {
396
- "type": "array",
397
- "items": {
398
- "type": "string"
399
- }
400
- },
401
- "allowedHeaders": {
402
- "type": "string",
403
- "description": "Comma separated string of allowed headers."
404
- },
405
- "exposedHeaders": {
406
- "anyOf": [
407
- {
408
- "type": "array",
409
- "items": {
410
- "type": "string"
411
- }
412
- },
413
- {
414
- "type": "string",
415
- "description": "Comma separated string of exposed headers."
416
- }
417
- ]
418
- },
419
- "credentials": {
420
- "type": "boolean"
421
- },
422
- "maxAge": {
423
- "type": "integer"
424
- },
425
- "preflightContinue": {
426
- "type": "boolean",
427
- "default": false
428
- },
429
- "optionsSuccessStatus": {
430
- "type": "integer",
431
- "default": 204
432
- },
433
- "preflight": {
434
- "type": "boolean",
435
- "default": true
436
- },
437
- "strictPreflight": {
438
- "type": "boolean",
439
- "default": true
440
- },
441
- "hideOptionsRoute": {
442
- "type": "boolean",
443
- "default": true
444
- }
445
- },
446
- "additionalProperties": false
447
201
  }
448
202
  },
449
203
  "additionalProperties": false