@milaboratories/pl-model-middle-layer 1.3.0 → 1.4.1
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_meta/block_components.d.ts +225 -51
- package/dist/block_meta/block_components.d.ts.map +1 -1
- package/dist/block_meta/block_description.d.ts +34 -28
- package/dist/block_meta/block_description.d.ts.map +1 -1
- package/dist/block_meta/block_manifest.d.ts +133 -69
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_meta/block_meta.d.ts +102 -2
- package/dist/block_meta/block_meta.d.ts.map +1 -1
- package/dist/block_registry/block_pack_spec.d.ts +201 -0
- package/dist/block_registry/block_pack_spec.d.ts.map +1 -0
- package/dist/block_registry/index.d.ts +4 -0
- package/dist/block_registry/index.d.ts.map +1 -0
- package/dist/block_registry/overview.d.ts +914 -0
- package/dist/block_registry/overview.d.ts.map +1 -0
- package/dist/block_registry/registry_spec.d.ts +184 -0
- package/dist/block_registry/registry_spec.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +187 -118
- package/dist/index.mjs.map +1 -1
- package/dist/project_overview.d.ts +1 -1
- package/dist/project_overview.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/block_meta/block_components.ts +17 -10
- package/src/block_meta/block_manifest.ts +7 -5
- package/src/block_meta/block_meta.ts +10 -2
- package/src/block_registry/block_pack_spec.ts +51 -0
- package/src/block_registry/index.ts +3 -0
- package/src/block_registry/overview.ts +27 -0
- package/src/block_registry/registry_spec.ts +38 -0
- package/src/index.ts +1 -1
- package/src/project_overview.ts +1 -1
- package/dist/block_pack.d.ts +0 -24
- package/dist/block_pack.d.ts.map +0 -1
- package/src/block_pack.ts +0 -29
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BlockPackId } from '../block_meta';
|
|
3
|
+
|
|
4
|
+
/** Block pack from local folder, to be used during block development. Old layout.
|
|
5
|
+
* @deprecated don't use */
|
|
6
|
+
export const BlockPackDevV1 = z.object({
|
|
7
|
+
type: z.literal('dev-v1'),
|
|
8
|
+
folder: z.string(),
|
|
9
|
+
mtime: z.string().optional()
|
|
10
|
+
});
|
|
11
|
+
/** @deprecated don't use */
|
|
12
|
+
export type BlockPackDevV1 = z.infer<typeof BlockPackDevV1>;
|
|
13
|
+
|
|
14
|
+
/** Block pack from local folder, to be used during block development. New layout. */
|
|
15
|
+
export const BlockPackDevV2 = z.object({
|
|
16
|
+
type: z.literal('dev-v2'),
|
|
17
|
+
folder: z.string(),
|
|
18
|
+
mtime: z.string().optional()
|
|
19
|
+
});
|
|
20
|
+
export type BlockPackDevV2 = z.infer<typeof BlockPackDevV2>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Block pack from registry with version 2 layout, to be loaded directly
|
|
24
|
+
* from the client.
|
|
25
|
+
* @deprecated don't use
|
|
26
|
+
* */
|
|
27
|
+
export const BlockPackFromRegistryV1 = z.object({
|
|
28
|
+
type: z.literal('from-registry-v1'),
|
|
29
|
+
registryUrl: z.string(),
|
|
30
|
+
id: BlockPackId
|
|
31
|
+
});
|
|
32
|
+
/** @deprecated don't use */
|
|
33
|
+
export type BlockPackFromRegistryV1 = z.infer<typeof BlockPackFromRegistryV1>;
|
|
34
|
+
|
|
35
|
+
/** Block pack from registry with version 2 layout, to be loaded directly
|
|
36
|
+
* from the client. */
|
|
37
|
+
export const BlockPackFromRegistryV2 = z.object({
|
|
38
|
+
type: z.literal('from-registry-v2'),
|
|
39
|
+
registryUrl: z.string(),
|
|
40
|
+
id: BlockPackId
|
|
41
|
+
});
|
|
42
|
+
export type BlockPackFromRegistryV2 = z.infer<typeof BlockPackFromRegistryV2>;
|
|
43
|
+
|
|
44
|
+
/** Information about block origin, can be used to instantiate new blocks */
|
|
45
|
+
export const BlockPackSpec = z.discriminatedUnion('type', [
|
|
46
|
+
BlockPackDevV1,
|
|
47
|
+
BlockPackDevV2,
|
|
48
|
+
BlockPackFromRegistryV1,
|
|
49
|
+
BlockPackFromRegistryV2
|
|
50
|
+
]);
|
|
51
|
+
export type BlockPackSpec = z.infer<typeof BlockPackSpec>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BlockPackId, BlockPackMetaEmbeddedBytes, SemVer } from '../block_meta';
|
|
3
|
+
import { BlockPackSpec } from './block_pack_spec';
|
|
4
|
+
import { RegistryEntry } from './registry_spec';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Latest information about specific block pack. Contain information about latest version of the package.
|
|
8
|
+
* */
|
|
9
|
+
export const BlockPackOverview = z.object({
|
|
10
|
+
registryId: z.string(),
|
|
11
|
+
id: BlockPackId,
|
|
12
|
+
meta: BlockPackMetaEmbeddedBytes,
|
|
13
|
+
spec: BlockPackSpec,
|
|
14
|
+
otherVersions: z.array(SemVer)
|
|
15
|
+
});
|
|
16
|
+
export type BlockPackOverview = z.infer<typeof BlockPackOverview>;
|
|
17
|
+
|
|
18
|
+
export const RegistryStatus = RegistryEntry.extend({
|
|
19
|
+
status: z.union([z.literal('online'), z.literal('offline')])
|
|
20
|
+
});
|
|
21
|
+
export type RegistryStatus = z.infer<typeof RegistryStatus>;
|
|
22
|
+
|
|
23
|
+
export const BlockPackListing = z.object({
|
|
24
|
+
registries: z.array(RegistryStatus),
|
|
25
|
+
blockPacks: z.array(BlockPackOverview)
|
|
26
|
+
});
|
|
27
|
+
export type BlockPackListing = z.infer<typeof BlockPackListing>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const LocalDevFolder = z.object({
|
|
4
|
+
type: z.literal('local-dev'),
|
|
5
|
+
path: z.string()
|
|
6
|
+
});
|
|
7
|
+
export type LocalDevFolder = z.infer<typeof LocalDevFolder>;
|
|
8
|
+
|
|
9
|
+
/** @deprecated don't use */
|
|
10
|
+
export const RemoteRegistryV1Spec = z.object({
|
|
11
|
+
type: z.literal('remote-v1'),
|
|
12
|
+
url: z.string().url()
|
|
13
|
+
});
|
|
14
|
+
/** @deprecated don't use */
|
|
15
|
+
export type RemoteRegistryV1Spec = z.infer<typeof RemoteRegistryV1Spec>;
|
|
16
|
+
|
|
17
|
+
export const RemoteRegistryV2Spec = z.object({
|
|
18
|
+
type: z.literal('remote-v2'),
|
|
19
|
+
url: z.string().url()
|
|
20
|
+
});
|
|
21
|
+
export type RemoteRegistryV2Spec = z.infer<typeof RemoteRegistryV2Spec>;
|
|
22
|
+
|
|
23
|
+
export const RegistrySpec = z.discriminatedUnion('type', [
|
|
24
|
+
RemoteRegistryV1Spec,
|
|
25
|
+
RemoteRegistryV2Spec,
|
|
26
|
+
LocalDevFolder
|
|
27
|
+
]);
|
|
28
|
+
export type RegistrySpec = z.infer<typeof RegistrySpec>;
|
|
29
|
+
|
|
30
|
+
export const RegistryEntry = z.object({
|
|
31
|
+
id: z.string(),
|
|
32
|
+
title: z.string().optional(),
|
|
33
|
+
spec: RegistrySpec
|
|
34
|
+
});
|
|
35
|
+
export type RegistryEntry = z.infer<typeof RegistryEntry>;
|
|
36
|
+
|
|
37
|
+
export const RegistryList = z.array(RegistryEntry);
|
|
38
|
+
export type RegistryList = z.infer<typeof RegistryList>;
|
package/src/index.ts
CHANGED
package/src/project_overview.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectMeta } from './project';
|
|
2
|
-
import { BlockPackSpec } from './
|
|
2
|
+
import { BlockPackSpec } from './block_registry/block_pack_spec';
|
|
3
3
|
import { BlockRenderingMode, BlockSection, NavigationState } from '@milaboratories/pl-model-common';
|
|
4
4
|
import { AuthorMarker } from './author_marker';
|
|
5
5
|
|
package/dist/block_pack.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** Block pack from local folder, to be used during block development. Legacy layout. */
|
|
2
|
-
export interface BlockPackDevV1 {
|
|
3
|
-
type: 'dev' | 'dev-v1';
|
|
4
|
-
folder: string;
|
|
5
|
-
mtime?: string;
|
|
6
|
-
}
|
|
7
|
-
/** Block pack from local folder, to be used during block development. New layout. */
|
|
8
|
-
export interface BlockPackDevV2 {
|
|
9
|
-
type: 'dev-v2';
|
|
10
|
-
folder: string;
|
|
11
|
-
mtime?: string;
|
|
12
|
-
}
|
|
13
|
-
/** Block pack from registry with version 1 layout, to be loaded directly
|
|
14
|
-
* from the client. */
|
|
15
|
-
export interface BlockPackFromRegistryV1 {
|
|
16
|
-
type: 'from-registry-v1';
|
|
17
|
-
registryUrl: string;
|
|
18
|
-
organization: string;
|
|
19
|
-
package: string;
|
|
20
|
-
version: string;
|
|
21
|
-
}
|
|
22
|
-
/** Information about block origin, can be used to instantiate new blocks */
|
|
23
|
-
export type BlockPackSpec = BlockPackDevV1 | BlockPackDevV2 | BlockPackFromRegistryV1;
|
|
24
|
-
//# sourceMappingURL=block_pack.d.ts.map
|
package/dist/block_pack.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block_pack.d.ts","sourceRoot":"","sources":["../src/block_pack.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;sBACsB;AACtB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,cAAc,GACd,uBAAuB,CAAC"}
|
package/src/block_pack.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** Block pack from local folder, to be used during block development. Legacy layout. */
|
|
2
|
-
export interface BlockPackDevV1 {
|
|
3
|
-
type: 'dev' | 'dev-v1';
|
|
4
|
-
folder: string;
|
|
5
|
-
mtime?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** Block pack from local folder, to be used during block development. New layout. */
|
|
9
|
-
export interface BlockPackDevV2 {
|
|
10
|
-
type: 'dev-v2';
|
|
11
|
-
folder: string;
|
|
12
|
-
mtime?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** Block pack from registry with version 1 layout, to be loaded directly
|
|
16
|
-
* from the client. */
|
|
17
|
-
export interface BlockPackFromRegistryV1 {
|
|
18
|
-
type: 'from-registry-v1';
|
|
19
|
-
registryUrl: string;
|
|
20
|
-
organization: string;
|
|
21
|
-
package: string;
|
|
22
|
-
version: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Information about block origin, can be used to instantiate new blocks */
|
|
26
|
-
export type BlockPackSpec =
|
|
27
|
-
| BlockPackDevV1
|
|
28
|
-
| BlockPackDevV2
|
|
29
|
-
| BlockPackFromRegistryV1;
|