@platformatic/next 2.0.0-alpha.14 → 2.0.0-alpha.16

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,86 +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
- loggerInstance?: {
66
- [k: string]: unknown;
67
- };
68
- serializerOpts?: {
69
- schema?: {
39
+ pipeline?: {
40
+ target?: string;
41
+ options?: {
70
42
  [k: string]: unknown;
71
43
  };
72
- ajv?: {
73
- [k: string]: unknown;
74
- };
75
- rounding?: "floor" | "ceil" | "round" | "trunc";
76
- debugMode?: boolean;
77
- mode?: "debug" | "standalone";
78
- largeArraySize?: number | string;
79
- largeArrayMechanism?: "default" | "json-stringify";
80
- [k: string]: unknown;
81
44
  };
82
- caseSensitive?: boolean;
83
- requestIdHeader?: string | false;
84
- requestIdLogLabel?: string;
85
- jsonShorthand?: boolean;
86
- trustProxy?: boolean | string | string[] | number;
45
+ [k: string]: unknown;
46
+ };
47
+ server?: {
48
+ hostname?: string;
49
+ port?: number | string;
87
50
  http2?: boolean;
88
51
  https?: {
89
- allowHTTP1?: boolean;
90
52
  key:
91
53
  | string
92
54
  | {
@@ -109,37 +71,6 @@ export interface PlatformaticNextJsStackable {
109
71
  path?: string;
110
72
  }
111
73
  )[];
112
- requestCert?: boolean;
113
- rejectUnauthorized?: boolean;
114
- };
115
- cors?: {
116
- origin?:
117
- | boolean
118
- | string
119
- | (
120
- | string
121
- | {
122
- regexp: string;
123
- [k: string]: unknown;
124
- }
125
- )[]
126
- | {
127
- regexp: string;
128
- [k: string]: unknown;
129
- };
130
- methods?: string[];
131
- /**
132
- * Comma separated string of allowed headers.
133
- */
134
- allowedHeaders?: string;
135
- exposedHeaders?: string[] | string;
136
- credentials?: boolean;
137
- maxAge?: number;
138
- preflightContinue?: boolean;
139
- optionsSuccessStatus?: number;
140
- preflight?: boolean;
141
- strictPreflight?: boolean;
142
- hideOptionsRoute?: boolean;
143
74
  };
144
75
  };
145
76
  watch?:
package/index.js CHANGED
@@ -239,7 +239,13 @@ function transformConfig () {
239
239
  export async function buildStackable (opts) {
240
240
  const root = opts.context.directory
241
241
 
242
- 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
+ })
243
249
  await configManager.parseAndValidate()
244
250
 
245
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.14",
3
+ "version": "2.0.0-alpha.16",
4
4
  "description": "Platformatic Next.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -20,9 +20,9 @@
20
20
  "@babel/traverse": "^7.25.3",
21
21
  "@babel/types": "^7.25.2",
22
22
  "semver": "^7.6.3",
23
- "@platformatic/utils": "2.0.0-alpha.14",
24
- "@platformatic/config": "2.0.0-alpha.14",
25
- "@platformatic/basic": "2.0.0-alpha.14"
23
+ "@platformatic/basic": "2.0.0-alpha.16",
24
+ "@platformatic/utils": "2.0.0-alpha.16",
25
+ "@platformatic/config": "2.0.0-alpha.16"
26
26
  },
27
27
  "devDependencies": {
28
28
  "borp": "^0.17.0",
@@ -35,8 +35,8 @@
35
35
  "react-dom": "^18.3.1",
36
36
  "typescript": "^5.5.4",
37
37
  "ws": "^8.18.0",
38
- "@platformatic/service": "2.0.0-alpha.14",
39
- "@platformatic/composer": "2.0.0-alpha.14"
38
+ "@platformatic/composer": "2.0.0-alpha.16",
39
+ "@platformatic/service": "2.0.0-alpha.16"
40
40
  },
41
41
  "scripts": {
42
42
  "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.14.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/2.0.0-alpha.16.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Stackable",
5
5
  "type": "object",
@@ -7,249 +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
- "loggerInstance": {
165
- "type": "object"
166
- },
167
- "serializerOpts": {
78
+ "pipeline": {
168
79
  "type": "object",
169
80
  "properties": {
170
- "schema": {
171
- "type": "object"
172
- },
173
- "ajv": {
174
- "type": "object"
175
- },
176
- "rounding": {
81
+ "target": {
177
82
  "type": "string",
178
- "enum": [
179
- "floor",
180
- "ceil",
181
- "round",
182
- "trunc"
183
- ],
184
- "default": "trunc"
83
+ "resolveModule": true
185
84
  },
186
- "debugMode": {
187
- "type": "boolean"
188
- },
189
- "mode": {
190
- "type": "string",
191
- "enum": [
192
- "debug",
193
- "standalone"
194
- ]
195
- },
196
- "largeArraySize": {
197
- "anyOf": [
198
- {
199
- "type": "integer"
200
- },
201
- {
202
- "type": "string"
203
- }
204
- ],
205
- "default": 20000
206
- },
207
- "largeArrayMechanism": {
208
- "type": "string",
209
- "enum": [
210
- "default",
211
- "json-stringify"
212
- ],
213
- "default": "default"
214
- }
215
- }
216
- },
217
- "caseSensitive": {
218
- "type": "boolean"
219
- },
220
- "requestIdHeader": {
221
- "anyOf": [
222
- {
223
- "type": "string"
224
- },
225
- {
226
- "type": "boolean",
227
- "const": false
85
+ "options": {
86
+ "type": "object"
228
87
  }
229
- ]
230
- },
231
- "requestIdLogLabel": {
232
- "type": "string"
233
- },
234
- "jsonShorthand": {
235
- "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"
236
104
  },
237
- "trustProxy": {
105
+ "port": {
238
106
  "anyOf": [
239
107
  {
240
- "type": "boolean"
108
+ "type": "integer"
241
109
  },
242
110
  {
243
111
  "type": "string"
244
- },
245
- {
246
- "type": "array",
247
- "items": {
248
- "type": "string"
249
- }
250
- },
251
- {
252
- "type": "integer"
253
112
  }
254
113
  ]
255
114
  },
@@ -259,9 +118,6 @@
259
118
  "https": {
260
119
  "type": "object",
261
120
  "properties": {
262
- "allowHTTP1": {
263
- "type": "boolean"
264
- },
265
121
  "key": {
266
122
  "anyOf": [
267
123
  {
@@ -335,12 +191,6 @@
335
191
  }
336
192
  }
337
193
  ]
338
- },
339
- "requestCert": {
340
- "type": "boolean"
341
- },
342
- "rejectUnauthorized": {
343
- "type": "boolean"
344
194
  }
345
195
  },
346
196
  "additionalProperties": false,
@@ -348,105 +198,6 @@
348
198
  "key",
349
199
  "cert"
350
200
  ]
351
- },
352
- "cors": {
353
- "type": "object",
354
- "$comment": "See https://github.com/fastify/fastify-cors",
355
- "properties": {
356
- "origin": {
357
- "anyOf": [
358
- {
359
- "type": "boolean"
360
- },
361
- {
362
- "type": "string"
363
- },
364
- {
365
- "type": "array",
366
- "items": {
367
- "anyOf": [
368
- {
369
- "type": "string"
370
- },
371
- {
372
- "type": "object",
373
- "properties": {
374
- "regexp": {
375
- "type": "string"
376
- }
377
- },
378
- "required": [
379
- "regexp"
380
- ]
381
- }
382
- ]
383
- }
384
- },
385
- {
386
- "type": "object",
387
- "properties": {
388
- "regexp": {
389
- "type": "string"
390
- }
391
- },
392
- "required": [
393
- "regexp"
394
- ]
395
- }
396
- ]
397
- },
398
- "methods": {
399
- "type": "array",
400
- "items": {
401
- "type": "string"
402
- }
403
- },
404
- "allowedHeaders": {
405
- "type": "string",
406
- "description": "Comma separated string of allowed headers."
407
- },
408
- "exposedHeaders": {
409
- "anyOf": [
410
- {
411
- "type": "array",
412
- "items": {
413
- "type": "string"
414
- }
415
- },
416
- {
417
- "type": "string",
418
- "description": "Comma separated string of exposed headers."
419
- }
420
- ]
421
- },
422
- "credentials": {
423
- "type": "boolean"
424
- },
425
- "maxAge": {
426
- "type": "integer"
427
- },
428
- "preflightContinue": {
429
- "type": "boolean",
430
- "default": false
431
- },
432
- "optionsSuccessStatus": {
433
- "type": "integer",
434
- "default": 204
435
- },
436
- "preflight": {
437
- "type": "boolean",
438
- "default": true
439
- },
440
- "strictPreflight": {
441
- "type": "boolean",
442
- "default": true
443
- },
444
- "hideOptionsRoute": {
445
- "type": "boolean",
446
- "default": true
447
- }
448
- },
449
- "additionalProperties": false
450
201
  }
451
202
  },
452
203
  "additionalProperties": false