@platforma-sdk/block-tools 2.2.0 → 2.3.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/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +94 -238
- package/dist/cli.mjs.map +1 -1
- package/dist/config-B1U40s2a.js +3 -0
- package/dist/config-B1U40s2a.js.map +1 -0
- package/dist/config-YukCegnp.mjs +1587 -0
- package/dist/config-YukCegnp.mjs.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -40
- package/dist/index.mjs.map +1 -1
- package/dist/io/folder_reader.d.ts +24 -0
- package/dist/io/folder_reader.d.ts.map +1 -0
- package/dist/io/index.d.ts +3 -0
- package/dist/io/index.d.ts.map +1 -0
- package/dist/io/storage.d.ts.map +1 -0
- package/dist/lib.d.ts +1 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/registry_v1/registry.d.ts +1 -1
- package/dist/registry_v1/registry.d.ts.map +1 -1
- package/dist/registry_v1/v1_repo_schema.d.ts +1 -1
- package/dist/registry_v1/v1_repo_schema.d.ts.map +1 -1
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/model/block_components.d.ts +5 -5
- package/dist/v2/model/block_description.d.ts +48 -48
- package/dist/v2/model/block_meta.d.ts +554 -2
- package/dist/v2/model/block_meta.d.ts.map +1 -1
- package/dist/v2/model/content_conversion.d.ts +3 -1
- package/dist/v2/model/content_conversion.d.ts.map +1 -1
- package/dist/v2/registry/index.d.ts +4 -0
- package/dist/v2/registry/index.d.ts.map +1 -0
- package/dist/v2/registry/registry.d.ts +1 -1
- package/dist/v2/registry/registry.d.ts.map +1 -1
- package/dist/v2/registry/registry_reader.d.ts +12 -0
- package/dist/v2/registry/registry_reader.d.ts.map +1 -0
- package/dist/v2/registry/schema_public.d.ts +1925 -254
- package/dist/v2/registry/schema_public.d.ts.map +1 -1
- package/package.json +7 -4
- package/src/cmd/build-meta.ts +2 -2
- package/src/cmd/publish.ts +1 -1
- package/src/io/folder_reader.test.ts +21 -0
- package/src/io/folder_reader.ts +77 -0
- package/src/io/index.ts +2 -0
- package/src/lib.ts +1 -0
- package/src/registry_v1/config.ts +1 -1
- package/src/registry_v1/registry.test.ts +1 -1
- package/src/registry_v1/registry.ts +1 -1
- package/src/registry_v1/v1_repo_schema.ts +1 -1
- package/src/v2/index.ts +1 -0
- package/src/v2/model/block_meta.ts +23 -5
- package/src/v2/model/content_conversion.ts +30 -1
- package/src/v2/registry/index.ts +3 -0
- package/src/v2/registry/registry.ts +19 -12
- package/src/v2/registry/registry_reader.ts +71 -0
- package/src/v2/registry/schema_public.ts +31 -9
- package/dist/config-DJqN5LSx.js +0 -3
- package/dist/config-DJqN5LSx.js.map +0 -1
- package/dist/config-rGaQLD-7.mjs +0 -1350
- package/dist/config-rGaQLD-7.mjs.map +0 -1
- package/dist/lib/storage.d.ts.map +0 -1
- /package/dist/{lib → io}/storage.d.ts +0 -0
- /package/src/{lib → io}/storage.test.ts +0 -0
- /package/src/{lib → io}/storage.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_public.d.ts","sourceRoot":"","sources":["../../../src/v2/registry/schema_public.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,oBAAoB,
|
|
1
|
+
{"version":3,"file":"schema_public.d.ts","sourceRoot":"","sources":["../../../src/v2/registry/schema_public.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,oBAAoB,EAOrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAqD,MAAM,UAAU,CAAC;AAEpG,eAAO,MAAM,UAAU,QAAQ,CAAC;AAEhC,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AACtD,eAAO,MAAM,uBAAuB,kBAAkB,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUjF;AACD,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,UAAU,CAAC,OAAO,oCAAoC,CAAC,CACxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/block-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Utility to manipulate Platforma Blocks and Block Registry",
|
|
5
5
|
"types": "./dist/lib.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,14 +25,16 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws-sdk/client-s3": "^3.658.1",
|
|
27
27
|
"@oclif/core": "^4.0.23",
|
|
28
|
+
"canonicalize": "^2.0.0",
|
|
29
|
+
"undici": "^6.19.8",
|
|
28
30
|
"mime-types": "^2.1.35",
|
|
29
31
|
"tar": "^7.4.3",
|
|
30
32
|
"yaml": "^2.5.1",
|
|
31
33
|
"zod": "^3.23.8",
|
|
32
34
|
"@milaboratories/resolve-helper": "^1.0.1",
|
|
33
|
-
"@milaboratories/pl-model-middle-layer": "^1.
|
|
34
|
-
"@milaboratories/ts-helpers": "^1.0.
|
|
35
|
-
"@milaboratories/ts-helpers-oclif": "^1.1.
|
|
35
|
+
"@milaboratories/pl-model-middle-layer": "^1.4.0",
|
|
36
|
+
"@milaboratories/ts-helpers": "^1.0.27",
|
|
37
|
+
"@milaboratories/ts-helpers-oclif": "^1.1.5"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"typescript": "~5.5.4",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"@types/node": "~20.16.5",
|
|
47
49
|
"@types/semver": "^7.5.8",
|
|
48
50
|
"jest": "^29.7.0",
|
|
51
|
+
"@jest/globals": "^29.7.0",
|
|
49
52
|
"oclif": "^4.14.35",
|
|
50
53
|
"ts-jest": "^29.2.5",
|
|
51
54
|
"@milaboratories/platforma-build-configs": "1.0.1"
|
package/src/cmd/build-meta.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Command, Flags } from '@oclif/core';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { loadPackDescriptionRaw } from '../v2';
|
|
5
|
-
import { BlockPackMetaDescription,
|
|
5
|
+
import { BlockPackMetaDescription, BlockPackMetaEmbedAbsoluteBase64 } from '../v2/model/block_meta';
|
|
6
6
|
|
|
7
7
|
export default class BuildMeta extends Command {
|
|
8
8
|
static override description =
|
|
@@ -29,7 +29,7 @@ export default class BuildMeta extends Command {
|
|
|
29
29
|
const { flags } = await this.parse(BuildMeta);
|
|
30
30
|
const modulePath = path.resolve(flags.modulePath);
|
|
31
31
|
const descriptionRaw = await loadPackDescriptionRaw(modulePath);
|
|
32
|
-
const metaEmbedded = await
|
|
32
|
+
const metaEmbedded = await BlockPackMetaEmbedAbsoluteBase64.parseAsync(
|
|
33
33
|
BlockPackMetaDescription(modulePath).parse(descriptionRaw.meta)
|
|
34
34
|
);
|
|
35
35
|
|
package/src/cmd/publish.ts
CHANGED
|
@@ -3,7 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import { OclifLoggerAdapter } from '@milaboratories/ts-helpers-oclif';
|
|
4
4
|
import { ManifestFileName } from '../v2/registry/schema_public';
|
|
5
5
|
import { BlockPackManifest } from '@milaboratories/pl-model-middle-layer';
|
|
6
|
-
import { storageByUrl } from '../
|
|
6
|
+
import { storageByUrl } from '../io/storage';
|
|
7
7
|
import { BlockRegistryV2 } from '../v2/registry/registry';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { expect, test } from '@jest/globals';
|
|
2
|
+
import { folderReaderByUrl } from './folder_reader';
|
|
3
|
+
|
|
4
|
+
test('test fs reader', async () => {
|
|
5
|
+
const reader = folderReaderByUrl('file:.');
|
|
6
|
+
const content = await reader.getContentReader()('package.json');
|
|
7
|
+
expect(content).toBeDefined();
|
|
8
|
+
expect(content.length).toBeGreaterThan(10);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('test url reader with slash', async () => {
|
|
12
|
+
const reader = folderReaderByUrl('https://cdn.milaboratory.com/');
|
|
13
|
+
const content = await reader.getContentReader()('ping');
|
|
14
|
+
expect(content?.toString('utf8')).toStrictEqual('pong');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('test url reader without slash', async () => {
|
|
18
|
+
const reader = folderReaderByUrl('https://cdn.milaboratory.com');
|
|
19
|
+
const content = await reader.getContentReader()('ping');
|
|
20
|
+
expect(content?.toString('utf8')).toStrictEqual('pong');
|
|
21
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Agent, Dispatcher, request } from 'undici';
|
|
2
|
+
import { RelativeContentReader } from '../v2';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import pathPosix from 'node:path/posix';
|
|
5
|
+
import fsp from 'node:fs/promises';
|
|
6
|
+
|
|
7
|
+
export interface FolderReader {
|
|
8
|
+
relativeReader(relativePath: string): FolderReader;
|
|
9
|
+
readFile(file: string): Promise<Buffer>;
|
|
10
|
+
getContentReader(relativePath?: string): RelativeContentReader;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class HttpFolderReader implements FolderReader {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly root: URL,
|
|
16
|
+
private readonly httpDispatcher: Dispatcher
|
|
17
|
+
) {}
|
|
18
|
+
|
|
19
|
+
public async readFile(file: string): Promise<Buffer> {
|
|
20
|
+
const targetUrl = new URL(file, this.root);
|
|
21
|
+
const response = await request(targetUrl, {
|
|
22
|
+
dispatcher: this.httpDispatcher
|
|
23
|
+
});
|
|
24
|
+
return Buffer.from(await response.body.arrayBuffer());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public relativeReader(relativePath: string): HttpFolderReader {
|
|
28
|
+
return new HttpFolderReader(new URL(relativePath, this.root), this.httpDispatcher);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public getContentReader(relativePath?: string): RelativeContentReader {
|
|
32
|
+
let reader: HttpFolderReader = this;
|
|
33
|
+
if (relativePath !== undefined) reader = reader.relativeReader(relativePath);
|
|
34
|
+
return (path) => reader.readFile(path);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class FSFolderReader implements FolderReader {
|
|
39
|
+
constructor(private readonly root: string) {}
|
|
40
|
+
|
|
41
|
+
public async readFile(file: string): Promise<Buffer> {
|
|
42
|
+
const targetPath = path.join(this.root, ...file.split(pathPosix.sep));
|
|
43
|
+
return await fsp.readFile(targetPath);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public relativeReader(relativePath: string): FSFolderReader {
|
|
47
|
+
return new FSFolderReader(path.join(this.root, ...relativePath.split(pathPosix.sep)));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public getContentReader(relativePath?: string): RelativeContentReader {
|
|
51
|
+
let reader: FSFolderReader = this;
|
|
52
|
+
if (relativePath !== undefined) reader = reader.relativeReader(relativePath);
|
|
53
|
+
return (path) => reader.readFile(path);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function posixToLocalPath(p: string): string {
|
|
58
|
+
return p.split(pathPosix.sep).join(path.sep);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function localToPosix(p: string): string {
|
|
62
|
+
return p.split(path.sep).join(pathPosix.sep);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function folderReaderByUrl(address: string, httpDispatcher?: Dispatcher): FolderReader {
|
|
66
|
+
const url = new URL(address, `file:${localToPosix(path.resolve('.'))}/`);
|
|
67
|
+
switch (url.protocol) {
|
|
68
|
+
case 'file:':
|
|
69
|
+
const root = posixToLocalPath(url.pathname);
|
|
70
|
+
return new FSFolderReader(root);
|
|
71
|
+
case 'https:':
|
|
72
|
+
case 'http:':
|
|
73
|
+
return new HttpFolderReader(url, httpDispatcher ?? new Agent());
|
|
74
|
+
default:
|
|
75
|
+
throw new Error(`Unknown protocol: ${url.protocol}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
package/src/io/index.ts
ADDED
package/src/lib.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from './config_schema';
|
|
9
9
|
import * as os from 'node:os';
|
|
10
10
|
import { BlockRegistry } from './registry';
|
|
11
|
-
import { storageByUrl } from '../
|
|
11
|
+
import { storageByUrl } from '../io/storage';
|
|
12
12
|
import { FullBlockPackageName } from './v1_repo_schema';
|
|
13
13
|
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
14
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { RegistryStorage,
|
|
3
|
+
import { RegistryStorage, storageByUrl } from '../io';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import { BlockRegistry } from './registry';
|
|
6
6
|
import { ConsoleLoggerAdapter } from '@milaboratories/ts-helpers';
|
package/src/v2/index.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlockPackMeta,
|
|
3
|
-
|
|
3
|
+
BlockPackMetaEmbeddedBase64,
|
|
4
|
+
BlockPackMetaEmbeddedBytes,
|
|
4
5
|
ContentAbsoluteBinaryLocal,
|
|
5
6
|
ContentAbsoluteTextLocal,
|
|
7
|
+
ContentRelativeBinary,
|
|
8
|
+
ContentRelativeText,
|
|
6
9
|
DescriptionContentBinary,
|
|
7
10
|
DescriptionContentText
|
|
8
11
|
} from '@milaboratories/pl-model-middle-layer';
|
|
9
12
|
import {
|
|
10
13
|
absoluteToBase64,
|
|
14
|
+
absoluteToBytes,
|
|
11
15
|
absoluteToString,
|
|
12
16
|
cpAbsoluteToRelative,
|
|
13
|
-
mapLocalToAbsolute
|
|
17
|
+
mapLocalToAbsolute,
|
|
18
|
+
RelativeContentReader,
|
|
19
|
+
relativeToContentString,
|
|
20
|
+
relativeToExplicitBytes
|
|
14
21
|
} from './content_conversion';
|
|
15
22
|
import { z } from 'zod';
|
|
16
23
|
|
|
@@ -29,8 +36,19 @@ export function BlockPackMetaConsolidate(dstFolder: string, fileAccumulator?: st
|
|
|
29
36
|
);
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
export const
|
|
39
|
+
export const BlockPackMetaEmbedAbsoluteBase64 = BlockPackMeta(
|
|
33
40
|
ContentAbsoluteTextLocal.transform(absoluteToString()),
|
|
34
41
|
ContentAbsoluteBinaryLocal.transform(absoluteToBase64())
|
|
35
|
-
).pipe(
|
|
36
|
-
|
|
42
|
+
).pipe(BlockPackMetaEmbeddedBase64);
|
|
43
|
+
|
|
44
|
+
export const BlockPackMetaEmbedAbsoluteBytes = BlockPackMeta(
|
|
45
|
+
ContentAbsoluteTextLocal.transform(absoluteToString()),
|
|
46
|
+
ContentAbsoluteBinaryLocal.transform(absoluteToBytes())
|
|
47
|
+
).pipe(BlockPackMetaEmbeddedBytes);
|
|
48
|
+
|
|
49
|
+
export function BlockPackMetaEmbedBytes(reader: RelativeContentReader) {
|
|
50
|
+
return BlockPackMeta(
|
|
51
|
+
ContentRelativeText.transform(relativeToContentString(reader)),
|
|
52
|
+
ContentRelativeBinary.transform(relativeToExplicitBytes(reader))
|
|
53
|
+
).pipe(BlockPackMetaEmbeddedBytes);
|
|
54
|
+
}
|
|
@@ -122,6 +122,28 @@ export function absoluteToBase64(): (
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
export function absoluteToBytes(): (
|
|
126
|
+
value: ContentAbsoluteBinaryLocal
|
|
127
|
+
) => Promise<ContentExplicitBytes> {
|
|
128
|
+
return async (value) => {
|
|
129
|
+
if (value.type === 'absolute-file') {
|
|
130
|
+
const mimeType = mime.lookup(value.file);
|
|
131
|
+
if (!mimeType) throw new Error(`Can't recognize mime type of the file: ${value.file}.`);
|
|
132
|
+
return {
|
|
133
|
+
type: 'explicit-bytes',
|
|
134
|
+
mimeType,
|
|
135
|
+
content: Buffer.from(await fsp.readFile(value.file))
|
|
136
|
+
};
|
|
137
|
+
} else if (value.type === 'explicit-base64') {
|
|
138
|
+
return {
|
|
139
|
+
type: 'explicit-bytes',
|
|
140
|
+
mimeType: value.mimeType,
|
|
141
|
+
content: Buffer.from(value.content, 'base64')
|
|
142
|
+
};
|
|
143
|
+
} else return value;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
125
147
|
export function cpAbsoluteToRelative(
|
|
126
148
|
dstFolder: string,
|
|
127
149
|
fileAccumulator?: string[]
|
|
@@ -162,7 +184,7 @@ export function packFolderToRelativeTgz(
|
|
|
162
184
|
|
|
163
185
|
export type RelativeContentReader = (relativePath: string) => Promise<Buffer>;
|
|
164
186
|
|
|
165
|
-
export function
|
|
187
|
+
export function relativeToExplicitString(
|
|
166
188
|
reader: RelativeContentReader
|
|
167
189
|
): (value: ContentRelativeText) => Promise<ContentExplicitString> {
|
|
168
190
|
return async (value) =>
|
|
@@ -171,6 +193,13 @@ export function relativeToExplicitText(
|
|
|
171
193
|
: { type: 'explicit-string', content: (await reader(value.path)).toString('utf8') };
|
|
172
194
|
}
|
|
173
195
|
|
|
196
|
+
export function relativeToContentString(
|
|
197
|
+
reader: RelativeContentReader
|
|
198
|
+
): (value: ContentRelativeText) => Promise<string> {
|
|
199
|
+
return async (value) =>
|
|
200
|
+
value.type === 'explicit-string' ? value.content : (await reader(value.path)).toString('utf8');
|
|
201
|
+
}
|
|
202
|
+
|
|
174
203
|
export function relativeToExplicitBinary64(
|
|
175
204
|
reader: RelativeContentReader
|
|
176
205
|
): (value: ContentRelativeBinary) => Promise<ContentExplicitBase64> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MiLogger } from '@milaboratories/ts-helpers';
|
|
2
2
|
import { compare as compareSemver, satisfies } from 'semver';
|
|
3
|
-
import { RegistryStorage } from '../../
|
|
3
|
+
import { RegistryStorage } from '../../io/storage';
|
|
4
4
|
import { BlockPackIdNoVersion, BlockPackManifest } from '@milaboratories/pl-model-middle-layer';
|
|
5
5
|
import {
|
|
6
6
|
GlobalUpdateSeedInFile,
|
|
@@ -75,7 +75,7 @@ export class BlockRegistryV2 {
|
|
|
75
75
|
// reading existing overview
|
|
76
76
|
const overviewFile = packageOverviewPath(packageInfo.package);
|
|
77
77
|
const pOverviewContent = await this.storage.getFile(overviewFile);
|
|
78
|
-
|
|
78
|
+
const packageOverview: PackageOverview =
|
|
79
79
|
pOverviewContent === undefined
|
|
80
80
|
? { schema: 'v2', versions: [] }
|
|
81
81
|
: PackageOverview.parse(JSON.parse(pOverviewContent.toString()));
|
|
@@ -85,7 +85,7 @@ export class BlockRegistryV2 {
|
|
|
85
85
|
|
|
86
86
|
// removing versions that we will update
|
|
87
87
|
const newVersions = packageOverview.versions.filter(
|
|
88
|
-
(e) => !packageInfo.versions.has(e.id.version)
|
|
88
|
+
(e) => !packageInfo.versions.has(e.description.id.version)
|
|
89
89
|
);
|
|
90
90
|
|
|
91
91
|
// reading new entries
|
|
@@ -98,15 +98,21 @@ export class BlockRegistryV2 {
|
|
|
98
98
|
}) + ManifestSuffix
|
|
99
99
|
);
|
|
100
100
|
if (!manifestContent) continue; // absent package
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const sha256 = Buffer.from(await crypto.subtle.digest('sha-256', manifestContent))
|
|
102
|
+
.toString('hex')
|
|
103
|
+
.toUpperCase();
|
|
104
|
+
newVersions.push({
|
|
105
|
+
description: BlockPackDescriptionManifestAddRelativePathPrefix(version).parse(
|
|
103
106
|
BlockPackManifest.parse(JSON.parse(manifestContent.toString('utf8'))).description
|
|
104
|
-
)
|
|
105
|
-
|
|
107
|
+
),
|
|
108
|
+
manifestSha256: sha256
|
|
109
|
+
});
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
// sorting entries according to version
|
|
109
|
-
newVersions.sort((e1, e2) =>
|
|
113
|
+
newVersions.sort((e1, e2) =>
|
|
114
|
+
compareSemver(e2.description.id.version, e1.description.id.version)
|
|
115
|
+
);
|
|
110
116
|
|
|
111
117
|
// write package overview back
|
|
112
118
|
await this.storage.putFile(
|
|
@@ -128,10 +134,11 @@ export class BlockRegistryV2 {
|
|
|
128
134
|
organization: packageInfo.package.organization,
|
|
129
135
|
name: packageInfo.package.name
|
|
130
136
|
},
|
|
131
|
-
allVersions: newVersions.map((e) => e.id.version).reverse(),
|
|
132
|
-
latest: BlockPackDescriptionManifestAddRelativePathPrefix(
|
|
133
|
-
|
|
134
|
-
)
|
|
137
|
+
allVersions: newVersions.map((e) => e.description.id.version).reverse(),
|
|
138
|
+
latest: BlockPackDescriptionManifestAddRelativePathPrefix(
|
|
139
|
+
`${packageInfo.package.organization}/${packageInfo.package.name}`
|
|
140
|
+
).parse(newVersions[0].description),
|
|
141
|
+
latestManifestSha256: newVersions[0].manifestSha256
|
|
135
142
|
});
|
|
136
143
|
}
|
|
137
144
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BlockPackDescriptionManifest,
|
|
3
|
+
BlockPackMetaEmbeddedBytes,
|
|
4
|
+
BlockPackMetaManifest,
|
|
5
|
+
BlockPackOverview
|
|
6
|
+
} from '@milaboratories/pl-model-middle-layer';
|
|
7
|
+
import { FolderReader } from '../../io';
|
|
8
|
+
import canonicalize from 'canonicalize';
|
|
9
|
+
import {
|
|
10
|
+
GlobalOverview,
|
|
11
|
+
GlobalOverviewEntryReg,
|
|
12
|
+
GlobalOverviewFileName,
|
|
13
|
+
GlobalOverviewReg,
|
|
14
|
+
MainPrefix,
|
|
15
|
+
ManifestFileName
|
|
16
|
+
} from './schema_public';
|
|
17
|
+
import { BlockPackMetaEmbedBytes } from '../model';
|
|
18
|
+
|
|
19
|
+
export type BlockPackOverviewNoRegLabel = Omit<BlockPackOverview, 'registryId'>;
|
|
20
|
+
|
|
21
|
+
export class RegistryV2Reader {
|
|
22
|
+
private readonly metaCache = new Map<
|
|
23
|
+
string,
|
|
24
|
+
{ sha256: string; meta: BlockPackMetaEmbeddedBytes }
|
|
25
|
+
>();
|
|
26
|
+
|
|
27
|
+
private readonly rootFolderReader: FolderReader;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
private readonly url: string,
|
|
31
|
+
reader: FolderReader
|
|
32
|
+
) {
|
|
33
|
+
this.rootFolderReader = reader.relativeReader(MainPrefix);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private async embedMetaContent(
|
|
37
|
+
entry: GlobalOverviewEntryReg
|
|
38
|
+
): Promise<BlockPackMetaEmbeddedBytes> {
|
|
39
|
+
const id = canonicalize(entry.id)!;
|
|
40
|
+
const fromCache = this.metaCache.get(id);
|
|
41
|
+
if (fromCache && fromCache.sha256 === entry.latestManifestSha256) return fromCache.meta;
|
|
42
|
+
const rootContentReader = this.rootFolderReader.getContentReader();
|
|
43
|
+
const meta = await BlockPackMetaEmbedBytes(rootContentReader).parseAsync(entry.latest.meta);
|
|
44
|
+
this.metaCache.set(id, { sha256: entry.latestManifestSha256, meta });
|
|
45
|
+
return meta;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public async listBlockPacks(): Promise<BlockPackOverviewNoRegLabel[]> {
|
|
49
|
+
const rootContentReader = this.rootFolderReader.getContentReader();
|
|
50
|
+
const globalOverview = GlobalOverviewReg.parse(
|
|
51
|
+
JSON.parse(
|
|
52
|
+
Buffer.from(await this.rootFolderReader.readFile(GlobalOverviewFileName)).toString()
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
return await Promise.all(
|
|
56
|
+
globalOverview.packages.map(
|
|
57
|
+
async (p) =>
|
|
58
|
+
({
|
|
59
|
+
id: p.latest.id,
|
|
60
|
+
meta: await this.embedMetaContent(p),
|
|
61
|
+
spec: {
|
|
62
|
+
type: 'from-registry-v2',
|
|
63
|
+
id: p.latest.id,
|
|
64
|
+
registryUrl: this.url
|
|
65
|
+
},
|
|
66
|
+
otherVersions: p.allVersions
|
|
67
|
+
}) satisfies BlockPackOverviewNoRegLabel
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -6,13 +6,17 @@ import {
|
|
|
6
6
|
BlockPackMeta,
|
|
7
7
|
ContentRelativeBinary,
|
|
8
8
|
ContentRelativeText,
|
|
9
|
-
CreateBlockPackDescriptionSchema
|
|
9
|
+
CreateBlockPackDescriptionSchema,
|
|
10
|
+
SemVer,
|
|
11
|
+
Sha256Schema
|
|
10
12
|
} from '@milaboratories/pl-model-middle-layer';
|
|
11
13
|
import { z } from 'zod';
|
|
12
|
-
import { RelativeContentReader, relativeToExplicitBytes,
|
|
14
|
+
import { RelativeContentReader, relativeToExplicitBytes, relativeToExplicitString } from '../model';
|
|
13
15
|
|
|
14
|
-
const MainPrefix = 'v2/';
|
|
16
|
+
export const MainPrefix = 'v2/';
|
|
15
17
|
|
|
18
|
+
export const GlobalOverviewFileName = 'overview.json';
|
|
19
|
+
export const PackageOverviewFileName = 'overview.json';
|
|
16
20
|
export const ManifestFileName = 'manifest.json';
|
|
17
21
|
|
|
18
22
|
export function packageContentPrefix(bp: BlockPackId): string {
|
|
@@ -25,17 +29,23 @@ export const ManifestSuffix = '/' + ManifestFileName;
|
|
|
25
29
|
// return `${MainPrefix}${bp.organization}/${bp.name}/${bp.version}/${file}`;
|
|
26
30
|
// }
|
|
27
31
|
|
|
32
|
+
export const PackageOverviewVersionEntry = z.object({
|
|
33
|
+
description: BlockPackDescriptionManifest,
|
|
34
|
+
manifestSha256: Sha256Schema
|
|
35
|
+
});
|
|
36
|
+
export type PackageOverviewVersionEntry = z.infer<typeof PackageOverviewVersionEntry>;
|
|
37
|
+
|
|
28
38
|
export const PackageOverview = z.object({
|
|
29
39
|
schema: z.literal('v2'),
|
|
30
|
-
versions: z.array(
|
|
40
|
+
versions: z.array(PackageOverviewVersionEntry)
|
|
31
41
|
});
|
|
32
42
|
export type PackageOverview = z.infer<typeof PackageOverview>;
|
|
33
43
|
|
|
34
44
|
export function packageOverviewPath(bp: BlockPackIdNoVersion): string {
|
|
35
|
-
return `${MainPrefix}${bp.organization}/${bp.name}
|
|
45
|
+
return `${MainPrefix}${bp.organization}/${bp.name}/${PackageOverviewFileName}`;
|
|
36
46
|
}
|
|
37
47
|
|
|
38
|
-
export const GlobalOverviewPath = `${MainPrefix}
|
|
48
|
+
export const GlobalOverviewPath = `${MainPrefix}${GlobalOverviewFileName}`;
|
|
39
49
|
|
|
40
50
|
export function GlobalOverviewEntry<const Description extends z.ZodTypeAny>(
|
|
41
51
|
descriptionType: Description
|
|
@@ -43,9 +53,12 @@ export function GlobalOverviewEntry<const Description extends z.ZodTypeAny>(
|
|
|
43
53
|
return z.object({
|
|
44
54
|
id: BlockPackIdNoVersion,
|
|
45
55
|
allVersions: z.array(z.string()),
|
|
46
|
-
latest: descriptionType
|
|
56
|
+
latest: descriptionType,
|
|
57
|
+
latestManifestSha256: Sha256Schema
|
|
47
58
|
});
|
|
48
59
|
}
|
|
60
|
+
export const GlobalOverviewEntryReg = GlobalOverviewEntry(BlockPackDescriptionManifest);
|
|
61
|
+
export type GlobalOverviewEntryReg = z.infer<typeof GlobalOverviewEntryReg>;
|
|
49
62
|
|
|
50
63
|
export function GlobalOverview<const Description extends z.ZodTypeAny>(
|
|
51
64
|
descriptionType: Description
|
|
@@ -59,12 +72,21 @@ export function GlobalOverview<const Description extends z.ZodTypeAny>(
|
|
|
59
72
|
export const GlobalOverviewReg = GlobalOverview(BlockPackDescriptionManifest);
|
|
60
73
|
export type GlobalOverviewReg = z.infer<typeof GlobalOverviewReg>;
|
|
61
74
|
|
|
75
|
+
export function BlockDescriptionToExplicitBinaryBytes(reader: RelativeContentReader) {
|
|
76
|
+
return CreateBlockPackDescriptionSchema(
|
|
77
|
+
BlockComponentsManifest,
|
|
78
|
+
BlockPackMeta(
|
|
79
|
+
ContentRelativeText.transform(relativeToExplicitString(reader)),
|
|
80
|
+
ContentRelativeBinary.transform(relativeToExplicitBytes(reader))
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
62
84
|
export function GlobalOverviewToExplicitBinaryBytes(reader: RelativeContentReader) {
|
|
63
85
|
return GlobalOverview(
|
|
64
86
|
CreateBlockPackDescriptionSchema(
|
|
65
87
|
BlockComponentsManifest,
|
|
66
88
|
BlockPackMeta(
|
|
67
|
-
ContentRelativeText.transform(
|
|
89
|
+
ContentRelativeText.transform(relativeToExplicitString(reader)),
|
|
68
90
|
ContentRelativeBinary.transform(relativeToExplicitBytes(reader))
|
|
69
91
|
)
|
|
70
92
|
)
|
|
@@ -79,7 +101,7 @@ export function GlobalOverviewToExplicitBinaryBase64(reader: RelativeContentRead
|
|
|
79
101
|
CreateBlockPackDescriptionSchema(
|
|
80
102
|
BlockComponentsManifest,
|
|
81
103
|
BlockPackMeta(
|
|
82
|
-
ContentRelativeText.transform(
|
|
104
|
+
ContentRelativeText.transform(relativeToExplicitString(reader)),
|
|
83
105
|
ContentRelativeBinary.transform(relativeToExplicitBytes(reader))
|
|
84
106
|
)
|
|
85
107
|
)
|