@milaboratories/pl-middle-layer 1.10.44 → 1.10.46
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -49
- package/dist/index.mjs.map +1 -1
- package/dist/middle_layer/middle_layer.d.ts +3 -0
- package/dist/middle_layer/middle_layer.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/middle_layer/driver_kit.ts +1 -1
- package/src/middle_layer/middle_layer.test.ts +13 -17
- package/src/middle_layer/middle_layer.ts +15 -4
|
@@ -12,9 +12,12 @@ import { MiddleLayerDriverKit } from './driver_kit';
|
|
|
12
12
|
import { DriverKit } from '@platforma-sdk/model';
|
|
13
13
|
import { DownloadUrlDriver } from '@milaboratories/pl-drivers';
|
|
14
14
|
import { V2RegistryProvider } from '../block_registry/registry-v2-provider';
|
|
15
|
+
import { Dispatcher } from 'undici';
|
|
15
16
|
export interface MiddleLayerEnvironment {
|
|
16
17
|
readonly pl: PlClient;
|
|
17
18
|
readonly logger: MiLogger;
|
|
19
|
+
readonly httpDispatcher: Dispatcher;
|
|
20
|
+
readonly retryHttpDispatcher: Dispatcher;
|
|
18
21
|
readonly signer: Signer;
|
|
19
22
|
readonly ops: MiddleLayerOps;
|
|
20
23
|
readonly bpPreparer: BlockPackPreparer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middle_layer.d.ts","sourceRoot":"","sources":["../../src/middle_layer/middle_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,UAAU,EAEX,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"middle_layer.d.ts","sourceRoot":"","sources":["../../src/middle_layer/middle_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,UAAU,EAEX,MAAM,2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B;WACJ,mBAAmB,IAAI,MAAM;IAI3C,8BAA8B;WACV,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC;CAgF9F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-middle-layer",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.46",
|
|
4
4
|
"description": "Pl Middle Layer",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,21 +29,23 @@
|
|
|
29
29
|
"zod": "^3.23.8",
|
|
30
30
|
"@milaboratories/computable": "^2.1.12",
|
|
31
31
|
"@milaboratories/resolve-helper": "^1.0.1",
|
|
32
|
-
"@platforma-sdk/block-tools": "^2.3.
|
|
33
|
-
"@milaboratories/pl-client": "^2.4.
|
|
34
|
-
"@milaboratories/pl-
|
|
35
|
-
"@milaboratories/pl-
|
|
36
|
-
"@milaboratories/pl-model-middle-layer": "^1.4.
|
|
37
|
-
"@milaboratories/pl-tree": "^1.3.
|
|
38
|
-
"@platforma-sdk/model": "^1.
|
|
32
|
+
"@platforma-sdk/block-tools": "^2.3.12",
|
|
33
|
+
"@milaboratories/pl-client": "^2.4.20",
|
|
34
|
+
"@milaboratories/pl-model-common": "^1.3.14",
|
|
35
|
+
"@milaboratories/pl-drivers": "^1.2.30",
|
|
36
|
+
"@milaboratories/pl-model-middle-layer": "^1.4.4",
|
|
37
|
+
"@milaboratories/pl-tree": "^1.3.19",
|
|
38
|
+
"@platforma-sdk/model": "^1.5.40",
|
|
39
39
|
"@milaboratories/ts-helpers": "^1.0.30",
|
|
40
|
-
"@platforma-sdk/workflow-tengo": "1.2.11"
|
|
40
|
+
"@platforma-sdk/workflow-tengo": "1.2.11",
|
|
41
|
+
"@milaboratories/pl-config": "^1.2.2",
|
|
42
|
+
"@milaboratories/pl-local": "^1.2.1"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"typescript": "~5.5.4",
|
|
44
46
|
"vite": "^5.4.8",
|
|
45
47
|
"@types/jest": "^29.5.13",
|
|
46
|
-
"@types/node": "~20.16.
|
|
48
|
+
"@types/node": "~20.16.10",
|
|
47
49
|
"jest": "^29.7.0",
|
|
48
50
|
"@jest/globals": "^29.7.0",
|
|
49
51
|
"ts-jest": "^29.2.5",
|
|
@@ -96,7 +96,7 @@ export async function initDriverKit(
|
|
|
96
96
|
|
|
97
97
|
function checkStorageNamesDoNotIntersect(logger: MiLogger, ops: DriverKitOps) {
|
|
98
98
|
if (ops.localStorageNameToPath.local != os.homedir())
|
|
99
|
-
logger.
|
|
99
|
+
logger.info(`'local' storage with homedir was overwrote: ${ops.localStorageNameToPath.local}`);
|
|
100
100
|
|
|
101
101
|
const platformStorages = Object.keys(ops.platformLocalStorageNameToPath);
|
|
102
102
|
const intersected = Object.keys(ops.localStorageNameToPath).find((name) =>
|
|
@@ -585,29 +585,25 @@ test('should create download-file block, render it and gets outputs from its con
|
|
|
585
585
|
console.dir({ block3StableFrontend }, { depth: 5 });
|
|
586
586
|
|
|
587
587
|
const block3StateComputable = prj.getBlockState(block3Id);
|
|
588
|
-
|
|
588
|
+
|
|
589
|
+
const block3StableState = await block3StateComputable.awaitStableFullValue();
|
|
589
590
|
|
|
590
591
|
console.dir(block3StableState, { depth: 5 });
|
|
591
592
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
)
|
|
596
|
-
|
|
593
|
+
expect((block3StableState.value.outputs!['contentAsJson'] as any).value).toStrictEqual(42);
|
|
594
|
+
const localBlob = (block3StableState.value.outputs!['downloadedBlobContent'] as any)
|
|
595
|
+
.value as LocalBlobHandleAndSize;
|
|
596
|
+
const remoteBlob = (block3StableState.value.outputs!['onDemandBlobContent'] as any)
|
|
597
|
+
.value as RemoteBlobHandleAndSize;
|
|
597
598
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
.value as RemoteBlobHandleAndSize;
|
|
599
|
+
expect(
|
|
600
|
+
Buffer.from(await ml.driverKit.blobDriver.getContent(localBlob.handle)).toString('utf-8')
|
|
601
|
+
).toEqual('42\n');
|
|
602
602
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
expect(
|
|
604
|
+
Buffer.from(await ml.driverKit.blobDriver.getContent(remoteBlob.handle)).toString('utf-8')
|
|
605
|
+
).toEqual('42\n');
|
|
606
606
|
|
|
607
|
-
expect(
|
|
608
|
-
Buffer.from(await ml.driverKit.blobDriver.getContent(remoteBlob.handle)).toString('utf-8')
|
|
609
|
-
).toEqual('42\n');
|
|
610
|
-
}
|
|
611
607
|
});
|
|
612
608
|
});
|
|
613
609
|
|
|
@@ -9,7 +9,12 @@ import { createProjectList, ProjectsField, ProjectsResourceType } from './projec
|
|
|
9
9
|
import { createProject, withProject, withProjectAuthored } from '../mutator/project';
|
|
10
10
|
import { SynchronizedTreeState } from '@milaboratories/pl-tree';
|
|
11
11
|
import { BlockPackPreparer } from '../mutator/block-pack/block_pack';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ConsoleLoggerAdapter,
|
|
14
|
+
HmacSha256Signer,
|
|
15
|
+
MiLogger,
|
|
16
|
+
Signer
|
|
17
|
+
} from '@milaboratories/ts-helpers';
|
|
13
18
|
import { ComputableStableDefined, WatchableValue } from '@milaboratories/computable';
|
|
14
19
|
import { Project } from './project';
|
|
15
20
|
import { DefaultMiddleLayerOps, MiddleLayerOps, MiddleLayerOpsConstructor } from './ops';
|
|
@@ -22,11 +27,13 @@ import { initDriverKit, MiddleLayerDriverKit } from './driver_kit';
|
|
|
22
27
|
import { DriverKit } from '@platforma-sdk/model';
|
|
23
28
|
import { DownloadUrlDriver } from '@milaboratories/pl-drivers';
|
|
24
29
|
import { V2RegistryProvider } from '../block_registry/registry-v2-provider';
|
|
25
|
-
import { RetryAgent } from 'undici';
|
|
30
|
+
import { Dispatcher, RetryAgent } from 'undici';
|
|
26
31
|
|
|
27
32
|
export interface MiddleLayerEnvironment {
|
|
28
33
|
readonly pl: PlClient;
|
|
29
|
-
readonly logger: MiLogger
|
|
34
|
+
readonly logger: MiLogger;
|
|
35
|
+
readonly httpDispatcher: Dispatcher;
|
|
36
|
+
readonly retryHttpDispatcher: Dispatcher;
|
|
30
37
|
readonly signer: Signer;
|
|
31
38
|
readonly ops: MiddleLayerOps;
|
|
32
39
|
readonly bpPreparer: BlockPackPreparer;
|
|
@@ -160,8 +167,10 @@ export class MiddleLayer {
|
|
|
160
167
|
* them. */
|
|
161
168
|
public async close() {
|
|
162
169
|
await Promise.all([...this.openedProjectsByRid.values()].map((prj) => prj.destroy()));
|
|
163
|
-
this.env.quickJs;
|
|
170
|
+
// this.env.quickJs;
|
|
164
171
|
await this.projectListTree.terminate();
|
|
172
|
+
await this.env.retryHttpDispatcher.destroy();
|
|
173
|
+
await this.pl.close();
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
/** @deprecated */
|
|
@@ -229,6 +238,8 @@ export class MiddleLayer {
|
|
|
229
238
|
pl,
|
|
230
239
|
signer: driverKit.signer,
|
|
231
240
|
logger,
|
|
241
|
+
httpDispatcher: pl.httpDispatcher,
|
|
242
|
+
retryHttpDispatcher: retryHttpDispatcher,
|
|
232
243
|
ops,
|
|
233
244
|
bpPreparer,
|
|
234
245
|
frontendDownloadDriver,
|