@platformatic/node 2.0.0-alpha.13 → 2.0.0-alpha.15

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
@@ -165,6 +165,10 @@ export interface PlatformaticNodeJsStackable {
165
165
  };
166
166
  };
167
167
  node?: {
168
- entrypoint?: string;
168
+ main?: string;
169
+ /**
170
+ * This Node.js application requires the Absolute URL from the Composer
171
+ */
172
+ absoluteUrl?: boolean;
169
173
  };
170
174
  }
package/index.js CHANGED
@@ -167,10 +167,13 @@ export class NodeStackable extends BaseStackable {
167
167
  let res
168
168
 
169
169
  if (this.url) {
170
+ this.logger.trace({ injectParams, url: this.url }, 'injecting via request')
170
171
  res = await injectViaRequest(this.url, injectParams, onInject)
171
172
  } else if (this.#isFastify) {
173
+ this.logger.trace({ injectParams }, 'injecting via fastify')
172
174
  res = await this.#app.inject(injectParams, onInject)
173
175
  } else {
176
+ this.logger.trace({ injectParams }, 'injecting via light-my-request')
174
177
  res = await inject(this.#dispatcher ?? this.#app, injectParams, onInject)
175
178
  }
176
179
 
@@ -185,9 +188,14 @@ export class NodeStackable extends BaseStackable {
185
188
  return { statusCode, headers, body, payload, rawPayload }
186
189
  }
187
190
 
191
+ _getWantsAbsoluteUrls () {
192
+ const config = this.configManager.current
193
+ return config.node.absoluteUrl
194
+ }
195
+
188
196
  getMeta () {
189
197
  const config = this.configManager.current
190
- let composer = { prefix: this.servicePrefix, wantsAbsoluteUrls: true, needsRootRedirect: true }
198
+ let composer = { prefix: this.servicePrefix, wantsAbsoluteUrls: this._getWantsAbsoluteUrls(), needsRootRedirect: true }
191
199
 
192
200
  if (this.url) {
193
201
  composer = {
@@ -196,7 +204,7 @@ export class NodeStackable extends BaseStackable {
196
204
  prefix: config.application?.basePath
197
205
  ? ensureTrailingSlash(cleanBasePath(config.application?.basePath))
198
206
  : this.servicePrefix,
199
- wantsAbsoluteUrls: true,
207
+ wantsAbsoluteUrls: this._getWantsAbsoluteUrls(),
200
208
  needsRootRedirect: true
201
209
  }
202
210
  }
@@ -234,8 +242,8 @@ export class NodeStackable extends BaseStackable {
234
242
  const config = this.configManager.current
235
243
  const outputRoot = resolve(this.root, config.application.outputDirectory)
236
244
 
237
- if (config.node.entrypoint) {
238
- return pathResolve(this.root, config.node.entrypoint)
245
+ if (config.node.main) {
246
+ return pathResolve(this.root, config.node.main)
239
247
  }
240
248
 
241
249
  const { entrypoint, hadEntrypointField } = await getEntrypointInformation(this.root)
package/lib/schema.js CHANGED
@@ -7,8 +7,13 @@ export const packageJson = JSON.parse(readFileSync(new URL('../package.json', im
7
7
  const node = {
8
8
  type: 'object',
9
9
  properties: {
10
- entrypoint: {
11
- type: 'string'
10
+ main: {
11
+ type: 'string',
12
+ },
13
+ absoluteUrl: {
14
+ description: 'This Node.js application requires the Absolute URL from the Composer',
15
+ type: 'boolean',
16
+ default: false,
12
17
  }
13
18
  },
14
19
  default: {},
@@ -18,7 +23,7 @@ const node = {
18
23
  export const schemaComponents = { node }
19
24
 
20
25
  export const schema = {
21
- $id: `https://schemas.platformatic.dev/@platformatic/vite/${packageJson.version}.json`,
26
+ $id: `https://schemas.platformatic.dev/@platformatic/node/${packageJson.version}.json`,
22
27
  $schema: 'http://json-schema.org/draft-07/schema#',
23
28
  title: 'Platformatic Node.js Stackable',
24
29
  type: 'object',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/node",
3
- "version": "2.0.0-alpha.13",
3
+ "version": "2.0.0-alpha.15",
4
4
  "description": "Platformatic Node.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -16,21 +16,21 @@
16
16
  "homepage": "https://github.com/platformatic/platformatic#readme",
17
17
  "dependencies": {
18
18
  "light-my-request": "^6.0.0",
19
- "@platformatic/basic": "2.0.0-alpha.13",
20
- "@platformatic/utils": "2.0.0-alpha.13",
21
- "@platformatic/config": "2.0.0-alpha.13"
19
+ "@platformatic/basic": "2.0.0-alpha.15",
20
+ "@platformatic/utils": "2.0.0-alpha.15",
21
+ "@platformatic/config": "2.0.0-alpha.15"
22
22
  },
23
23
  "devDependencies": {
24
24
  "borp": "^0.17.0",
25
25
  "express": "^4.19.2",
26
26
  "eslint": "9",
27
- "fastify": "5.0.0-alpha.4",
27
+ "fastify": "^5.0.0",
28
28
  "json-schema-to-typescript": "^15.0.1",
29
29
  "neostandard": "^0.11.1",
30
30
  "tsx": "^4.19.0",
31
31
  "typescript": "^5.5.4",
32
- "@platformatic/composer": "2.0.0-alpha.13",
33
- "@platformatic/service": "2.0.0-alpha.13"
32
+ "@platformatic/composer": "2.0.0-alpha.15",
33
+ "@platformatic/service": "2.0.0-alpha.15"
34
34
  },
35
35
  "scripts": {
36
36
  "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/vite/2.0.0-alpha.13.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/node/2.0.0-alpha.15.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Node.js Stackable",
5
5
  "type": "object",
@@ -541,8 +541,13 @@
541
541
  "node": {
542
542
  "type": "object",
543
543
  "properties": {
544
- "entrypoint": {
544
+ "main": {
545
545
  "type": "string"
546
+ },
547
+ "absoluteUrl": {
548
+ "description": "This Node.js application requires the Absolute URL from the Composer",
549
+ "type": "boolean",
550
+ "default": false
546
551
  }
547
552
  },
548
553
  "default": {},