@platforma-sdk/block-tools 2.1.10 → 2.2.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 +266 -80
- package/dist/cli.mjs.map +1 -1
- package/dist/cmd/index.d.ts +2 -0
- package/dist/cmd/index.d.ts.map +1 -1
- package/dist/cmd/publish.d.ts +11 -0
- package/dist/cmd/publish.d.ts.map +1 -0
- package/dist/config-DJqN5LSx.js +3 -0
- package/dist/config-DJqN5LSx.js.map +1 -0
- package/dist/{config-jteHItEq.mjs → config-rGaQLD-7.mjs} +634 -609
- package/dist/config-rGaQLD-7.mjs.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +29 -27
- package/dist/registry_v1/config_schema.d.ts +13 -13
- package/dist/v2/build_dist.d.ts +2 -1
- package/dist/v2/build_dist.d.ts.map +1 -1
- package/dist/v2/model/block_components.d.ts +169 -177
- package/dist/v2/model/block_components.d.ts.map +1 -1
- package/dist/v2/model/block_description.d.ts +2873 -0
- package/dist/v2/model/block_description.d.ts.map +1 -0
- package/dist/v2/model/{meta.d.ts → block_meta.d.ts} +1 -1
- package/dist/v2/model/block_meta.d.ts.map +1 -0
- package/dist/v2/model/content_conversion.d.ts +5 -2
- package/dist/v2/model/content_conversion.d.ts.map +1 -1
- package/dist/v2/model/index.d.ts +3 -2079
- package/dist/v2/model/index.d.ts.map +1 -1
- package/dist/v2/registry/registry.d.ts +16 -0
- package/dist/v2/registry/registry.d.ts.map +1 -0
- package/dist/v2/registry/schema_internal.d.ts +7 -0
- package/dist/v2/registry/schema_internal.d.ts.map +1 -0
- package/dist/v2/registry/schema_public.d.ts +2828 -0
- package/dist/v2/registry/schema_public.d.ts.map +1 -0
- package/package.json +11 -10
- package/src/cmd/build-meta.ts +1 -1
- package/src/cmd/index.ts +2 -0
- package/src/cmd/publish.ts +69 -0
- package/src/registry_v1/registry.ts +1 -1
- package/src/v2/build_dist.ts +16 -12
- package/src/v2/model/block_components.ts +14 -10
- package/src/v2/model/block_description.ts +49 -0
- package/src/v2/model/{meta.ts → block_meta.ts} +1 -1
- package/src/v2/model/content_conversion.ts +50 -21
- package/src/v2/model/index.ts +3 -44
- package/src/v2/registry/registry.ts +233 -0
- package/src/v2/registry/schema_internal.ts +13 -0
- package/src/v2/registry/schema_public.ts +90 -0
- package/dist/config-B8NlJ02C.js +0 -3
- package/dist/config-B8NlJ02C.js.map +0 -1
- package/dist/config-jteHItEq.mjs.map +0 -1
- package/dist/v2/model/common.d.ts +0 -3
- package/dist/v2/model/common.d.ts.map +0 -1
- package/dist/v2/model/content_types.d.ts +0 -478
- package/dist/v2/model/content_types.d.ts.map +0 -1
- package/dist/v2/model/meta.d.ts.map +0 -1
- package/dist/v2/registry/schema.d.ts +0 -15
- package/dist/v2/registry/schema.d.ts.map +0 -1
- package/src/v2/model/common.ts +0 -2
- package/src/v2/model/content_types.ts +0 -233
- package/src/v2/registry/schema.ts +0 -29
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
// Base content types
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
export const ContentExplicitString = z
|
|
8
|
-
.object({
|
|
9
|
-
type: z.literal('explicit-string'),
|
|
10
|
-
content: z.string().describe('Actual string value')
|
|
11
|
-
})
|
|
12
|
-
.strict();
|
|
13
|
-
export type ContentExplicitString = z.infer<typeof ContentExplicitString>;
|
|
14
|
-
|
|
15
|
-
export const ContentExplicitBase64 = z
|
|
16
|
-
.object({
|
|
17
|
-
type: z.literal('explicit-base64'),
|
|
18
|
-
mimeType: z
|
|
19
|
-
.string()
|
|
20
|
-
.regex(/\w+\/[-+.\w]+/)
|
|
21
|
-
.describe('MIME type to interpret content'),
|
|
22
|
-
content: z.string().base64().describe('Base64 encoded binary value')
|
|
23
|
-
})
|
|
24
|
-
.strict();
|
|
25
|
-
export type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;
|
|
26
|
-
|
|
27
|
-
export const ContentRelative = z
|
|
28
|
-
.object({
|
|
29
|
-
type: z.literal('relative'),
|
|
30
|
-
path: z
|
|
31
|
-
.string()
|
|
32
|
-
.describe(
|
|
33
|
-
'Address of the file, in most cases relative to the file which this structure is a part of'
|
|
34
|
-
)
|
|
35
|
-
})
|
|
36
|
-
.strict();
|
|
37
|
-
export type ContentRelative = z.infer<typeof ContentRelative>;
|
|
38
|
-
|
|
39
|
-
export const ContentAbsoluteFile = z
|
|
40
|
-
.object({
|
|
41
|
-
type: z.literal('absolute-file'),
|
|
42
|
-
file: z.string().startsWith('/').describe('Absolute address of the file in local file system')
|
|
43
|
-
})
|
|
44
|
-
.strict();
|
|
45
|
-
export type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;
|
|
46
|
-
|
|
47
|
-
export const ContentAbsoluteUrl = z
|
|
48
|
-
.object({
|
|
49
|
-
type: z.literal('absolute-url'),
|
|
50
|
-
url: z.string().url().describe('Global URL to reach the requested file')
|
|
51
|
-
})
|
|
52
|
-
.strict();
|
|
53
|
-
export type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
// Special content types
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
export const ContentExplicit = z
|
|
60
|
-
.object({
|
|
61
|
-
type: z.literal('explicit'),
|
|
62
|
-
content: z.instanceof(Uint8Array).describe('Raw content')
|
|
63
|
-
})
|
|
64
|
-
.strict();
|
|
65
|
-
export type ContentExplicit = z.infer<typeof ContentExplicit>;
|
|
66
|
-
|
|
67
|
-
export const ContentAbsoluteFolder = z
|
|
68
|
-
.object({
|
|
69
|
-
type: z.literal('absolute-folder'),
|
|
70
|
-
folder: z
|
|
71
|
-
.string()
|
|
72
|
-
.startsWith('/')
|
|
73
|
-
.describe('Absolute address of the folder in local file system')
|
|
74
|
-
})
|
|
75
|
-
.strict();
|
|
76
|
-
export type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
// Unions
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
export const ContentAny = z.discriminatedUnion('type', [
|
|
83
|
-
ContentExplicitString,
|
|
84
|
-
ContentExplicitBase64,
|
|
85
|
-
ContentRelative,
|
|
86
|
-
ContentAbsoluteFile,
|
|
87
|
-
ContentAbsoluteUrl
|
|
88
|
-
]);
|
|
89
|
-
export type ContentAny = z.infer<typeof ContentAny>;
|
|
90
|
-
|
|
91
|
-
export const ContentAnyLocal = z.discriminatedUnion('type', [
|
|
92
|
-
ContentExplicitString,
|
|
93
|
-
ContentExplicitBase64,
|
|
94
|
-
ContentRelative,
|
|
95
|
-
ContentAbsoluteFile
|
|
96
|
-
]);
|
|
97
|
-
export type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;
|
|
98
|
-
|
|
99
|
-
export const ContentAnyRemote = z.discriminatedUnion('type', [
|
|
100
|
-
ContentExplicitString,
|
|
101
|
-
ContentExplicitBase64,
|
|
102
|
-
ContentRelative,
|
|
103
|
-
ContentAbsoluteUrl
|
|
104
|
-
]);
|
|
105
|
-
export type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
// Narrow types with relative option
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [
|
|
112
|
-
// ContentExplicitBase64,
|
|
113
|
-
// ContentRelative,
|
|
114
|
-
// ContentAbsoluteUrl
|
|
115
|
-
// ]);
|
|
116
|
-
// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;
|
|
117
|
-
|
|
118
|
-
export const ContentAnyBinaryLocal = z.discriminatedUnion('type', [
|
|
119
|
-
ContentExplicitBase64,
|
|
120
|
-
ContentRelative,
|
|
121
|
-
ContentAbsoluteFile
|
|
122
|
-
]);
|
|
123
|
-
export type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;
|
|
124
|
-
|
|
125
|
-
// export const ContentAnyTextRemote = z.discriminatedUnion('type', [
|
|
126
|
-
// ContentExplicitString,
|
|
127
|
-
// ContentRelative,
|
|
128
|
-
// ContentAbsoluteUrl
|
|
129
|
-
// ]);
|
|
130
|
-
// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;
|
|
131
|
-
|
|
132
|
-
export const ContentAnyTextLocal = z.discriminatedUnion('type', [
|
|
133
|
-
ContentExplicitString,
|
|
134
|
-
ContentRelative,
|
|
135
|
-
ContentAbsoluteFile
|
|
136
|
-
]);
|
|
137
|
-
export type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;
|
|
138
|
-
|
|
139
|
-
//
|
|
140
|
-
// Narrow absolute types
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
export const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [
|
|
144
|
-
ContentExplicitBase64,
|
|
145
|
-
ContentAbsoluteUrl
|
|
146
|
-
]);
|
|
147
|
-
export type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;
|
|
148
|
-
|
|
149
|
-
export const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [
|
|
150
|
-
ContentExplicitBase64,
|
|
151
|
-
ContentAbsoluteFile
|
|
152
|
-
]);
|
|
153
|
-
export type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;
|
|
154
|
-
|
|
155
|
-
export const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [
|
|
156
|
-
ContentExplicitString,
|
|
157
|
-
ContentAbsoluteUrl
|
|
158
|
-
]);
|
|
159
|
-
export type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;
|
|
160
|
-
|
|
161
|
-
export const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [
|
|
162
|
-
ContentExplicitString,
|
|
163
|
-
ContentAbsoluteFile
|
|
164
|
-
]);
|
|
165
|
-
export type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;
|
|
166
|
-
|
|
167
|
-
//
|
|
168
|
-
// Narrow relative types
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
export const ContentRelativeBinary = z.discriminatedUnion('type', [
|
|
172
|
-
ContentExplicitBase64,
|
|
173
|
-
ContentRelative
|
|
174
|
-
]);
|
|
175
|
-
export type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;
|
|
176
|
-
|
|
177
|
-
export const ContentRelativeText = z.discriminatedUnion('type', [
|
|
178
|
-
ContentExplicitString,
|
|
179
|
-
ContentRelative
|
|
180
|
-
]);
|
|
181
|
-
export type ContentRelativeText = z.infer<typeof ContentRelativeText>;
|
|
182
|
-
|
|
183
|
-
// export function ConstructContent(
|
|
184
|
-
// contentType: 'text',
|
|
185
|
-
// contextType: 'local'
|
|
186
|
-
// ): typeof ContentAnyTextLocal;
|
|
187
|
-
// export function ConstructContent(
|
|
188
|
-
// contentType: 'text',
|
|
189
|
-
// contextType: 'remote'
|
|
190
|
-
// ): typeof ContentAnyTextRemote;
|
|
191
|
-
// export function ConstructContent(
|
|
192
|
-
// contentType: 'binary',
|
|
193
|
-
// contextType: 'local'
|
|
194
|
-
// ): typeof ContentAnyBinaryLocal;
|
|
195
|
-
// export function ConstructContent(
|
|
196
|
-
// contentType: 'binary',
|
|
197
|
-
// contextType: 'remote'
|
|
198
|
-
// ): typeof ContentAnyBinaryRemote;
|
|
199
|
-
// export function ConstructContent(
|
|
200
|
-
// contentType: ContentType,
|
|
201
|
-
// contextType: ContextType
|
|
202
|
-
// ):
|
|
203
|
-
// | typeof ContentAnyTextLocal
|
|
204
|
-
// | typeof ContentAnyTextRemote
|
|
205
|
-
// | typeof ContentAnyBinaryLocal
|
|
206
|
-
// | typeof ContentAnyBinaryRemote;
|
|
207
|
-
// export function ConstructContent(contentType: ContentType, contextType: ContextType) {
|
|
208
|
-
// return contentType === 'text'
|
|
209
|
-
// ? contextType === 'local'
|
|
210
|
-
// ? ContentAnyTextLocal
|
|
211
|
-
// : ContentAnyTextRemote
|
|
212
|
-
// : contextType === 'local'
|
|
213
|
-
// ? ContentAnyBinaryLocal
|
|
214
|
-
// : ContentAnyBinaryRemote;
|
|
215
|
-
// }
|
|
216
|
-
|
|
217
|
-
export const DescriptionContentBinary = z.union([
|
|
218
|
-
z
|
|
219
|
-
.string()
|
|
220
|
-
.startsWith('file:')
|
|
221
|
-
.transform<ContentRelativeBinary>((value, ctx) => ({ type: 'relative', path: value.slice(5) })),
|
|
222
|
-
ContentAnyBinaryLocal
|
|
223
|
-
]);
|
|
224
|
-
export type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;
|
|
225
|
-
|
|
226
|
-
export const DescriptionContentText = z.union([
|
|
227
|
-
z.string().transform<ContentRelativeText>((value, ctx) => {
|
|
228
|
-
if (value.startsWith('file:')) return { type: 'relative', path: value.slice(5) };
|
|
229
|
-
else return { type: 'explicit-string', content: value };
|
|
230
|
-
}),
|
|
231
|
-
ContentAnyTextLocal
|
|
232
|
-
]);
|
|
233
|
-
export type DescriptionContentText = z.infer<typeof DescriptionContentText>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BlockPackId, BlockPackIdNoVersion } from '@milaboratories/pl-model-middle-layer';
|
|
2
|
-
|
|
3
|
-
const MainPrefix = 'v2/';
|
|
4
|
-
|
|
5
|
-
export function packageContentPrefix(bp: BlockPackId): string {
|
|
6
|
-
return `${MainPrefix}${bp.organization}/${bp.name}/${bp.version}`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function payloadFilePath(bp: BlockPackId, file: string): string {
|
|
10
|
-
return `${MainPrefix}${bp.organization}/${bp.name}/${bp.version}/${file}`;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function packageOverviewPath(bp: BlockPackIdNoVersion): string {
|
|
14
|
-
return `${MainPrefix}${bp.organization}/${bp.name}/overview.json`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const GlobalOverviewPath = `${MainPrefix}overview.json`;
|
|
18
|
-
|
|
19
|
-
export const ManifestFile = 'manifest.json';
|
|
20
|
-
|
|
21
|
-
export interface GlobalOverviewEntry {
|
|
22
|
-
organization: string;
|
|
23
|
-
package: string;
|
|
24
|
-
allVersions: string[];
|
|
25
|
-
latestVersion: string;
|
|
26
|
-
latestMeta: object;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type GlobalOverview = GlobalOverviewEntry[];
|