@milaboratories/pl-model-middle-layer 1.21.0 → 1.22.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/block_meta/block_components.cjs +19 -26
- package/dist/block_meta/block_components.cjs.map +1 -1
- package/dist/block_meta/block_components.d.ts +46 -428
- package/dist/block_meta/block_components.d.ts.map +1 -1
- package/dist/block_meta/block_components.js +19 -23
- package/dist/block_meta/block_components.js.map +1 -1
- package/dist/block_meta/block_description.cjs +5 -3
- package/dist/block_meta/block_description.cjs.map +1 -1
- package/dist/block_meta/block_description.d.ts +402 -914
- package/dist/block_meta/block_description.d.ts.map +1 -1
- package/dist/block_meta/block_description.js +5 -3
- package/dist/block_meta/block_description.js.map +1 -1
- package/dist/block_meta/block_id.d.ts +4 -4
- package/dist/block_meta/block_manifest.cjs +10 -1
- package/dist/block_meta/block_manifest.cjs.map +1 -1
- package/dist/block_meta/block_manifest.d.ts +1045 -1623
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_meta/block_manifest.js +11 -2
- package/dist/block_meta/block_manifest.js.map +1 -1
- package/dist/block_meta/block_meta.cjs.map +1 -1
- package/dist/block_meta/block_meta.d.ts +164 -246
- package/dist/block_meta/block_meta.d.ts.map +1 -1
- package/dist/block_meta/block_meta.js.map +1 -1
- package/dist/block_meta/content_types.cjs +25 -77
- package/dist/block_meta/content_types.cjs.map +1 -1
- package/dist/block_meta/content_types.d.ts +71 -387
- package/dist/block_meta/content_types.d.ts.map +1 -1
- package/dist/block_meta/content_types.js +26 -64
- package/dist/block_meta/content_types.js.map +1 -1
- package/dist/block_meta/index.d.ts +3 -3
- package/dist/block_registry/block_pack_spec.d.ts +16 -16
- package/dist/block_registry/overview.d.ts +1534 -1534
- package/dist/block_registry/registry_spec.d.ts +12 -12
- package/dist/index.cjs +1 -18
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/package.json +2 -2
- package/src/block_meta/block_components.ts +67 -42
- package/src/block_meta/block_description.ts +18 -3
- package/src/block_meta/block_manifest.ts +14 -3
- package/src/block_meta/block_meta.ts +40 -6
- package/src/block_meta/content_types.ts +149 -207
|
@@ -5,11 +5,11 @@ declare const LocalDevFolder: z.ZodObject<{
|
|
|
5
5
|
type: z.ZodLiteral<"local-dev">;
|
|
6
6
|
path: z.ZodString;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
type: "local-dev";
|
|
9
8
|
path: string;
|
|
10
|
-
}, {
|
|
11
9
|
type: "local-dev";
|
|
10
|
+
}, {
|
|
12
11
|
path: string;
|
|
12
|
+
type: "local-dev";
|
|
13
13
|
}>;
|
|
14
14
|
type LocalDevFolder = z.infer<typeof LocalDevFolder>;
|
|
15
15
|
/** @deprecated don't use */
|
|
@@ -58,11 +58,11 @@ declare const RegistrySpec: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
58
58
|
type: z.ZodLiteral<"local-dev">;
|
|
59
59
|
path: z.ZodString;
|
|
60
60
|
}, "strip", z.ZodTypeAny, {
|
|
61
|
-
type: "local-dev";
|
|
62
61
|
path: string;
|
|
63
|
-
}, {
|
|
64
62
|
type: "local-dev";
|
|
63
|
+
}, {
|
|
65
64
|
path: string;
|
|
65
|
+
type: "local-dev";
|
|
66
66
|
}>]>;
|
|
67
67
|
type RegistrySpec = z.infer<typeof RegistrySpec>;
|
|
68
68
|
declare const RegistryEntry: z.ZodObject<{
|
|
@@ -90,11 +90,11 @@ declare const RegistryEntry: z.ZodObject<{
|
|
|
90
90
|
type: z.ZodLiteral<"local-dev">;
|
|
91
91
|
path: z.ZodString;
|
|
92
92
|
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
type: "local-dev";
|
|
94
93
|
path: string;
|
|
95
|
-
}, {
|
|
96
94
|
type: "local-dev";
|
|
95
|
+
}, {
|
|
97
96
|
path: string;
|
|
97
|
+
type: "local-dev";
|
|
98
98
|
}>]>;
|
|
99
99
|
}, "strip", z.ZodTypeAny, {
|
|
100
100
|
id: string;
|
|
@@ -105,8 +105,8 @@ declare const RegistryEntry: z.ZodObject<{
|
|
|
105
105
|
type: "remote-v2";
|
|
106
106
|
url: string;
|
|
107
107
|
} | {
|
|
108
|
-
type: "local-dev";
|
|
109
108
|
path: string;
|
|
109
|
+
type: "local-dev";
|
|
110
110
|
};
|
|
111
111
|
title?: string | undefined;
|
|
112
112
|
}, {
|
|
@@ -118,8 +118,8 @@ declare const RegistryEntry: z.ZodObject<{
|
|
|
118
118
|
type: "remote-v2";
|
|
119
119
|
url: string;
|
|
120
120
|
} | {
|
|
121
|
-
type: "local-dev";
|
|
122
121
|
path: string;
|
|
122
|
+
type: "local-dev";
|
|
123
123
|
};
|
|
124
124
|
title?: string | undefined;
|
|
125
125
|
}>;
|
|
@@ -149,11 +149,11 @@ declare const RegistryList: z.ZodArray<z.ZodObject<{
|
|
|
149
149
|
type: z.ZodLiteral<"local-dev">;
|
|
150
150
|
path: z.ZodString;
|
|
151
151
|
}, "strip", z.ZodTypeAny, {
|
|
152
|
-
type: "local-dev";
|
|
153
152
|
path: string;
|
|
154
|
-
}, {
|
|
155
153
|
type: "local-dev";
|
|
154
|
+
}, {
|
|
156
155
|
path: string;
|
|
156
|
+
type: "local-dev";
|
|
157
157
|
}>]>;
|
|
158
158
|
}, "strip", z.ZodTypeAny, {
|
|
159
159
|
id: string;
|
|
@@ -164,8 +164,8 @@ declare const RegistryList: z.ZodArray<z.ZodObject<{
|
|
|
164
164
|
type: "remote-v2";
|
|
165
165
|
url: string;
|
|
166
166
|
} | {
|
|
167
|
-
type: "local-dev";
|
|
168
167
|
path: string;
|
|
168
|
+
type: "local-dev";
|
|
169
169
|
};
|
|
170
170
|
title?: string | undefined;
|
|
171
171
|
}, {
|
|
@@ -177,8 +177,8 @@ declare const RegistryList: z.ZodArray<z.ZodObject<{
|
|
|
177
177
|
type: "remote-v2";
|
|
178
178
|
url: string;
|
|
179
179
|
} | {
|
|
180
|
-
type: "local-dev";
|
|
181
180
|
path: string;
|
|
181
|
+
type: "local-dev";
|
|
182
182
|
};
|
|
183
183
|
title?: string | undefined;
|
|
184
184
|
}>, "many">;
|
package/dist/index.cjs
CHANGED
|
@@ -16,8 +16,6 @@ require("./block_registry/index.cjs");
|
|
|
16
16
|
const require_index$2 = require("./pframe/internal_api/index.cjs");
|
|
17
17
|
const require_json = require("./json.cjs");
|
|
18
18
|
exports.AnyChannel = require_overview.AnyChannel;
|
|
19
|
-
exports.BlockComponents = require_block_components.BlockComponents;
|
|
20
|
-
exports.BlockComponentsAbsoluteUrl = require_block_components.BlockComponentsAbsoluteUrl;
|
|
21
19
|
exports.BlockComponentsDescriptionRaw = require_block_components.BlockComponentsDescriptionRaw;
|
|
22
20
|
exports.BlockComponentsManifest = require_block_manifest.BlockComponentsManifest;
|
|
23
21
|
exports.BlockPackDescriptionFromPackageJsonRaw = require_block_description.BlockPackDescriptionFromPackageJsonRaw;
|
|
@@ -43,22 +41,8 @@ exports.BlockPackOverviewNoRegistryId = require_overview.BlockPackOverviewNoRegi
|
|
|
43
41
|
exports.BlockPackOverviewRaw = require_overview.BlockPackOverviewRaw;
|
|
44
42
|
exports.BlockPackSpec = require_block_pack_spec.BlockPackSpec;
|
|
45
43
|
exports.BlockPlatform = require_block_meta.BlockPlatform;
|
|
46
|
-
exports.ContentAbsoluteBinaryLocal = require_content_types.ContentAbsoluteBinaryLocal;
|
|
47
|
-
exports.ContentAbsoluteBinaryRemote = require_content_types.ContentAbsoluteBinaryRemote;
|
|
48
|
-
exports.ContentAbsoluteFile = require_content_types.ContentAbsoluteFile;
|
|
49
|
-
exports.ContentAbsoluteFolder = require_content_types.ContentAbsoluteFolder;
|
|
50
|
-
exports.ContentAbsoluteTextLocal = require_content_types.ContentAbsoluteTextLocal;
|
|
51
|
-
exports.ContentAbsoluteTextRemote = require_content_types.ContentAbsoluteTextRemote;
|
|
52
|
-
exports.ContentAbsoluteUrl = require_content_types.ContentAbsoluteUrl;
|
|
53
|
-
exports.ContentAny = require_content_types.ContentAny;
|
|
54
|
-
exports.ContentAnyBinaryLocal = require_content_types.ContentAnyBinaryLocal;
|
|
55
|
-
exports.ContentAnyLocal = require_content_types.ContentAnyLocal;
|
|
56
|
-
exports.ContentAnyRemote = require_content_types.ContentAnyRemote;
|
|
57
|
-
exports.ContentAnyTextLocal = require_content_types.ContentAnyTextLocal;
|
|
58
44
|
exports.ContentExplicitBase64 = require_content_types.ContentExplicitBase64;
|
|
59
45
|
exports.ContentExplicitBytes = require_content_types.ContentExplicitBytes;
|
|
60
|
-
exports.ContentExplicitOrRelative = require_content_types.ContentExplicitOrRelative;
|
|
61
|
-
exports.ContentExplicitString = require_content_types.ContentExplicitString;
|
|
62
46
|
exports.ContentRelative = require_content_types.ContentRelative;
|
|
63
47
|
exports.ContentRelativeBinary = require_content_types.ContentRelativeBinary;
|
|
64
48
|
exports.ContentRelativeText = require_content_types.ContentRelativeText;
|
|
@@ -86,8 +70,7 @@ exports.Sha256Schema = require_block_manifest.Sha256Schema;
|
|
|
86
70
|
exports.SingleBlockPackOverview = require_overview.SingleBlockPackOverview;
|
|
87
71
|
exports.StableChannel = require_overview.StableChannel;
|
|
88
72
|
exports.VersionWithChannels = require_overview.VersionWithChannels;
|
|
89
|
-
exports.
|
|
90
|
-
exports.WorkflowV1 = require_block_components.WorkflowV1;
|
|
73
|
+
exports.WorkflowSchemaV1 = require_block_components.WorkflowSchemaV1;
|
|
91
74
|
exports.addPrefixToRelative = require_content_conversion.addPrefixToRelative;
|
|
92
75
|
exports.blockPackIdEquals = require_block_id.blockPackIdEquals;
|
|
93
76
|
exports.blockPackIdNoVersionEquals = require_block_id.blockPackIdNoVersionEquals;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ import { LocalDevFolder, RegistryEntry, RegistryList, RegistrySpec, RemoteRegist
|
|
|
10
10
|
import { UpdateSuggestion, UpdateSuggestions } from "./update_info.js";
|
|
11
11
|
import { BlockCalculationStatus, BlockStateOverview, ProjectOverview } from "./project_overview.js";
|
|
12
12
|
import { ContentType, ContextType } from "./block_meta/common.js";
|
|
13
|
-
import {
|
|
13
|
+
import { Content, ContentAbsoluteBinaryLocal, ContentAbsoluteFile, ContentAbsoluteFolder, ContentAbsoluteTextLocal, ContentAbsoluteUrl, ContentAnyBinaryLocal, ContentAnyLocal, ContentAnyTextLocal, ContentExplicitBase64, ContentExplicitBytes, ContentExplicitOrRelative, ContentExplicitString, ContentRelative, ContentRelativeBinary, ContentRelativeText, DescriptionContentBinary, DescriptionContentText } from "./block_meta/content_types.js";
|
|
14
14
|
import { SemVer } from "./block_meta/semver.js";
|
|
15
15
|
import { addPrefixToRelative, mapRemoteToAbsolute } from "./block_meta/content_conversion.js";
|
|
16
16
|
import { BlockPackId, BlockPackIdNoVersion, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString } from "./block_meta/block_id.js";
|
|
17
|
-
import { BlockComponents,
|
|
17
|
+
import { BlockComponents, BlockComponentsDescriptionRaw, Workflow, WorkflowSchemaV1, WorkflowV1 } from "./block_meta/block_components.js";
|
|
18
18
|
import { BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPlatform } from "./block_meta/block_meta.js";
|
|
19
|
-
import { BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionRaw, CreateBlockPackDescriptionSchema, FeatureFlags, overrideDescriptionVersion } from "./block_meta/block_description.js";
|
|
19
|
+
import { BlockPackDescription, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionRaw, CreateBlockPackDescriptionSchema, FeatureFlags, overrideDescriptionVersion } from "./block_meta/block_description.js";
|
|
20
20
|
import { BlockComponentsManifest, BlockPackDescriptionManifest, BlockPackManifest, BlockPackManifestFile, BlockPackMetaManifest, ManifestFileInfo, Sha256Schema, overrideManifestVersion } from "./block_meta/block_manifest.js";
|
|
21
21
|
import { index_d_exports } from "./pframe/internal_api/index.js";
|
|
22
22
|
import { HashedJson, hashJson, readJson, readJsonSync } from "./json.js";
|
|
23
|
-
export { AnyChannel, AuthorMarker, BlockCalculationStatus, BlockComponents,
|
|
23
|
+
export { AnyChannel, AuthorMarker, BlockCalculationStatus, BlockComponents, BlockComponentsDescriptionRaw, BlockComponentsManifest, BlockPackDescription, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionManifest, BlockPackDescriptionRaw, BlockPackDevV1, BlockPackDevV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackId, BlockPackIdNoVersion, BlockPackListing, BlockPackManifest, BlockPackManifestFile, BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPackMetaManifest, BlockPackOverview, BlockPackOverviewLegacy, BlockPackOverviewNoRegistryId, BlockPackOverviewRaw, BlockPackSpec, BlockPlatform, BlockSettings, BlockStateInternal, BlockStateInternalV3, BlockStateOverview, Content, ContentAbsoluteBinaryLocal, ContentAbsoluteFile, ContentAbsoluteFolder, ContentAbsoluteTextLocal, ContentAbsoluteUrl, ContentAnyBinaryLocal, ContentAnyLocal, ContentAnyTextLocal, ContentExplicitBase64, ContentExplicitBytes, ContentExplicitOrRelative, ContentExplicitString, ContentRelative, ContentRelativeBinary, ContentRelativeText, ContentType, ContextType, CreateBlockPackDescriptionSchema, DescriptionContentBinary, DescriptionContentText, FeatureFlags, HashedJson, InitialBlockSettings, LocalDevFolder, ManifestFileInfo, index_d_exports as PFrameInternal, ProjectListEntry, ProjectMeta, ProjectOverview, RegistryEntry, RegistryList, RegistrySpec, RegistryStatus, RemoteRegistryV1Spec, RemoteRegistryV2Spec, SemVer, Sha256Schema, SingleBlockPackOverview, StableChannel, StorageDebugView, UpdateSuggestion, UpdateSuggestions, VersionLock, VersionWithChannels, Workflow, WorkflowSchemaV1, WorkflowV1, addPrefixToRelative, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString, blockPackOverviewToLegacy, hashJson, mapRemoteToAbsolute, overrideDescriptionVersion, overrideManifestVersion, readJson, readJsonSync };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InitialBlockSettings } from "./block_settings.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ContentExplicitBase64, ContentExplicitBytes, ContentRelative, ContentRelativeBinary, ContentRelativeText, DescriptionContentBinary, DescriptionContentText } from "./block_meta/content_types.js";
|
|
3
3
|
import { SemVer } from "./block_meta/semver.js";
|
|
4
4
|
import { addPrefixToRelative, mapRemoteToAbsolute } from "./block_meta/content_conversion.js";
|
|
5
5
|
import { BlockPackId, BlockPackIdNoVersion, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString } from "./block_meta/block_id.js";
|
|
6
|
-
import {
|
|
6
|
+
import { BlockComponentsDescriptionRaw, WorkflowSchemaV1 } from "./block_meta/block_components.js";
|
|
7
7
|
import { BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPlatform } from "./block_meta/block_meta.js";
|
|
8
8
|
import { BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionRaw, CreateBlockPackDescriptionSchema, FeatureFlags, overrideDescriptionVersion } from "./block_meta/block_description.js";
|
|
9
9
|
import { BlockComponentsManifest, BlockPackDescriptionManifest, BlockPackManifest, BlockPackManifestFile, BlockPackMetaManifest, ManifestFileInfo, Sha256Schema, overrideManifestVersion } from "./block_meta/block_manifest.js";
|
|
@@ -14,4 +14,4 @@ import { AnyChannel, BlockPackListing, BlockPackOverview, BlockPackOverviewLegac
|
|
|
14
14
|
import "./block_registry/index.js";
|
|
15
15
|
import { internal_api_exports } from "./pframe/internal_api/index.js";
|
|
16
16
|
import { hashJson, readJson, readJsonSync } from "./json.js";
|
|
17
|
-
export { AnyChannel,
|
|
17
|
+
export { AnyChannel, BlockComponentsDescriptionRaw, BlockComponentsManifest, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionManifest, BlockPackDescriptionRaw, BlockPackDevV1, BlockPackDevV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackId, BlockPackIdNoVersion, BlockPackListing, BlockPackManifest, BlockPackManifestFile, BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPackMetaManifest, BlockPackOverview, BlockPackOverviewLegacy, BlockPackOverviewNoRegistryId, BlockPackOverviewRaw, BlockPackSpec, BlockPlatform, ContentExplicitBase64, ContentExplicitBytes, ContentRelative, ContentRelativeBinary, ContentRelativeText, CreateBlockPackDescriptionSchema, DescriptionContentBinary, DescriptionContentText, FeatureFlags, InitialBlockSettings, LocalDevFolder, ManifestFileInfo, internal_api_exports as PFrameInternal, RegistryEntry, RegistryList, RegistrySpec, RegistryStatus, RemoteRegistryV1Spec, RemoteRegistryV2Spec, SemVer, Sha256Schema, SingleBlockPackOverview, StableChannel, VersionWithChannels, WorkflowSchemaV1, addPrefixToRelative, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString, blockPackOverviewToLegacy, hashJson, mapRemoteToAbsolute, overrideDescriptionVersion, overrideManifestVersion, readJson, readJsonSync };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-middle-layer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "Common model between middle layer and non-block UI code",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist/**/*",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "~24.5.2",
|
|
28
28
|
"typescript": "~5.9.3",
|
|
29
|
-
"@milaboratories/ts-builder": "1.5.0",
|
|
30
29
|
"@milaboratories/build-configs": "2.0.0",
|
|
30
|
+
"@milaboratories/ts-builder": "1.5.0",
|
|
31
31
|
"@milaboratories/ts-configs": "1.2.3"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
@@ -1,49 +1,74 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ContentRelativeBinary } from "./content_types";
|
|
3
|
-
import { mapRemoteToAbsolute } from "./content_conversion";
|
|
4
|
-
|
|
5
|
-
export function WorkflowV1<const Content extends z.ZodTypeAny>(contentType: Content) {
|
|
6
|
-
return z.object({
|
|
7
|
-
type: z.literal("workflow-v1"),
|
|
8
|
-
main: contentType.describe("Main workflow"),
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
contentType
|
|
16
|
-
.transform((value: z.infer<typeof contentType>) => ({
|
|
17
|
-
type: "workflow-v1" as const,
|
|
18
|
-
main: value,
|
|
19
|
-
}))
|
|
20
|
-
.pipe(WorkflowV1(contentType)),
|
|
21
|
-
// structured objects are decoded as union with type descriptor
|
|
22
|
-
z.discriminatedUnion("type", [WorkflowV1(contentType)]),
|
|
23
|
-
]);
|
|
24
|
-
}
|
|
3
|
+
//
|
|
4
|
+
// Workflow + BlockComponents canonical TS types.
|
|
5
|
+
//
|
|
25
6
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Wrapped workflow component, schema version 1. Currently the only workflow
|
|
9
|
+
* schema; carries a single `main` entry pointing at the workflow source.
|
|
10
|
+
*/
|
|
11
|
+
export type WorkflowV1<Content> = {
|
|
12
|
+
type: "workflow-v1";
|
|
13
|
+
main: Content;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Current workflow component shape. Alias to `WorkflowV1` while v1 is the
|
|
18
|
+
* only version — future versions widen this to a discriminated union.
|
|
19
|
+
*/
|
|
20
|
+
export type Workflow<Content> = WorkflowV1<Content>;
|
|
36
21
|
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Trio of artifacts every block ships: a workflow (Tengo source), a model
|
|
24
|
+
* (compiled JS), and a UI (front-end bundle). `WMContent` carries
|
|
25
|
+
* `workflow.main` and `model` together (they travel as files); `UIContent`
|
|
26
|
+
* carries the UI bundle (a folder when resolved locally, a relative path in
|
|
27
|
+
* manifest form). Parameterizing this lets the same shape express every
|
|
28
|
+
* stage the description passes through: raw `package.json` input (bare
|
|
29
|
+
* strings), manifest form (relative paths stored in the registry), resolved
|
|
30
|
+
* absolute form (local file/folder paths), and the registry-reader output
|
|
31
|
+
* (URLs into registry storage, produced by `blockComponentsManifestToAbsoluteUrl`).
|
|
32
|
+
*/
|
|
33
|
+
export type BlockComponents<WMContent, UIContent> = {
|
|
34
|
+
workflow: Workflow<WMContent>;
|
|
35
|
+
model: WMContent;
|
|
36
|
+
ui: UIContent;
|
|
37
|
+
};
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Builds the zod schema for a wrapped workflow component carrying `content`
|
|
41
|
+
* as the `main` payload. Shared between the `package.json` boundary parser
|
|
42
|
+
* (where `content` is `z.string()`) and the manifest schema (where `content`
|
|
43
|
+
* is `ContentRelative`).
|
|
44
|
+
*/
|
|
45
|
+
export function WorkflowSchemaV1<C extends z.ZodTypeAny>(content: C) {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
type: z.literal("workflow-v1"),
|
|
49
|
+
main: content,
|
|
50
|
+
})
|
|
51
|
+
.strict();
|
|
45
52
|
}
|
|
46
|
-
export type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;
|
|
47
53
|
|
|
48
|
-
//
|
|
49
|
-
//
|
|
54
|
+
//
|
|
55
|
+
// `package.json` boundary schema. The workflow field accepts either a bare
|
|
56
|
+
// string (treated as `main`) or the wrapped object form; both normalize to
|
|
57
|
+
// the canonical wrapped shape.
|
|
58
|
+
//
|
|
59
|
+
|
|
60
|
+
const WorkflowDescriptionRaw = z.union([
|
|
61
|
+
z.string().transform<WorkflowV1<string>>((value) => ({
|
|
62
|
+
type: "workflow-v1",
|
|
63
|
+
main: value,
|
|
64
|
+
})),
|
|
65
|
+
WorkflowSchemaV1(z.string()),
|
|
66
|
+
]) satisfies z.ZodType<Workflow<string>, z.ZodTypeDef, any>;
|
|
67
|
+
|
|
68
|
+
export type BlockComponentsDescriptionRaw = BlockComponents<string, string>;
|
|
69
|
+
|
|
70
|
+
export const BlockComponentsDescriptionRaw = z.object({
|
|
71
|
+
workflow: WorkflowDescriptionRaw,
|
|
72
|
+
model: z.string(),
|
|
73
|
+
ui: z.string(),
|
|
74
|
+
}) satisfies z.ZodType<BlockComponentsDescriptionRaw, z.ZodTypeDef, any>;
|
|
@@ -6,9 +6,24 @@ import { BlockPackId } from "./block_id";
|
|
|
6
6
|
import { toMerged } from "es-toolkit";
|
|
7
7
|
import type { BlockCodeKnownFeatureFlags } from "@milaboratories/pl-model-common";
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
/**
|
|
10
|
+
* Block-pack description: a `BlockPackId`, the typed `components` and `meta`
|
|
11
|
+
* payloads, and optional `featureFlags`. The two type parameters let the same
|
|
12
|
+
* shape carry every form a description travels in — `package.json` source,
|
|
13
|
+
* relative-path manifest, absolute-path resolved.
|
|
14
|
+
*/
|
|
15
|
+
export type BlockPackDescription<Components, Meta> = {
|
|
16
|
+
id: BlockPackId;
|
|
17
|
+
components: Components;
|
|
18
|
+
meta: Meta;
|
|
19
|
+
featureFlags?: BlockCodeKnownFeatureFlags;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Description as it appears in the root block `package.json`. `file:`-prefixed
|
|
24
|
+
* strings become `ContentRelative`; bare text strings become
|
|
25
|
+
* `ContentExplicitString`. See `DescriptionContentText`/`DescriptionContentBinary`.
|
|
26
|
+
*/
|
|
12
27
|
export const BlockPackDescriptionFromPackageJsonRaw = z.object({
|
|
13
28
|
components: BlockComponentsDescriptionRaw,
|
|
14
29
|
meta: BlockPackMetaDescriptionRaw,
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { BlockComponents } from "./block_components";
|
|
2
|
+
import type { BlockComponents } from "./block_components";
|
|
3
|
+
import { WorkflowSchemaV1 } from "./block_components";
|
|
3
4
|
import { ContentRelative, ContentRelativeBinary, ContentRelativeText } from "./content_types";
|
|
4
5
|
import { CreateBlockPackDescriptionSchema } from "./block_description";
|
|
5
6
|
import { BlockPackMeta } from "./block_meta";
|
|
6
7
|
import { toMerged } from "es-toolkit";
|
|
7
8
|
import type { BlockPackId } from "./block_id";
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
-
|
|
10
|
+
export type BlockComponentsManifest = BlockComponents<ContentRelative, ContentRelative>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Block-components shape stored in a manifest. The consolidator always writes
|
|
14
|
+
* the wrapped `{type: "workflow-v1", main: ...}` form, so the manifest schema
|
|
15
|
+
* accepts the wrapped form only.
|
|
16
|
+
*/
|
|
17
|
+
export const BlockComponentsManifest = z.object({
|
|
18
|
+
workflow: WorkflowSchemaV1(ContentRelative),
|
|
19
|
+
model: ContentRelative,
|
|
20
|
+
ui: ContentRelative,
|
|
21
|
+
}) satisfies z.ZodType<BlockComponentsManifest>;
|
|
11
22
|
|
|
12
23
|
export const BlockPackMetaManifest = BlockPackMeta(ContentRelativeText, ContentRelativeBinary);
|
|
13
24
|
export type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;
|
|
@@ -16,6 +16,44 @@ export const BlockPlatform = z.enum([
|
|
|
16
16
|
]);
|
|
17
17
|
export type BlockPlatform = z.infer<typeof BlockPlatform>;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Static metadata a block author ships: title, descriptions, logos, social
|
|
21
|
+
* links, and capability requirements. Parameterized by the carriers used for
|
|
22
|
+
* long-string fields (`LongString`) and binary fields (`Binary`); the same
|
|
23
|
+
* shape carries `package.json` form (loose strings), manifest form (relative
|
|
24
|
+
* paths), and embedded form (inlined base64 or bytes).
|
|
25
|
+
*
|
|
26
|
+
* Forward-compatibility: the boundary zod schemas (`BlockPackMeta(...)` and
|
|
27
|
+
* `organization`) use `.passthrough()` so that unknown sibling fields survive
|
|
28
|
+
* parse/round-trip verbatim. A registry mutator that predates a new meta
|
|
29
|
+
* field must not silently strip it (otherwise mark-stable / refresh-overview
|
|
30
|
+
* / restore-overview would quietly undo publishes). Code consuming these
|
|
31
|
+
* objects sees only the known fields listed below; the schemas guard the
|
|
32
|
+
* round-trip behavior. Combined with the `require-latest @platforma-sdk/block-tools`
|
|
33
|
+
* CI gate, this future-proofs every subsequent field addition.
|
|
34
|
+
*/
|
|
35
|
+
export type BlockPackMeta<LongString, Binary> = {
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
longDescription?: LongString;
|
|
39
|
+
changelog?: LongString;
|
|
40
|
+
logo?: Binary;
|
|
41
|
+
url?: string;
|
|
42
|
+
docs?: string;
|
|
43
|
+
support?: string;
|
|
44
|
+
tags?: string[];
|
|
45
|
+
organization: {
|
|
46
|
+
name: string;
|
|
47
|
+
url: string;
|
|
48
|
+
logo?: Binary;
|
|
49
|
+
};
|
|
50
|
+
marketplaceRanking?: number;
|
|
51
|
+
deprecated?: boolean;
|
|
52
|
+
termsOfServiceUrl?: string;
|
|
53
|
+
supportedPlatforms?: BlockPlatform[];
|
|
54
|
+
requiredCapabilities?: string[];
|
|
55
|
+
};
|
|
56
|
+
|
|
19
57
|
export function BlockPackMeta<
|
|
20
58
|
const LongStringType extends z.ZodTypeAny,
|
|
21
59
|
const BinaryType extends z.ZodTypeAny,
|
|
@@ -71,12 +109,8 @@ export function BlockPackMeta<
|
|
|
71
109
|
requiredCapabilities: z.array(z.string()).optional(),
|
|
72
110
|
})
|
|
73
111
|
.passthrough();
|
|
74
|
-
// `.passthrough()`
|
|
75
|
-
//
|
|
76
|
-
// would strip that field on every registry-mutating command (mark-stable,
|
|
77
|
-
// refresh-registry, restore-overview-from-snapshot) — silently undoing
|
|
78
|
-
// publishes. Combined with the `require-latest @platforma-sdk/block-tools`
|
|
79
|
-
// CI gate, this future-proofs the schema for all subsequent field additions.
|
|
112
|
+
// `.passthrough()` is intentional — see forward-compat note on
|
|
113
|
+
// `BlockPackMeta` type above.
|
|
80
114
|
}
|
|
81
115
|
|
|
82
116
|
export const BlockPackMetaDescriptionRaw = BlockPackMeta(
|