@platformatic/node 3.11.0 → 3.13.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 +9 -0
- package/lib/capability.js +8 -6
- package/package.json +7 -6
- package/schema.json +29 -1
package/config.d.ts
CHANGED
|
@@ -446,6 +446,15 @@ export interface PlatformaticNodeJsConfig {
|
|
|
446
446
|
maxRetries?: number;
|
|
447
447
|
[k: string]: unknown;
|
|
448
448
|
}[];
|
|
449
|
+
policies?: {
|
|
450
|
+
deny: {
|
|
451
|
+
/**
|
|
452
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
453
|
+
* via the `patternProperty` "^.*$".
|
|
454
|
+
*/
|
|
455
|
+
[k: string]: string | [string, ...string[]];
|
|
456
|
+
};
|
|
457
|
+
};
|
|
449
458
|
};
|
|
450
459
|
node?: {
|
|
451
460
|
main?: string;
|
package/lib/capability.js
CHANGED
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
injectViaRequest
|
|
9
9
|
} from '@platformatic/basic'
|
|
10
10
|
import { features } from '@platformatic/foundation'
|
|
11
|
+
import { Unpromise } from '@watchable/unpromise'
|
|
11
12
|
import inject from 'light-my-request'
|
|
13
|
+
import { once } from 'node:events'
|
|
12
14
|
import { existsSync } from 'node:fs'
|
|
13
15
|
import { readFile } from 'node:fs/promises'
|
|
14
16
|
import { Server } from 'node:http'
|
|
@@ -121,9 +123,8 @@ export class NodeCapability extends BaseCapability {
|
|
|
121
123
|
this.logger.info(`Building application "${this.applicationId}" before starting in development mode ...`)
|
|
122
124
|
try {
|
|
123
125
|
await this.build()
|
|
124
|
-
this.childManager = null
|
|
125
126
|
} catch (e) {
|
|
126
|
-
|
|
127
|
+
throw new Error(`Error while building application "${this.applicationId}": ${e.message}`, { cause: e })
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
|
@@ -150,10 +151,7 @@ export class NodeCapability extends BaseCapability {
|
|
|
150
151
|
// The server promise must be created before requiring the entrypoint even if it's not going to be used
|
|
151
152
|
// at all. Otherwise there is chance we miss the listen event.
|
|
152
153
|
const serverOptions = this.serverConfig
|
|
153
|
-
const serverPromise = createServerListener(
|
|
154
|
-
(this.isEntrypoint ? serverOptions?.port : undefined) ?? true,
|
|
155
|
-
(this.isEntrypoint ? serverOptions?.hostname : undefined) ?? true
|
|
156
|
-
)
|
|
154
|
+
const serverPromise = createServerListener(serverOptions?.port ?? true, serverOptions?.hostname ?? true)
|
|
157
155
|
this.#module = await importFile(finalEntrypoint)
|
|
158
156
|
this.#module = this.#module.default || this.#module
|
|
159
157
|
|
|
@@ -202,6 +200,10 @@ export class NodeCapability extends BaseCapability {
|
|
|
202
200
|
async stop () {
|
|
203
201
|
await super.stop()
|
|
204
202
|
|
|
203
|
+
if (this.status === 'starting') {
|
|
204
|
+
await Unpromise.race([once(this, 'started'), once(this, 'start:error')])
|
|
205
|
+
}
|
|
206
|
+
|
|
205
207
|
if (this.childManager) {
|
|
206
208
|
return this.stopCommand()
|
|
207
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Platformatic Node.js Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@watchable/unpromise": "^1.0.2",
|
|
18
19
|
"json5": "^2.2.3",
|
|
19
20
|
"light-my-request": "^6.0.0",
|
|
20
|
-
"@platformatic/
|
|
21
|
-
"@platformatic/
|
|
22
|
-
"@platformatic/
|
|
21
|
+
"@platformatic/foundation": "3.13.0",
|
|
22
|
+
"@platformatic/basic": "3.13.0",
|
|
23
|
+
"@platformatic/generators": "3.13.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -31,8 +32,8 @@
|
|
|
31
32
|
"neostandard": "^0.12.0",
|
|
32
33
|
"tsx": "^4.19.0",
|
|
33
34
|
"typescript": "^5.5.4",
|
|
34
|
-
"@platformatic/
|
|
35
|
-
"@platformatic/
|
|
35
|
+
"@platformatic/service": "3.13.0",
|
|
36
|
+
"@platformatic/gateway": "3.13.0"
|
|
36
37
|
},
|
|
37
38
|
"engines": {
|
|
38
39
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/node/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/node/3.13.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Node.js Config",
|
|
5
5
|
"type": "object",
|
|
@@ -1738,6 +1738,34 @@
|
|
|
1738
1738
|
"callbackUrl"
|
|
1739
1739
|
]
|
|
1740
1740
|
}
|
|
1741
|
+
},
|
|
1742
|
+
"policies": {
|
|
1743
|
+
"type": "object",
|
|
1744
|
+
"properties": {
|
|
1745
|
+
"deny": {
|
|
1746
|
+
"type": "object",
|
|
1747
|
+
"patternProperties": {
|
|
1748
|
+
"^.*$": {
|
|
1749
|
+
"oneOf": [
|
|
1750
|
+
{
|
|
1751
|
+
"type": "string"
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
"type": "array",
|
|
1755
|
+
"items": {
|
|
1756
|
+
"type": "string"
|
|
1757
|
+
},
|
|
1758
|
+
"minItems": 1
|
|
1759
|
+
}
|
|
1760
|
+
]
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
},
|
|
1765
|
+
"required": [
|
|
1766
|
+
"deny"
|
|
1767
|
+
],
|
|
1768
|
+
"additionalProperties": false
|
|
1741
1769
|
}
|
|
1742
1770
|
},
|
|
1743
1771
|
"additionalProperties": false
|