@milaboratories/pl-middle-layer 1.19.8 → 1.19.10
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/block_registry/registry.d.ts +2 -1
- package/dist/block_registry/registry.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/block_registry/registry.test.ts +18 -0
- package/src/block_registry/registry.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-middle-layer",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.10",
|
|
4
4
|
"description": "Pl Middle Layer",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"yaml": "^2.6.1",
|
|
30
30
|
"zod": "^3.23.8",
|
|
31
31
|
"@milaboratories/computable": "^2.3.3",
|
|
32
|
+
"@milaboratories/resolve-helper": "^1.0.2",
|
|
33
|
+
"@platforma-sdk/block-tools": "^2.4.7",
|
|
32
34
|
"@milaboratories/pl-client": "^2.6.3",
|
|
33
|
-
"@milaboratories/pl-drivers": "^1.4.0",
|
|
34
35
|
"@milaboratories/pl-model-common": "^1.8.0",
|
|
35
|
-
"@milaboratories/pl-tree": "^1.4.18",
|
|
36
36
|
"@milaboratories/pl-model-middle-layer": "^1.6.4",
|
|
37
|
-
"@milaboratories/
|
|
37
|
+
"@milaboratories/pl-drivers": "^1.4.0",
|
|
38
|
+
"@milaboratories/pl-tree": "^1.4.18",
|
|
38
39
|
"@platforma-sdk/model": "^1.14.1",
|
|
39
40
|
"@milaboratories/ts-helpers": "^1.1.2",
|
|
40
41
|
"@platforma-sdk/workflow-tengo": "2.6.0",
|
|
41
|
-
"@milaboratories/pl-
|
|
42
|
-
"@
|
|
43
|
-
"@milaboratories/pl-local": "^1.8.1"
|
|
42
|
+
"@milaboratories/pl-local": "^1.8.2",
|
|
43
|
+
"@milaboratories/pl-config": "^1.3.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "~5.5.4",
|
|
@@ -4,6 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { CentralBlockRegistry } from './well_known_registries';
|
|
5
5
|
import { V2RegistryProvider } from './registry-v2-provider';
|
|
6
6
|
import { Agent } from 'undici';
|
|
7
|
+
import { BlockPackFromRegistryV2 } from '@milaboratories/pl-model-middle-layer';
|
|
7
8
|
|
|
8
9
|
test('testing remote registry', async () => {
|
|
9
10
|
const registry = new BlockPackRegistry(new V2RegistryProvider(new Agent()), [
|
|
@@ -12,3 +13,20 @@ test('testing remote registry', async () => {
|
|
|
12
13
|
const listing = await registry.listBlockPacks();
|
|
13
14
|
expect(listing.blockPacks.length).toBeGreaterThanOrEqual(1);
|
|
14
15
|
});
|
|
16
|
+
|
|
17
|
+
test('testing specific version retrieval', async () => {
|
|
18
|
+
const registry = new BlockPackRegistry(new V2RegistryProvider(new Agent()), [
|
|
19
|
+
{ id: 'central', title: 'Central Block Registry', spec: CentralBlockRegistry }
|
|
20
|
+
]);
|
|
21
|
+
const overview = await registry.getOverview(
|
|
22
|
+
'central',
|
|
23
|
+
{
|
|
24
|
+
name: 'samples-and-data',
|
|
25
|
+
organization: 'milaboratories',
|
|
26
|
+
version: '1.8.5'
|
|
27
|
+
},
|
|
28
|
+
'stable'
|
|
29
|
+
);
|
|
30
|
+
expect((overview.spec as BlockPackFromRegistryV2).id.version).toStrictEqual('1.8.5');
|
|
31
|
+
expect((overview.spec as BlockPackFromRegistryV2).channel).toStrictEqual('stable');
|
|
32
|
+
});
|
|
@@ -14,6 +14,7 @@ import { tryLoadPackDescription } from '@platforma-sdk/block-tools';
|
|
|
14
14
|
import { V2RegistryProvider } from './registry-v2-provider';
|
|
15
15
|
import {
|
|
16
16
|
AnyChannel,
|
|
17
|
+
BlockPackId,
|
|
17
18
|
BlockPackListing,
|
|
18
19
|
BlockPackOverview,
|
|
19
20
|
RegistryEntry,
|
|
@@ -236,4 +237,19 @@ export class BlockPackRegistry {
|
|
|
236
237
|
}
|
|
237
238
|
return { registries, blockPacks };
|
|
238
239
|
}
|
|
240
|
+
|
|
241
|
+
public async getOverview(
|
|
242
|
+
registryId: string,
|
|
243
|
+
blockId: BlockPackId,
|
|
244
|
+
channel: string
|
|
245
|
+
): Promise<SingleBlockPackOverview> {
|
|
246
|
+
const regSpec = this.registries.find((reg) => reg.id === registryId)?.spec;
|
|
247
|
+
if (!regSpec) throw new Error(`Registry with id "${registryId}" not found`);
|
|
248
|
+
if (regSpec.type !== 'remote-v2')
|
|
249
|
+
throw new Error(
|
|
250
|
+
`Only "remote-v2" registries support specific package version overview retrieval.`
|
|
251
|
+
);
|
|
252
|
+
const reg = this.v2Provider.getRegistry(regSpec.url);
|
|
253
|
+
return await reg.getSpecificOverview(blockId, channel);
|
|
254
|
+
}
|
|
239
255
|
}
|