@platformatic/next 2.62.1 → 2.63.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
@@ -40,6 +40,14 @@ export interface PlatformaticNextJsStackable {
40
40
  [k: string]: unknown;
41
41
  };
42
42
  };
43
+ formatters?: {
44
+ path: string;
45
+ };
46
+ timestamp?: "epochTime" | "unixTime" | "nullTime" | "isoTime";
47
+ redact?: {
48
+ paths: string[];
49
+ censor?: string;
50
+ };
43
51
  [k: string]: unknown;
44
52
  };
45
53
  server?: {
@@ -1,4 +1,4 @@
1
- import { ensureLoggableError } from '@platformatic/utils'
1
+ import { buildPinoFormatters, buildPinoTimestamp, ensureLoggableError } from '@platformatic/utils'
2
2
  import { Redis } from 'iovalkey'
3
3
  import { pack, unpack } from 'msgpackr'
4
4
  import { existsSync, readFileSync } from 'node:fs'
@@ -98,7 +98,7 @@ export class CacheHandler {
98
98
  }
99
99
 
100
100
  async get (cacheKey, _, isRedisKey) {
101
- this.#logger.trace({ key: cacheKey }, 'get')
101
+ this.#logger.trace({ key: cacheKey }, 'cache get')
102
102
 
103
103
  const key = this.#standalone || isRedisKey ? cacheKey : this.#keyFor(cacheKey, sections.values)
104
104
 
@@ -149,7 +149,7 @@ export class CacheHandler {
149
149
  const tags = ctx.tags
150
150
  const revalidate = ctx.revalidate ?? ctx.cacheControl?.revalidate ?? value.revalidate ?? 0
151
151
 
152
- this.#logger.trace({ key: cacheKey, value, tags, revalidate }, 'set')
152
+ this.#logger.trace({ key: cacheKey, value, tags, revalidate }, 'cache set')
153
153
 
154
154
  const key = this.#standalone || isRedisKey ? cacheKey : this.#keyFor(cacheKey, sections.values)
155
155
 
@@ -192,7 +192,7 @@ export class CacheHandler {
192
192
  }
193
193
 
194
194
  async remove (cacheKey, isRedisKey) {
195
- this.#logger.trace({ key: cacheKey }, 'remove')
195
+ this.#logger.trace({ key: cacheKey }, 'cache remove')
196
196
 
197
197
  const key = this.#standalone || isRedisKey ? cacheKey : this.#keyFor(cacheKey, sections.values)
198
198
 
@@ -242,7 +242,7 @@ export class CacheHandler {
242
242
  }
243
243
 
244
244
  async revalidateTag (tags) {
245
- this.#logger.trace({ tags }, 'revalidateTag')
245
+ this.#logger.trace({ tags }, 'cache revalidateTag')
246
246
 
247
247
  if (typeof tags === 'string') {
248
248
  tags = [tags]
@@ -300,8 +300,17 @@ export class CacheHandler {
300
300
  }
301
301
 
302
302
  #createPlatformaticLogger () {
303
+ const loggerConfig = globalThis.platformatic?.config?.logger
304
+
303
305
  const pinoOptions = {
304
- level: globalThis.platformatic?.logLevel ?? 'info'
306
+ ...loggerConfig,
307
+ level: globalThis.platformatic?.logLevel ?? loggerConfig?.level ?? 'info'
308
+ }
309
+ if (pinoOptions.formatters) {
310
+ pinoOptions.formatters = buildPinoFormatters(pinoOptions.formatters)
311
+ }
312
+ if (pinoOptions.timestamp) {
313
+ pinoOptions.timestamp = buildPinoTimestamp(pinoOptions.timestamp)
305
314
  }
306
315
 
307
316
  if (this.serviceId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/next",
3
- "version": "2.62.1",
3
+ "version": "2.63.0",
4
4
  "description": "Platformatic Next.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,14 +23,14 @@
23
23
  "iovalkey": "^0.3.0",
24
24
  "msgpackr": "^1.11.2",
25
25
  "semver": "^7.6.3",
26
- "@platformatic/basic": "2.62.1",
27
- "@platformatic/utils": "2.62.1",
28
- "@platformatic/config": "2.62.1"
26
+ "@platformatic/basic": "2.63.0",
27
+ "@platformatic/config": "2.63.0",
28
+ "@platformatic/utils": "2.63.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@fastify/reply-from": "^12.0.0",
32
32
  "@types/node": "^22.5.0",
33
- "borp": "^0.19.0",
33
+ "borp": "^0.20.0",
34
34
  "eslint": "9",
35
35
  "execa": "^9.5.1",
36
36
  "fastify": "^5.0.0",
@@ -41,8 +41,8 @@
41
41
  "react-dom": "^18.3.1",
42
42
  "typescript": "^5.5.4",
43
43
  "ws": "^8.18.0",
44
- "@platformatic/composer": "2.62.1",
45
- "@platformatic/service": "2.62.1"
44
+ "@platformatic/composer": "2.63.0",
45
+ "@platformatic/service": "2.63.0"
46
46
  },
47
47
  "scripts": {
48
48
  "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.62.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/2.63.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Stackable",
5
5
  "type": "object",
@@ -95,6 +95,46 @@
95
95
  }
96
96
  },
97
97
  "additionalProperties": false
98
+ },
99
+ "formatters": {
100
+ "type": "object",
101
+ "properties": {
102
+ "path": {
103
+ "type": "string",
104
+ "resolvePath": true
105
+ }
106
+ },
107
+ "required": [
108
+ "path"
109
+ ],
110
+ "additionalProperties": false
111
+ },
112
+ "timestamp": {
113
+ "enum": [
114
+ "epochTime",
115
+ "unixTime",
116
+ "nullTime",
117
+ "isoTime"
118
+ ]
119
+ },
120
+ "redact": {
121
+ "type": "object",
122
+ "properties": {
123
+ "paths": {
124
+ "type": "array",
125
+ "items": {
126
+ "type": "string"
127
+ }
128
+ },
129
+ "censor": {
130
+ "type": "string",
131
+ "default": "[redacted]"
132
+ }
133
+ },
134
+ "required": [
135
+ "paths"
136
+ ],
137
+ "additionalProperties": false
98
138
  }
99
139
  },
100
140
  "required": [