@platformatic/basic 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 +7 -2
- package/lib/worker/child-manager.js +2 -1
- package/package.json +5 -5
- package/schema.json +29 -1
package/config.d.ts
CHANGED
|
@@ -342,6 +342,15 @@ export interface PlatformaticBasicConfig {
|
|
|
342
342
|
maxRetries?: number;
|
|
343
343
|
[k: string]: unknown;
|
|
344
344
|
}[];
|
|
345
|
+
policies?: {
|
|
346
|
+
deny: {
|
|
347
|
+
/**
|
|
348
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
349
|
+
* via the `patternProperty` "^.*$".
|
|
350
|
+
*/
|
|
351
|
+
[k: string]: string | [string, ...string[]];
|
|
352
|
+
};
|
|
353
|
+
};
|
|
345
354
|
};
|
|
346
355
|
[k: string]: unknown;
|
|
347
356
|
}
|
package/lib/capability.js
CHANGED
|
@@ -135,9 +135,15 @@ export class BaseCapability extends EventEmitter {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
await this.updateContext()
|
|
138
|
+
this.updateStatus('init')
|
|
138
139
|
this.status = 'init'
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
updateStatus (status) {
|
|
143
|
+
this.status = status
|
|
144
|
+
this.emit(status)
|
|
145
|
+
}
|
|
146
|
+
|
|
141
147
|
updateContext (_context) {
|
|
142
148
|
// No-op by default
|
|
143
149
|
}
|
|
@@ -150,8 +156,6 @@ export class BaseCapability extends EventEmitter {
|
|
|
150
156
|
if (this.#pendingDependenciesWaits.size > 0) {
|
|
151
157
|
await Promise.allSettled(this.#pendingDependenciesWaits)
|
|
152
158
|
}
|
|
153
|
-
|
|
154
|
-
this.status = 'stopped'
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
build () {
|
|
@@ -425,6 +429,7 @@ export class BaseCapability extends EventEmitter {
|
|
|
425
429
|
} finally {
|
|
426
430
|
await this.childManager?.eject()
|
|
427
431
|
await this.childManager?.close()
|
|
432
|
+
this.childManager = null
|
|
428
433
|
}
|
|
429
434
|
}
|
|
430
435
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createDirectory, ensureLoggableError } from '@platformatic/foundation'
|
|
2
2
|
import { ITC } from '@platformatic/itc/lib/index.js'
|
|
3
|
+
import { randomBytes } from 'node:crypto'
|
|
3
4
|
import { once } from 'node:events'
|
|
4
5
|
import { rm, writeFile } from 'node:fs/promises'
|
|
5
6
|
import { createServer } from 'node:http'
|
|
@@ -17,7 +18,7 @@ export const isWindows = platform() === 'win32'
|
|
|
17
18
|
// In theory we could use the context.id to namespace even more, but due to
|
|
18
19
|
// UNIX socket length limitation on MacOS, we don't.
|
|
19
20
|
export function generateChildrenId (context) {
|
|
20
|
-
return [process.pid,
|
|
21
|
+
return [process.pid, randomBytes(4).toString('hex')].join('-')
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export function getSocketPath (id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/basic",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"split2": "^4.2.0",
|
|
26
26
|
"undici": "^7.0.0",
|
|
27
27
|
"ws": "^8.18.0",
|
|
28
|
-
"@platformatic/foundation": "3.
|
|
29
|
-
"@platformatic/itc": "3.
|
|
30
|
-
"@platformatic/
|
|
31
|
-
"@platformatic/
|
|
28
|
+
"@platformatic/foundation": "3.13.0",
|
|
29
|
+
"@platformatic/itc": "3.13.0",
|
|
30
|
+
"@platformatic/telemetry": "3.13.0",
|
|
31
|
+
"@platformatic/metrics": "3.13.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"cleaner-spec-reporter": "^0.5.0",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/basic/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/basic/3.13.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Basic Config",
|
|
5
5
|
"type": "object",
|
|
@@ -1380,6 +1380,34 @@
|
|
|
1380
1380
|
"callbackUrl"
|
|
1381
1381
|
]
|
|
1382
1382
|
}
|
|
1383
|
+
},
|
|
1384
|
+
"policies": {
|
|
1385
|
+
"type": "object",
|
|
1386
|
+
"properties": {
|
|
1387
|
+
"deny": {
|
|
1388
|
+
"type": "object",
|
|
1389
|
+
"patternProperties": {
|
|
1390
|
+
"^.*$": {
|
|
1391
|
+
"oneOf": [
|
|
1392
|
+
{
|
|
1393
|
+
"type": "string"
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
"type": "array",
|
|
1397
|
+
"items": {
|
|
1398
|
+
"type": "string"
|
|
1399
|
+
},
|
|
1400
|
+
"minItems": 1
|
|
1401
|
+
}
|
|
1402
|
+
]
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
},
|
|
1407
|
+
"required": [
|
|
1408
|
+
"deny"
|
|
1409
|
+
],
|
|
1410
|
+
"additionalProperties": false
|
|
1383
1411
|
}
|
|
1384
1412
|
},
|
|
1385
1413
|
"additionalProperties": false
|