@milaboratories/pl-model-middle-layer 1.11.3 → 1.11.5
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/author_marker.d.ts +1 -1
- package/dist/block_meta/block_components.cjs +4 -4
- package/dist/block_meta/block_components.cjs.map +1 -1
- package/dist/block_meta/block_components.d.ts +1 -1
- package/dist/block_meta/block_components.js +4 -4
- package/dist/block_meta/block_components.js.map +1 -1
- package/dist/block_meta/block_description.cjs +6 -3
- package/dist/block_meta/block_description.cjs.map +1 -1
- package/dist/block_meta/block_description.d.ts +4 -4
- package/dist/block_meta/block_description.d.ts.map +1 -1
- package/dist/block_meta/block_description.js +6 -3
- package/dist/block_meta/block_description.js.map +1 -1
- package/dist/block_meta/block_id.cjs.map +1 -1
- package/dist/block_meta/block_id.d.ts +1 -1
- package/dist/block_meta/block_id.js.map +1 -1
- package/dist/block_meta/block_manifest.cjs +6 -4
- package/dist/block_meta/block_manifest.cjs.map +1 -1
- package/dist/block_meta/block_manifest.d.ts +2 -2
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_meta/block_manifest.js +6 -4
- package/dist/block_meta/block_manifest.js.map +1 -1
- package/dist/block_meta/block_meta.cjs +10 -8
- package/dist/block_meta/block_meta.cjs.map +1 -1
- package/dist/block_meta/block_meta.d.ts +1 -1
- package/dist/block_meta/block_meta.d.ts.map +1 -1
- package/dist/block_meta/block_meta.js +10 -8
- package/dist/block_meta/block_meta.js.map +1 -1
- package/dist/block_meta/common.d.ts +2 -2
- package/dist/block_meta/content_conversion.cjs +6 -6
- package/dist/block_meta/content_conversion.cjs.map +1 -1
- package/dist/block_meta/content_conversion.d.ts +1 -1
- package/dist/block_meta/content_conversion.js +6 -6
- package/dist/block_meta/content_conversion.js.map +1 -1
- package/dist/block_meta/content_types.cjs +35 -35
- package/dist/block_meta/content_types.cjs.map +1 -1
- package/dist/block_meta/content_types.d.ts +1 -1
- package/dist/block_meta/content_types.js +35 -35
- package/dist/block_meta/content_types.js.map +1 -1
- package/dist/block_meta/index.d.ts +9 -9
- package/dist/block_meta/semver.cjs +1 -1
- package/dist/block_meta/semver.cjs.map +1 -1
- package/dist/block_meta/semver.d.ts +1 -1
- package/dist/block_meta/semver.js +1 -1
- package/dist/block_meta/semver.js.map +1 -1
- package/dist/block_registry/block_pack_spec.cjs +5 -5
- package/dist/block_registry/block_pack_spec.cjs.map +1 -1
- package/dist/block_registry/block_pack_spec.d.ts +1 -1
- package/dist/block_registry/block_pack_spec.js +5 -5
- package/dist/block_registry/block_pack_spec.js.map +1 -1
- package/dist/block_registry/index.d.ts +3 -3
- package/dist/block_registry/overview.cjs +18 -10
- package/dist/block_registry/overview.cjs.map +1 -1
- package/dist/block_registry/overview.d.ts +1 -1
- package/dist/block_registry/overview.d.ts.map +1 -1
- package/dist/block_registry/overview.js +18 -10
- package/dist/block_registry/overview.js.map +1 -1
- package/dist/block_registry/registry_spec.cjs +4 -4
- package/dist/block_registry/registry_spec.cjs.map +1 -1
- package/dist/block_registry/registry_spec.d.ts +1 -1
- package/dist/block_registry/registry_spec.js +4 -4
- package/dist/block_registry/registry_spec.js.map +1 -1
- package/dist/block_settings.cjs.map +1 -1
- package/dist/block_settings.d.ts +1 -1
- package/dist/block_settings.js.map +1 -1
- package/dist/block_state.d.ts +4 -4
- package/dist/block_state.d.ts.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/json.cjs +4 -4
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +4 -4
- package/dist/json.js.map +1 -1
- package/dist/pframe/index.d.ts +1 -1
- package/dist/pframe/internal_api/api_factory.cjs +2 -2
- package/dist/pframe/internal_api/api_factory.cjs.map +1 -1
- package/dist/pframe/internal_api/api_factory.d.ts +3 -3
- package/dist/pframe/internal_api/api_factory.js +2 -2
- package/dist/pframe/internal_api/api_factory.js.map +1 -1
- package/dist/pframe/internal_api/api_read.d.ts +6 -6
- package/dist/pframe/internal_api/api_read.d.ts.map +1 -1
- package/dist/pframe/internal_api/api_wasm.d.ts +4 -4
- package/dist/pframe/internal_api/api_wasm.d.ts.map +1 -1
- package/dist/pframe/internal_api/common.d.ts +3 -3
- package/dist/pframe/internal_api/common.d.ts.map +1 -1
- package/dist/pframe/internal_api/create_table.d.ts +9 -9
- package/dist/pframe/internal_api/create_table.d.ts.map +1 -1
- package/dist/pframe/internal_api/delete_column.d.ts +1 -1
- package/dist/pframe/internal_api/find_columns.d.ts +2 -2
- package/dist/pframe/internal_api/http_helpers.cjs +4 -4
- package/dist/pframe/internal_api/http_helpers.cjs.map +1 -1
- package/dist/pframe/internal_api/http_helpers.d.ts +43 -43
- package/dist/pframe/internal_api/http_helpers.d.ts.map +1 -1
- package/dist/pframe/internal_api/http_helpers.js +4 -4
- package/dist/pframe/internal_api/http_helpers.js.map +1 -1
- package/dist/pframe/internal_api/index.d.ts +11 -11
- package/dist/pframe/internal_api/pframe.d.ts +4 -4
- package/dist/pframe/internal_api/table.d.ts +2 -2
- package/dist/pframe/internal_api/table.d.ts.map +1 -1
- package/dist/project_list.d.ts +1 -1
- package/dist/project_overview.d.ts +7 -7
- package/dist/project_overview.d.ts.map +1 -1
- package/dist/update_info.d.ts +2 -2
- package/package.json +18 -17
- package/src/author_marker.ts +1 -1
- package/src/block_meta/block_components.ts +7 -7
- package/src/block_meta/block_description.ts +17 -14
- package/src/block_meta/block_id.ts +3 -3
- package/src/block_meta/block_manifest.ts +16 -14
- package/src/block_meta/block_meta.ts +17 -21
- package/src/block_meta/common.ts +2 -2
- package/src/block_meta/content_conversion.ts +7 -7
- package/src/block_meta/content_types.ts +35 -35
- package/src/block_meta/index.ts +9 -9
- package/src/block_meta/semver.ts +2 -2
- package/src/block_registry/block_pack_spec.ts +7 -7
- package/src/block_registry/index.ts +3 -3
- package/src/block_registry/overview.ts +34 -26
- package/src/block_registry/registry_spec.ts +5 -5
- package/src/block_settings.ts +1 -1
- package/src/block_state.ts +10 -4
- package/src/index.ts +11 -11
- package/src/json.ts +17 -11
- package/src/pframe/index.ts +1 -1
- package/src/pframe/internal_api/api_factory.ts +6 -6
- package/src/pframe/internal_api/api_read.ts +20 -14
- package/src/pframe/internal_api/api_wasm.ts +9 -20
- package/src/pframe/internal_api/common.ts +5 -7
- package/src/pframe/internal_api/create_table.ts +14 -9
- package/src/pframe/internal_api/delete_column.ts +1 -1
- package/src/pframe/internal_api/find_columns.ts +2 -2
- package/src/pframe/internal_api/http_helpers.ts +52 -52
- package/src/pframe/internal_api/index.ts +11 -11
- package/src/pframe/internal_api/pframe.ts +5 -5
- package/src/pframe/internal_api/table.ts +4 -8
- package/src/project_list.ts +1 -1
- package/src/project_overview.ts +14 -7
- package/src/update_info.ts +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function mapRemoteToAbsolute(rootUrl) {
|
|
2
|
-
const rootWithSlash = rootUrl.endsWith(
|
|
3
|
-
return (value) => value.type ===
|
|
4
|
-
? { type:
|
|
2
|
+
const rootWithSlash = rootUrl.endsWith("/") ? rootUrl : `${rootUrl}/`;
|
|
3
|
+
return (value) => value.type === "relative"
|
|
4
|
+
? { type: "absolute-url", url: rootWithSlash + value.path }
|
|
5
5
|
: value;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -12,9 +12,9 @@ function mapRemoteToAbsolute(rootUrl) {
|
|
|
12
12
|
* @param prefix prefix to add to the relative path, slash at the end will be added automatically if missed
|
|
13
13
|
*/
|
|
14
14
|
function addPrefixToRelative(prefix) {
|
|
15
|
-
const prefixWithSlash = prefix.endsWith(
|
|
16
|
-
return (value) => (value.type ===
|
|
17
|
-
? { type:
|
|
15
|
+
const prefixWithSlash = prefix.endsWith("/") ? prefix : `${prefix}/`;
|
|
16
|
+
return (value) => (value.type === "relative"
|
|
17
|
+
? { type: "relative", path: prefixWithSlash + value.path }
|
|
18
18
|
: value);
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content_conversion.js","sources":["../../src/block_meta/content_conversion.ts"],"sourcesContent":["import type {\n ContentAbsoluteUrl,\n ContentAnyLocal,\n ContentExplicitOrRelative,\n ContentRelative,\n} from
|
|
1
|
+
{"version":3,"file":"content_conversion.js","sources":["../../src/block_meta/content_conversion.ts"],"sourcesContent":["import type {\n ContentAbsoluteUrl,\n ContentAnyLocal,\n ContentExplicitOrRelative,\n ContentRelative,\n} from \"./content_types\";\n\nexport function mapRemoteToAbsolute(\n rootUrl: string,\n): <T extends ContentAnyLocal>(value: T) => Exclude<T, ContentRelative> | ContentAbsoluteUrl {\n const rootWithSlash = rootUrl.endsWith(\"/\") ? rootUrl : `${rootUrl}/`;\n return <T extends ContentAnyLocal>(value: T) =>\n value.type === \"relative\"\n ? { type: \"absolute-url\", url: rootWithSlash + value.path }\n : (value as Exclude<T, ContentRelative>);\n}\n\n/**\n * Creates transformer of relative content paths, that adds a specific prefix to the relative path.\n *\n * If prefix = \"nested-path/\", paths like \"somefile.txt\" will be transformed to \"nested-path/somefile.txt\".\n *\n * @param prefix prefix to add to the relative path, slash at the end will be added automatically if missed\n */\nexport function addPrefixToRelative(\n prefix: string,\n): <T extends ContentExplicitOrRelative>(value: T) => T {\n const prefixWithSlash = prefix.endsWith(\"/\") ? prefix : `${prefix}/`;\n return <T extends ContentExplicitOrRelative>(value: T) =>\n (value.type === \"relative\"\n ? { type: \"relative\", path: prefixWithSlash + value.path }\n : value) as T;\n}\n"],"names":[],"mappings":"AAOM,SAAU,mBAAmB,CACjC,OAAe,EAAA;AAEf,IAAA,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAA,EAAG,OAAO,GAAG;IACrE,OAAO,CAA4B,KAAQ,KACzC,KAAK,CAAC,IAAI,KAAK;AACb,UAAE,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,KAAK,CAAC,IAAI;UACtD,KAAqC;AAC9C;AAEA;;;;;;AAMG;AACG,SAAU,mBAAmB,CACjC,MAAc,EAAA;AAEd,IAAA,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,CAAA,EAAG,MAAM,GAAG;IACpE,OAAO,CAAsC,KAAQ,MAClD,KAAK,CAAC,IAAI,KAAK;AACd,UAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,GAAG,KAAK,CAAC,IAAI;UACtD,KAAK,CAAM;AACnB;;;;"}
|
|
@@ -7,42 +7,42 @@ var zod = require('zod');
|
|
|
7
7
|
//
|
|
8
8
|
const ContentExplicitString = zod.z
|
|
9
9
|
.object({
|
|
10
|
-
type: zod.z.literal(
|
|
11
|
-
content: zod.z.string().describe(
|
|
10
|
+
type: zod.z.literal("explicit-string"),
|
|
11
|
+
content: zod.z.string().describe("Actual string value"),
|
|
12
12
|
})
|
|
13
13
|
.strict();
|
|
14
14
|
const ContentExplicitBase64 = zod.z
|
|
15
15
|
.object({
|
|
16
|
-
type: zod.z.literal(
|
|
16
|
+
type: zod.z.literal("explicit-base64"),
|
|
17
17
|
mimeType: zod.z
|
|
18
18
|
.string()
|
|
19
19
|
.regex(/\w+\/[-+.\w]+/)
|
|
20
|
-
.describe(
|
|
21
|
-
content: zod.z.string().base64().describe(
|
|
20
|
+
.describe("MIME type to interpret content"),
|
|
21
|
+
content: zod.z.string().base64().describe("Base64 encoded binary value"),
|
|
22
22
|
})
|
|
23
23
|
.strict();
|
|
24
24
|
const ContentRelative = zod.z
|
|
25
25
|
.object({
|
|
26
|
-
type: zod.z.literal(
|
|
26
|
+
type: zod.z.literal("relative"),
|
|
27
27
|
path: zod.z
|
|
28
28
|
.string()
|
|
29
|
-
.describe(
|
|
29
|
+
.describe("Address of the file, in most cases relative to the file which this structure is a part of"),
|
|
30
30
|
})
|
|
31
31
|
.strict();
|
|
32
32
|
const absPathRegex = new RegExp(`^(/|[A-Z]:\\\\)`);
|
|
33
33
|
const ContentAbsoluteFile = zod.z
|
|
34
34
|
.object({
|
|
35
|
-
type: zod.z.literal(
|
|
35
|
+
type: zod.z.literal("absolute-file"),
|
|
36
36
|
file: zod.z
|
|
37
37
|
.string()
|
|
38
|
-
.regex(absPathRegex,
|
|
39
|
-
.describe(
|
|
38
|
+
.regex(absPathRegex, "path to file must be absolute")
|
|
39
|
+
.describe("Absolute address of the file in local file system"),
|
|
40
40
|
})
|
|
41
41
|
.strict();
|
|
42
42
|
const ContentAbsoluteUrl = zod.z
|
|
43
43
|
.object({
|
|
44
|
-
type: zod.z.literal(
|
|
45
|
-
url: zod.z.string().url().describe(
|
|
44
|
+
type: zod.z.literal("absolute-url"),
|
|
45
|
+
url: zod.z.string().url().describe("Global URL to reach the requested file"),
|
|
46
46
|
})
|
|
47
47
|
.strict();
|
|
48
48
|
//
|
|
@@ -50,45 +50,45 @@ const ContentAbsoluteUrl = zod.z
|
|
|
50
50
|
//
|
|
51
51
|
const ContentExplicitBytes = zod.z
|
|
52
52
|
.object({
|
|
53
|
-
type: zod.z.literal(
|
|
53
|
+
type: zod.z.literal("explicit-bytes"),
|
|
54
54
|
mimeType: zod.z
|
|
55
55
|
.string()
|
|
56
56
|
.regex(/\w+\/[-+.\w]+/)
|
|
57
|
-
.describe(
|
|
58
|
-
content: zod.z.instanceof(Uint8Array).describe(
|
|
57
|
+
.describe("MIME type to interpret content"),
|
|
58
|
+
content: zod.z.instanceof(Uint8Array).describe("Raw content"),
|
|
59
59
|
})
|
|
60
60
|
.strict();
|
|
61
61
|
const ContentAbsoluteFolder = zod.z
|
|
62
62
|
.object({
|
|
63
|
-
type: zod.z.literal(
|
|
63
|
+
type: zod.z.literal("absolute-folder"),
|
|
64
64
|
folder: zod.z
|
|
65
65
|
.string()
|
|
66
|
-
.regex(absPathRegex,
|
|
67
|
-
.describe(
|
|
66
|
+
.regex(absPathRegex, "path to folder must be absolute")
|
|
67
|
+
.describe("Absolute address of the folder in local file system"),
|
|
68
68
|
})
|
|
69
69
|
.strict();
|
|
70
70
|
//
|
|
71
71
|
// Unions
|
|
72
72
|
//
|
|
73
|
-
const ContentAny = zod.z.discriminatedUnion(
|
|
73
|
+
const ContentAny = zod.z.discriminatedUnion("type", [
|
|
74
74
|
ContentExplicitString,
|
|
75
75
|
ContentExplicitBase64,
|
|
76
76
|
ContentRelative,
|
|
77
77
|
ContentAbsoluteFile,
|
|
78
78
|
ContentAbsoluteUrl,
|
|
79
79
|
]);
|
|
80
|
-
const ContentExplicitOrRelative = zod.z.discriminatedUnion(
|
|
80
|
+
const ContentExplicitOrRelative = zod.z.discriminatedUnion("type", [
|
|
81
81
|
ContentExplicitString,
|
|
82
82
|
ContentExplicitBase64,
|
|
83
83
|
ContentRelative,
|
|
84
84
|
]);
|
|
85
|
-
const ContentAnyLocal = zod.z.discriminatedUnion(
|
|
85
|
+
const ContentAnyLocal = zod.z.discriminatedUnion("type", [
|
|
86
86
|
ContentExplicitString,
|
|
87
87
|
ContentExplicitBase64,
|
|
88
88
|
ContentRelative,
|
|
89
89
|
ContentAbsoluteFile,
|
|
90
90
|
]);
|
|
91
|
-
const ContentAnyRemote = zod.z.discriminatedUnion(
|
|
91
|
+
const ContentAnyRemote = zod.z.discriminatedUnion("type", [
|
|
92
92
|
ContentExplicitString,
|
|
93
93
|
ContentExplicitBase64,
|
|
94
94
|
ContentRelative,
|
|
@@ -103,7 +103,7 @@ const ContentAnyRemote = zod.z.discriminatedUnion('type', [
|
|
|
103
103
|
// ContentAbsoluteUrl
|
|
104
104
|
// ]);
|
|
105
105
|
// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;
|
|
106
|
-
const ContentAnyBinaryLocal = zod.z.discriminatedUnion(
|
|
106
|
+
const ContentAnyBinaryLocal = zod.z.discriminatedUnion("type", [
|
|
107
107
|
ContentExplicitBase64,
|
|
108
108
|
ContentRelative,
|
|
109
109
|
ContentAbsoluteFile,
|
|
@@ -114,7 +114,7 @@ const ContentAnyBinaryLocal = zod.z.discriminatedUnion('type', [
|
|
|
114
114
|
// ContentAbsoluteUrl
|
|
115
115
|
// ]);
|
|
116
116
|
// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;
|
|
117
|
-
const ContentAnyTextLocal = zod.z.discriminatedUnion(
|
|
117
|
+
const ContentAnyTextLocal = zod.z.discriminatedUnion("type", [
|
|
118
118
|
ContentExplicitString,
|
|
119
119
|
ContentRelative,
|
|
120
120
|
ContentAbsoluteFile,
|
|
@@ -122,30 +122,30 @@ const ContentAnyTextLocal = zod.z.discriminatedUnion('type', [
|
|
|
122
122
|
//
|
|
123
123
|
// Narrow absolute types
|
|
124
124
|
//
|
|
125
|
-
const ContentAbsoluteBinaryRemote = zod.z.discriminatedUnion(
|
|
125
|
+
const ContentAbsoluteBinaryRemote = zod.z.discriminatedUnion("type", [
|
|
126
126
|
ContentExplicitBase64,
|
|
127
127
|
ContentAbsoluteUrl,
|
|
128
128
|
]);
|
|
129
|
-
const ContentAbsoluteBinaryLocal = zod.z.discriminatedUnion(
|
|
129
|
+
const ContentAbsoluteBinaryLocal = zod.z.discriminatedUnion("type", [
|
|
130
130
|
ContentExplicitBase64,
|
|
131
131
|
ContentAbsoluteFile,
|
|
132
132
|
]);
|
|
133
|
-
const ContentAbsoluteTextRemote = zod.z.discriminatedUnion(
|
|
133
|
+
const ContentAbsoluteTextRemote = zod.z.discriminatedUnion("type", [
|
|
134
134
|
ContentExplicitString,
|
|
135
135
|
ContentAbsoluteUrl,
|
|
136
136
|
]);
|
|
137
|
-
const ContentAbsoluteTextLocal = zod.z.discriminatedUnion(
|
|
137
|
+
const ContentAbsoluteTextLocal = zod.z.discriminatedUnion("type", [
|
|
138
138
|
ContentExplicitString,
|
|
139
139
|
ContentAbsoluteFile,
|
|
140
140
|
]);
|
|
141
141
|
//
|
|
142
142
|
// Narrow relative types
|
|
143
143
|
//
|
|
144
|
-
const ContentRelativeBinary = zod.z.discriminatedUnion(
|
|
144
|
+
const ContentRelativeBinary = zod.z.discriminatedUnion("type", [
|
|
145
145
|
ContentExplicitBase64,
|
|
146
146
|
ContentRelative,
|
|
147
147
|
]);
|
|
148
|
-
const ContentRelativeText = zod.z.discriminatedUnion(
|
|
148
|
+
const ContentRelativeText = zod.z.discriminatedUnion("type", [
|
|
149
149
|
ContentExplicitString,
|
|
150
150
|
ContentRelative,
|
|
151
151
|
]);
|
|
@@ -185,16 +185,16 @@ const ContentRelativeText = zod.z.discriminatedUnion('type', [
|
|
|
185
185
|
const DescriptionContentBinary = zod.z.union([
|
|
186
186
|
zod.z
|
|
187
187
|
.string()
|
|
188
|
-
.startsWith(
|
|
189
|
-
.transform((value) => ({ type:
|
|
188
|
+
.startsWith("file:")
|
|
189
|
+
.transform((value) => ({ type: "relative", path: value.slice(5) })),
|
|
190
190
|
ContentAnyBinaryLocal,
|
|
191
191
|
]);
|
|
192
192
|
const DescriptionContentText = zod.z.union([
|
|
193
193
|
zod.z.string().transform((value) => {
|
|
194
|
-
if (value.startsWith(
|
|
195
|
-
return { type:
|
|
194
|
+
if (value.startsWith("file:"))
|
|
195
|
+
return { type: "relative", path: value.slice(5) };
|
|
196
196
|
else
|
|
197
|
-
return { type:
|
|
197
|
+
return { type: "explicit-string", content: value };
|
|
198
198
|
}),
|
|
199
199
|
ContentAnyTextLocal,
|
|
200
200
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content_types.cjs","sources":["../../src/block_meta/content_types.ts"],"sourcesContent":["import { z } from 'zod';\n\n//\n// Base content types\n//\n\nexport const ContentExplicitString = z\n .object({\n type: z.literal('explicit-string'),\n content: z.string().describe('Actual string value'),\n })\n .strict();\nexport type ContentExplicitString = z.infer<typeof ContentExplicitString>;\n\nexport const ContentExplicitBase64 = z\n .object({\n type: z.literal('explicit-base64'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.string().base64().describe('Base64 encoded binary value'),\n })\n .strict();\nexport type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;\n\nexport const ContentRelative = z\n .object({\n type: z.literal('relative'),\n path: z\n .string()\n .describe(\n 'Address of the file, in most cases relative to the file which this structure is a part of',\n ),\n })\n .strict();\nexport type ContentRelative = z.infer<typeof ContentRelative>;\n\nconst absPathRegex = new RegExp(`^(/|[A-Z]:\\\\\\\\)`);\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal('absolute-file'),\n file: z\n .string()\n .regex(absPathRegex, 'path to file must be absolute')\n .describe('Absolute address of the file in local file system'),\n })\n .strict();\nexport type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;\n\nexport const ContentAbsoluteUrl = z\n .object({\n type: z.literal('absolute-url'),\n url: z.string().url().describe('Global URL to reach the requested file'),\n })\n .strict();\nexport type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;\n\n//\n// Special content types\n//\n\nexport const ContentExplicitBytes = z\n .object({\n type: z.literal('explicit-bytes'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.instanceof(Uint8Array).describe('Raw content'),\n })\n .strict();\nexport type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;\n\nexport const ContentAbsoluteFolder = z\n .object({\n type: z.literal('absolute-folder'),\n folder: z\n .string()\n .regex(absPathRegex, 'path to folder must be absolute')\n .describe('Absolute address of the folder in local file system'),\n })\n .strict();\nexport type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;\n\n//\n// Unions\n//\n\nexport const ContentAny = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n ContentAbsoluteUrl,\n]);\nexport type ContentAny = z.infer<typeof ContentAny>;\n\nexport const ContentExplicitOrRelative = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;\n\nexport const ContentAnyLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;\n\nexport const ContentAnyRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteUrl,\n]);\nexport type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;\n\n//\n// Narrow types with relative option\n//\n\n// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [\n// ContentExplicitBase64,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;\n\nexport const ContentAnyBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;\n\n// export const ContentAnyTextRemote = z.discriminatedUnion('type', [\n// ContentExplicitString,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;\n\nexport const ContentAnyTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;\n\n//\n// Narrow absolute types\n//\n\nexport const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;\n\nexport const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;\n\nexport const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;\n\nexport const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;\n\n//\n// Narrow relative types\n//\n\nexport const ContentRelativeBinary = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;\n\nexport const ContentRelativeText = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative,\n]);\nexport type ContentRelativeText = z.infer<typeof ContentRelativeText>;\n\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'local'\n// ): typeof ContentAnyTextLocal;\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'remote'\n// ): typeof ContentAnyTextRemote;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'local'\n// ): typeof ContentAnyBinaryLocal;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'remote'\n// ): typeof ContentAnyBinaryRemote;\n// export function ConstructContent(\n// contentType: ContentType,\n// contextType: ContextType\n// ):\n// | typeof ContentAnyTextLocal\n// | typeof ContentAnyTextRemote\n// | typeof ContentAnyBinaryLocal\n// | typeof ContentAnyBinaryRemote;\n// export function ConstructContent(contentType: ContentType, contextType: ContextType) {\n// return contentType === 'text'\n// ? contextType === 'local'\n// ? ContentAnyTextLocal\n// : ContentAnyTextRemote\n// : contextType === 'local'\n// ? ContentAnyBinaryLocal\n// : ContentAnyBinaryRemote;\n// }\n\nexport const DescriptionContentBinary = z.union([\n z\n .string()\n .startsWith('file:')\n .transform<ContentRelativeBinary>((value) => ({ type: 'relative', path: value.slice(5) })),\n ContentAnyBinaryLocal,\n]);\nexport type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;\n\nexport const DescriptionContentText = z.union([\n z.string().transform<ContentRelativeText>((value) => {\n if (value.startsWith('file:')) return { type: 'relative', path: value.slice(5) };\n else return { type: 'explicit-string', content: value };\n }),\n ContentAnyTextLocal,\n]);\nexport type DescriptionContentText = z.infer<typeof DescriptionContentText>;\n"],"names":["z"],"mappings":";;;;AAEA;AACA;AACA;AAEO,MAAM,qBAAqB,GAAGA;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,OAAO,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACpD;AACA,KAAA,MAAM;AAGF,MAAM,qBAAqB,GAAGA;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAClC,IAAA,QAAQ,EAAEA;AACP,SAAA,MAAM;SACN,KAAK,CAAC,eAAe;SACrB,QAAQ,CAAC,gCAAgC,CAAC;AAC7C,IAAA,OAAO,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE;AACA,KAAA,MAAM;AAGF,MAAM,eAAe,GAAGA;AAC5B,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AAC3B,IAAA,IAAI,EAAEA;AACH,SAAA,MAAM;SACN,QAAQ,CACP,2FAA2F,CAC5F;CACJ;AACA,KAAA,MAAM;AAGT,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,CAAA,eAAA,CAAiB,CAAC;AAE3C,MAAM,mBAAmB,GAAGA;AAChC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,eAAe,CAAC;AAChC,IAAA,IAAI,EAAEA;AACH,SAAA,MAAM;AACN,SAAA,KAAK,CAAC,YAAY,EAAE,+BAA+B;SACnD,QAAQ,CAAC,mDAAmD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A;AACA;AACA;AACA;AAEO,MAAM,wBAAwB,GAAGA,KAAC,CAAC,KAAK,CAAC;IAC9CA;AACG,SAAA,MAAM;SACN,UAAU,CAAC,OAAO;SAClB,SAAS,CAAwB,CAAC,KAAK,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5F,qBAAqB;AACtB,CAAA;AAGM,MAAM,sBAAsB,GAAGA,KAAC,CAAC,KAAK,CAAC;IAC5CA,KAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAsB,CAAC,KAAK,KAAI;AAClD,QAAA,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AAAE,YAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;;YAC3E,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE;AACzD,IAAA,CAAC,CAAC;IACF,mBAAmB;AACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"content_types.cjs","sources":["../../src/block_meta/content_types.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//\n// Base content types\n//\n\nexport const ContentExplicitString = z\n .object({\n type: z.literal(\"explicit-string\"),\n content: z.string().describe(\"Actual string value\"),\n })\n .strict();\nexport type ContentExplicitString = z.infer<typeof ContentExplicitString>;\n\nexport const ContentExplicitBase64 = z\n .object({\n type: z.literal(\"explicit-base64\"),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe(\"MIME type to interpret content\"),\n content: z.string().base64().describe(\"Base64 encoded binary value\"),\n })\n .strict();\nexport type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;\n\nexport const ContentRelative = z\n .object({\n type: z.literal(\"relative\"),\n path: z\n .string()\n .describe(\n \"Address of the file, in most cases relative to the file which this structure is a part of\",\n ),\n })\n .strict();\nexport type ContentRelative = z.infer<typeof ContentRelative>;\n\nconst absPathRegex = new RegExp(`^(/|[A-Z]:\\\\\\\\)`);\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal(\"absolute-file\"),\n file: z\n .string()\n .regex(absPathRegex, \"path to file must be absolute\")\n .describe(\"Absolute address of the file in local file system\"),\n })\n .strict();\nexport type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;\n\nexport const ContentAbsoluteUrl = z\n .object({\n type: z.literal(\"absolute-url\"),\n url: z.string().url().describe(\"Global URL to reach the requested file\"),\n })\n .strict();\nexport type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;\n\n//\n// Special content types\n//\n\nexport const ContentExplicitBytes = z\n .object({\n type: z.literal(\"explicit-bytes\"),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe(\"MIME type to interpret content\"),\n content: z.instanceof(Uint8Array).describe(\"Raw content\"),\n })\n .strict();\nexport type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;\n\nexport const ContentAbsoluteFolder = z\n .object({\n type: z.literal(\"absolute-folder\"),\n folder: z\n .string()\n .regex(absPathRegex, \"path to folder must be absolute\")\n .describe(\"Absolute address of the folder in local file system\"),\n })\n .strict();\nexport type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;\n\n//\n// Unions\n//\n\nexport const ContentAny = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n ContentAbsoluteUrl,\n]);\nexport type ContentAny = z.infer<typeof ContentAny>;\n\nexport const ContentExplicitOrRelative = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;\n\nexport const ContentAnyLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;\n\nexport const ContentAnyRemote = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteUrl,\n]);\nexport type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;\n\n//\n// Narrow types with relative option\n//\n\n// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [\n// ContentExplicitBase64,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;\n\nexport const ContentAnyBinaryLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;\n\n// export const ContentAnyTextRemote = z.discriminatedUnion('type', [\n// ContentExplicitString,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;\n\nexport const ContentAnyTextLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;\n\n//\n// Narrow absolute types\n//\n\nexport const ContentAbsoluteBinaryRemote = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;\n\nexport const ContentAbsoluteBinaryLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;\n\nexport const ContentAbsoluteTextRemote = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;\n\nexport const ContentAbsoluteTextLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;\n\n//\n// Narrow relative types\n//\n\nexport const ContentRelativeBinary = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;\n\nexport const ContentRelativeText = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentRelative,\n]);\nexport type ContentRelativeText = z.infer<typeof ContentRelativeText>;\n\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'local'\n// ): typeof ContentAnyTextLocal;\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'remote'\n// ): typeof ContentAnyTextRemote;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'local'\n// ): typeof ContentAnyBinaryLocal;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'remote'\n// ): typeof ContentAnyBinaryRemote;\n// export function ConstructContent(\n// contentType: ContentType,\n// contextType: ContextType\n// ):\n// | typeof ContentAnyTextLocal\n// | typeof ContentAnyTextRemote\n// | typeof ContentAnyBinaryLocal\n// | typeof ContentAnyBinaryRemote;\n// export function ConstructContent(contentType: ContentType, contextType: ContextType) {\n// return contentType === 'text'\n// ? contextType === 'local'\n// ? ContentAnyTextLocal\n// : ContentAnyTextRemote\n// : contextType === 'local'\n// ? ContentAnyBinaryLocal\n// : ContentAnyBinaryRemote;\n// }\n\nexport const DescriptionContentBinary = z.union([\n z\n .string()\n .startsWith(\"file:\")\n .transform<ContentRelativeBinary>((value) => ({ type: \"relative\", path: value.slice(5) })),\n ContentAnyBinaryLocal,\n]);\nexport type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;\n\nexport const DescriptionContentText = z.union([\n z.string().transform<ContentRelativeText>((value) => {\n if (value.startsWith(\"file:\")) return { type: \"relative\", path: value.slice(5) };\n else return { type: \"explicit-string\", content: value };\n }),\n ContentAnyTextLocal,\n]);\nexport type DescriptionContentText = z.infer<typeof DescriptionContentText>;\n"],"names":["z"],"mappings":";;;;AAEA;AACA;AACA;AAEO,MAAM,qBAAqB,GAAGA;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,OAAO,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACpD;AACA,KAAA,MAAM;AAGF,MAAM,qBAAqB,GAAGA;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAClC,IAAA,QAAQ,EAAEA;AACP,SAAA,MAAM;SACN,KAAK,CAAC,eAAe;SACrB,QAAQ,CAAC,gCAAgC,CAAC;AAC7C,IAAA,OAAO,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE;AACA,KAAA,MAAM;AAGF,MAAM,eAAe,GAAGA;AAC5B,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AAC3B,IAAA,IAAI,EAAEA;AACH,SAAA,MAAM;SACN,QAAQ,CACP,2FAA2F,CAC5F;CACJ;AACA,KAAA,MAAM;AAGT,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,CAAA,eAAA,CAAiB,CAAC;AAE3C,MAAM,mBAAmB,GAAGA;AAChC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAEA,KAAC,CAAC,OAAO,CAAC,eAAe,CAAC;AAChC,IAAA,IAAI,EAAEA;AACH,SAAA,MAAM;AACN,SAAA,KAAK,CAAC,YAAY,EAAE,+BAA+B;SACnD,QAAQ,CAAC,mDAAmD,CAAC;CACjE;AACA,KAAA,MAAM;A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AAwB,GAAGA,KAAC,CAAC,KAAK,CAAC;IAC9CA;AACG,SAAA,MAAM;SACN,UAAU,CAAC,OAAO;SAClB,SAAS,CAAwB,CAAC,KAAK,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5F,qBAAqB;AACtB,CAAA;AAGM,MAAM,sBAAsB,GAAGA,KAAC,CAAC,KAAK,CAAC;IAC5CA,KAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAsB,CAAC,KAAK,KAAI;AAClD,QAAA,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AAAE,YAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;;YAC3E,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE;AACzD,IAAA,CAAC,CAAC;IACF,mBAAmB;AACpB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,42 +5,42 @@ import { z } from 'zod';
|
|
|
5
5
|
//
|
|
6
6
|
const ContentExplicitString = z
|
|
7
7
|
.object({
|
|
8
|
-
type: z.literal(
|
|
9
|
-
content: z.string().describe(
|
|
8
|
+
type: z.literal("explicit-string"),
|
|
9
|
+
content: z.string().describe("Actual string value"),
|
|
10
10
|
})
|
|
11
11
|
.strict();
|
|
12
12
|
const ContentExplicitBase64 = z
|
|
13
13
|
.object({
|
|
14
|
-
type: z.literal(
|
|
14
|
+
type: z.literal("explicit-base64"),
|
|
15
15
|
mimeType: z
|
|
16
16
|
.string()
|
|
17
17
|
.regex(/\w+\/[-+.\w]+/)
|
|
18
|
-
.describe(
|
|
19
|
-
content: z.string().base64().describe(
|
|
18
|
+
.describe("MIME type to interpret content"),
|
|
19
|
+
content: z.string().base64().describe("Base64 encoded binary value"),
|
|
20
20
|
})
|
|
21
21
|
.strict();
|
|
22
22
|
const ContentRelative = z
|
|
23
23
|
.object({
|
|
24
|
-
type: z.literal(
|
|
24
|
+
type: z.literal("relative"),
|
|
25
25
|
path: z
|
|
26
26
|
.string()
|
|
27
|
-
.describe(
|
|
27
|
+
.describe("Address of the file, in most cases relative to the file which this structure is a part of"),
|
|
28
28
|
})
|
|
29
29
|
.strict();
|
|
30
30
|
const absPathRegex = new RegExp(`^(/|[A-Z]:\\\\)`);
|
|
31
31
|
const ContentAbsoluteFile = z
|
|
32
32
|
.object({
|
|
33
|
-
type: z.literal(
|
|
33
|
+
type: z.literal("absolute-file"),
|
|
34
34
|
file: z
|
|
35
35
|
.string()
|
|
36
|
-
.regex(absPathRegex,
|
|
37
|
-
.describe(
|
|
36
|
+
.regex(absPathRegex, "path to file must be absolute")
|
|
37
|
+
.describe("Absolute address of the file in local file system"),
|
|
38
38
|
})
|
|
39
39
|
.strict();
|
|
40
40
|
const ContentAbsoluteUrl = z
|
|
41
41
|
.object({
|
|
42
|
-
type: z.literal(
|
|
43
|
-
url: z.string().url().describe(
|
|
42
|
+
type: z.literal("absolute-url"),
|
|
43
|
+
url: z.string().url().describe("Global URL to reach the requested file"),
|
|
44
44
|
})
|
|
45
45
|
.strict();
|
|
46
46
|
//
|
|
@@ -48,45 +48,45 @@ const ContentAbsoluteUrl = z
|
|
|
48
48
|
//
|
|
49
49
|
const ContentExplicitBytes = z
|
|
50
50
|
.object({
|
|
51
|
-
type: z.literal(
|
|
51
|
+
type: z.literal("explicit-bytes"),
|
|
52
52
|
mimeType: z
|
|
53
53
|
.string()
|
|
54
54
|
.regex(/\w+\/[-+.\w]+/)
|
|
55
|
-
.describe(
|
|
56
|
-
content: z.instanceof(Uint8Array).describe(
|
|
55
|
+
.describe("MIME type to interpret content"),
|
|
56
|
+
content: z.instanceof(Uint8Array).describe("Raw content"),
|
|
57
57
|
})
|
|
58
58
|
.strict();
|
|
59
59
|
const ContentAbsoluteFolder = z
|
|
60
60
|
.object({
|
|
61
|
-
type: z.literal(
|
|
61
|
+
type: z.literal("absolute-folder"),
|
|
62
62
|
folder: z
|
|
63
63
|
.string()
|
|
64
|
-
.regex(absPathRegex,
|
|
65
|
-
.describe(
|
|
64
|
+
.regex(absPathRegex, "path to folder must be absolute")
|
|
65
|
+
.describe("Absolute address of the folder in local file system"),
|
|
66
66
|
})
|
|
67
67
|
.strict();
|
|
68
68
|
//
|
|
69
69
|
// Unions
|
|
70
70
|
//
|
|
71
|
-
const ContentAny = z.discriminatedUnion(
|
|
71
|
+
const ContentAny = z.discriminatedUnion("type", [
|
|
72
72
|
ContentExplicitString,
|
|
73
73
|
ContentExplicitBase64,
|
|
74
74
|
ContentRelative,
|
|
75
75
|
ContentAbsoluteFile,
|
|
76
76
|
ContentAbsoluteUrl,
|
|
77
77
|
]);
|
|
78
|
-
const ContentExplicitOrRelative = z.discriminatedUnion(
|
|
78
|
+
const ContentExplicitOrRelative = z.discriminatedUnion("type", [
|
|
79
79
|
ContentExplicitString,
|
|
80
80
|
ContentExplicitBase64,
|
|
81
81
|
ContentRelative,
|
|
82
82
|
]);
|
|
83
|
-
const ContentAnyLocal = z.discriminatedUnion(
|
|
83
|
+
const ContentAnyLocal = z.discriminatedUnion("type", [
|
|
84
84
|
ContentExplicitString,
|
|
85
85
|
ContentExplicitBase64,
|
|
86
86
|
ContentRelative,
|
|
87
87
|
ContentAbsoluteFile,
|
|
88
88
|
]);
|
|
89
|
-
const ContentAnyRemote = z.discriminatedUnion(
|
|
89
|
+
const ContentAnyRemote = z.discriminatedUnion("type", [
|
|
90
90
|
ContentExplicitString,
|
|
91
91
|
ContentExplicitBase64,
|
|
92
92
|
ContentRelative,
|
|
@@ -101,7 +101,7 @@ const ContentAnyRemote = z.discriminatedUnion('type', [
|
|
|
101
101
|
// ContentAbsoluteUrl
|
|
102
102
|
// ]);
|
|
103
103
|
// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;
|
|
104
|
-
const ContentAnyBinaryLocal = z.discriminatedUnion(
|
|
104
|
+
const ContentAnyBinaryLocal = z.discriminatedUnion("type", [
|
|
105
105
|
ContentExplicitBase64,
|
|
106
106
|
ContentRelative,
|
|
107
107
|
ContentAbsoluteFile,
|
|
@@ -112,7 +112,7 @@ const ContentAnyBinaryLocal = z.discriminatedUnion('type', [
|
|
|
112
112
|
// ContentAbsoluteUrl
|
|
113
113
|
// ]);
|
|
114
114
|
// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;
|
|
115
|
-
const ContentAnyTextLocal = z.discriminatedUnion(
|
|
115
|
+
const ContentAnyTextLocal = z.discriminatedUnion("type", [
|
|
116
116
|
ContentExplicitString,
|
|
117
117
|
ContentRelative,
|
|
118
118
|
ContentAbsoluteFile,
|
|
@@ -120,30 +120,30 @@ const ContentAnyTextLocal = z.discriminatedUnion('type', [
|
|
|
120
120
|
//
|
|
121
121
|
// Narrow absolute types
|
|
122
122
|
//
|
|
123
|
-
const ContentAbsoluteBinaryRemote = z.discriminatedUnion(
|
|
123
|
+
const ContentAbsoluteBinaryRemote = z.discriminatedUnion("type", [
|
|
124
124
|
ContentExplicitBase64,
|
|
125
125
|
ContentAbsoluteUrl,
|
|
126
126
|
]);
|
|
127
|
-
const ContentAbsoluteBinaryLocal = z.discriminatedUnion(
|
|
127
|
+
const ContentAbsoluteBinaryLocal = z.discriminatedUnion("type", [
|
|
128
128
|
ContentExplicitBase64,
|
|
129
129
|
ContentAbsoluteFile,
|
|
130
130
|
]);
|
|
131
|
-
const ContentAbsoluteTextRemote = z.discriminatedUnion(
|
|
131
|
+
const ContentAbsoluteTextRemote = z.discriminatedUnion("type", [
|
|
132
132
|
ContentExplicitString,
|
|
133
133
|
ContentAbsoluteUrl,
|
|
134
134
|
]);
|
|
135
|
-
const ContentAbsoluteTextLocal = z.discriminatedUnion(
|
|
135
|
+
const ContentAbsoluteTextLocal = z.discriminatedUnion("type", [
|
|
136
136
|
ContentExplicitString,
|
|
137
137
|
ContentAbsoluteFile,
|
|
138
138
|
]);
|
|
139
139
|
//
|
|
140
140
|
// Narrow relative types
|
|
141
141
|
//
|
|
142
|
-
const ContentRelativeBinary = z.discriminatedUnion(
|
|
142
|
+
const ContentRelativeBinary = z.discriminatedUnion("type", [
|
|
143
143
|
ContentExplicitBase64,
|
|
144
144
|
ContentRelative,
|
|
145
145
|
]);
|
|
146
|
-
const ContentRelativeText = z.discriminatedUnion(
|
|
146
|
+
const ContentRelativeText = z.discriminatedUnion("type", [
|
|
147
147
|
ContentExplicitString,
|
|
148
148
|
ContentRelative,
|
|
149
149
|
]);
|
|
@@ -183,16 +183,16 @@ const ContentRelativeText = z.discriminatedUnion('type', [
|
|
|
183
183
|
const DescriptionContentBinary = z.union([
|
|
184
184
|
z
|
|
185
185
|
.string()
|
|
186
|
-
.startsWith(
|
|
187
|
-
.transform((value) => ({ type:
|
|
186
|
+
.startsWith("file:")
|
|
187
|
+
.transform((value) => ({ type: "relative", path: value.slice(5) })),
|
|
188
188
|
ContentAnyBinaryLocal,
|
|
189
189
|
]);
|
|
190
190
|
const DescriptionContentText = z.union([
|
|
191
191
|
z.string().transform((value) => {
|
|
192
|
-
if (value.startsWith(
|
|
193
|
-
return { type:
|
|
192
|
+
if (value.startsWith("file:"))
|
|
193
|
+
return { type: "relative", path: value.slice(5) };
|
|
194
194
|
else
|
|
195
|
-
return { type:
|
|
195
|
+
return { type: "explicit-string", content: value };
|
|
196
196
|
}),
|
|
197
197
|
ContentAnyTextLocal,
|
|
198
198
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content_types.js","sources":["../../src/block_meta/content_types.ts"],"sourcesContent":["import { z } from 'zod';\n\n//\n// Base content types\n//\n\nexport const ContentExplicitString = z\n .object({\n type: z.literal('explicit-string'),\n content: z.string().describe('Actual string value'),\n })\n .strict();\nexport type ContentExplicitString = z.infer<typeof ContentExplicitString>;\n\nexport const ContentExplicitBase64 = z\n .object({\n type: z.literal('explicit-base64'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.string().base64().describe('Base64 encoded binary value'),\n })\n .strict();\nexport type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;\n\nexport const ContentRelative = z\n .object({\n type: z.literal('relative'),\n path: z\n .string()\n .describe(\n 'Address of the file, in most cases relative to the file which this structure is a part of',\n ),\n })\n .strict();\nexport type ContentRelative = z.infer<typeof ContentRelative>;\n\nconst absPathRegex = new RegExp(`^(/|[A-Z]:\\\\\\\\)`);\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal('absolute-file'),\n file: z\n .string()\n .regex(absPathRegex, 'path to file must be absolute')\n .describe('Absolute address of the file in local file system'),\n })\n .strict();\nexport type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;\n\nexport const ContentAbsoluteUrl = z\n .object({\n type: z.literal('absolute-url'),\n url: z.string().url().describe('Global URL to reach the requested file'),\n })\n .strict();\nexport type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;\n\n//\n// Special content types\n//\n\nexport const ContentExplicitBytes = z\n .object({\n type: z.literal('explicit-bytes'),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe('MIME type to interpret content'),\n content: z.instanceof(Uint8Array).describe('Raw content'),\n })\n .strict();\nexport type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;\n\nexport const ContentAbsoluteFolder = z\n .object({\n type: z.literal('absolute-folder'),\n folder: z\n .string()\n .regex(absPathRegex, 'path to folder must be absolute')\n .describe('Absolute address of the folder in local file system'),\n })\n .strict();\nexport type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;\n\n//\n// Unions\n//\n\nexport const ContentAny = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n ContentAbsoluteUrl,\n]);\nexport type ContentAny = z.infer<typeof ContentAny>;\n\nexport const ContentExplicitOrRelative = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;\n\nexport const ContentAnyLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;\n\nexport const ContentAnyRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteUrl,\n]);\nexport type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;\n\n//\n// Narrow types with relative option\n//\n\n// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [\n// ContentExplicitBase64,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;\n\nexport const ContentAnyBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;\n\n// export const ContentAnyTextRemote = z.discriminatedUnion('type', [\n// ContentExplicitString,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;\n\nexport const ContentAnyTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;\n\n//\n// Narrow absolute types\n//\n\nexport const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;\n\nexport const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;\n\nexport const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;\n\nexport const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;\n\n//\n// Narrow relative types\n//\n\nexport const ContentRelativeBinary = z.discriminatedUnion('type', [\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;\n\nexport const ContentRelativeText = z.discriminatedUnion('type', [\n ContentExplicitString,\n ContentRelative,\n]);\nexport type ContentRelativeText = z.infer<typeof ContentRelativeText>;\n\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'local'\n// ): typeof ContentAnyTextLocal;\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'remote'\n// ): typeof ContentAnyTextRemote;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'local'\n// ): typeof ContentAnyBinaryLocal;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'remote'\n// ): typeof ContentAnyBinaryRemote;\n// export function ConstructContent(\n// contentType: ContentType,\n// contextType: ContextType\n// ):\n// | typeof ContentAnyTextLocal\n// | typeof ContentAnyTextRemote\n// | typeof ContentAnyBinaryLocal\n// | typeof ContentAnyBinaryRemote;\n// export function ConstructContent(contentType: ContentType, contextType: ContextType) {\n// return contentType === 'text'\n// ? contextType === 'local'\n// ? ContentAnyTextLocal\n// : ContentAnyTextRemote\n// : contextType === 'local'\n// ? ContentAnyBinaryLocal\n// : ContentAnyBinaryRemote;\n// }\n\nexport const DescriptionContentBinary = z.union([\n z\n .string()\n .startsWith('file:')\n .transform<ContentRelativeBinary>((value) => ({ type: 'relative', path: value.slice(5) })),\n ContentAnyBinaryLocal,\n]);\nexport type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;\n\nexport const DescriptionContentText = z.union([\n z.string().transform<ContentRelativeText>((value) => {\n if (value.startsWith('file:')) return { type: 'relative', path: value.slice(5) };\n else return { type: 'explicit-string', content: value };\n }),\n ContentAnyTextLocal,\n]);\nexport type DescriptionContentText = z.infer<typeof DescriptionContentText>;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AAEO,MAAM,qBAAqB,GAAG;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACpD;AACA,KAAA,MAAM;AAGF,MAAM,qBAAqB,GAAG;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAClC,IAAA,QAAQ,EAAE;AACP,SAAA,MAAM;SACN,KAAK,CAAC,eAAe;SACrB,QAAQ,CAAC,gCAAgC,CAAC;AAC7C,IAAA,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE;AACA,KAAA,MAAM;AAGF,MAAM,eAAe,GAAG;AAC5B,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AAC3B,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;SACN,QAAQ,CACP,2FAA2F,CAC5F;CACJ;AACA,KAAA,MAAM;AAGT,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,CAAA,eAAA,CAAiB,CAAC;AAE3C,MAAM,mBAAmB,GAAG;AAChC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;AAChC,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;AACN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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC9C;AACG,SAAA,MAAM;SACN,UAAU,CAAC,OAAO;SAClB,SAAS,CAAwB,CAAC,KAAK,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5F,qBAAqB;AACtB,CAAA;AAGM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAsB,CAAC,KAAK,KAAI;AAClD,QAAA,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AAAE,YAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;;YAC3E,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE;AACzD,IAAA,CAAC,CAAC;IACF,mBAAmB;AACpB,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"content_types.js","sources":["../../src/block_meta/content_types.ts"],"sourcesContent":["import { z } from \"zod\";\n\n//\n// Base content types\n//\n\nexport const ContentExplicitString = z\n .object({\n type: z.literal(\"explicit-string\"),\n content: z.string().describe(\"Actual string value\"),\n })\n .strict();\nexport type ContentExplicitString = z.infer<typeof ContentExplicitString>;\n\nexport const ContentExplicitBase64 = z\n .object({\n type: z.literal(\"explicit-base64\"),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe(\"MIME type to interpret content\"),\n content: z.string().base64().describe(\"Base64 encoded binary value\"),\n })\n .strict();\nexport type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;\n\nexport const ContentRelative = z\n .object({\n type: z.literal(\"relative\"),\n path: z\n .string()\n .describe(\n \"Address of the file, in most cases relative to the file which this structure is a part of\",\n ),\n })\n .strict();\nexport type ContentRelative = z.infer<typeof ContentRelative>;\n\nconst absPathRegex = new RegExp(`^(/|[A-Z]:\\\\\\\\)`);\n\nexport const ContentAbsoluteFile = z\n .object({\n type: z.literal(\"absolute-file\"),\n file: z\n .string()\n .regex(absPathRegex, \"path to file must be absolute\")\n .describe(\"Absolute address of the file in local file system\"),\n })\n .strict();\nexport type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;\n\nexport const ContentAbsoluteUrl = z\n .object({\n type: z.literal(\"absolute-url\"),\n url: z.string().url().describe(\"Global URL to reach the requested file\"),\n })\n .strict();\nexport type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;\n\n//\n// Special content types\n//\n\nexport const ContentExplicitBytes = z\n .object({\n type: z.literal(\"explicit-bytes\"),\n mimeType: z\n .string()\n .regex(/\\w+\\/[-+.\\w]+/)\n .describe(\"MIME type to interpret content\"),\n content: z.instanceof(Uint8Array).describe(\"Raw content\"),\n })\n .strict();\nexport type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;\n\nexport const ContentAbsoluteFolder = z\n .object({\n type: z.literal(\"absolute-folder\"),\n folder: z\n .string()\n .regex(absPathRegex, \"path to folder must be absolute\")\n .describe(\"Absolute address of the folder in local file system\"),\n })\n .strict();\nexport type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;\n\n//\n// Unions\n//\n\nexport const ContentAny = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n ContentAbsoluteUrl,\n]);\nexport type ContentAny = z.infer<typeof ContentAny>;\n\nexport const ContentExplicitOrRelative = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;\n\nexport const ContentAnyLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;\n\nexport const ContentAnyRemote = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteUrl,\n]);\nexport type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;\n\n//\n// Narrow types with relative option\n//\n\n// export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [\n// ContentExplicitBase64,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;\n\nexport const ContentAnyBinaryLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;\n\n// export const ContentAnyTextRemote = z.discriminatedUnion('type', [\n// ContentExplicitString,\n// ContentRelative,\n// ContentAbsoluteUrl\n// ]);\n// export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;\n\nexport const ContentAnyTextLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentRelative,\n ContentAbsoluteFile,\n]);\nexport type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;\n\n//\n// Narrow absolute types\n//\n\nexport const ContentAbsoluteBinaryRemote = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;\n\nexport const ContentAbsoluteBinaryLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;\n\nexport const ContentAbsoluteTextRemote = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentAbsoluteUrl,\n]);\nexport type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;\n\nexport const ContentAbsoluteTextLocal = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentAbsoluteFile,\n]);\nexport type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;\n\n//\n// Narrow relative types\n//\n\nexport const ContentRelativeBinary = z.discriminatedUnion(\"type\", [\n ContentExplicitBase64,\n ContentRelative,\n]);\nexport type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;\n\nexport const ContentRelativeText = z.discriminatedUnion(\"type\", [\n ContentExplicitString,\n ContentRelative,\n]);\nexport type ContentRelativeText = z.infer<typeof ContentRelativeText>;\n\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'local'\n// ): typeof ContentAnyTextLocal;\n// export function ConstructContent(\n// contentType: 'text',\n// contextType: 'remote'\n// ): typeof ContentAnyTextRemote;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'local'\n// ): typeof ContentAnyBinaryLocal;\n// export function ConstructContent(\n// contentType: 'binary',\n// contextType: 'remote'\n// ): typeof ContentAnyBinaryRemote;\n// export function ConstructContent(\n// contentType: ContentType,\n// contextType: ContextType\n// ):\n// | typeof ContentAnyTextLocal\n// | typeof ContentAnyTextRemote\n// | typeof ContentAnyBinaryLocal\n// | typeof ContentAnyBinaryRemote;\n// export function ConstructContent(contentType: ContentType, contextType: ContextType) {\n// return contentType === 'text'\n// ? contextType === 'local'\n// ? ContentAnyTextLocal\n// : ContentAnyTextRemote\n// : contextType === 'local'\n// ? ContentAnyBinaryLocal\n// : ContentAnyBinaryRemote;\n// }\n\nexport const DescriptionContentBinary = z.union([\n z\n .string()\n .startsWith(\"file:\")\n .transform<ContentRelativeBinary>((value) => ({ type: \"relative\", path: value.slice(5) })),\n ContentAnyBinaryLocal,\n]);\nexport type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;\n\nexport const DescriptionContentText = z.union([\n z.string().transform<ContentRelativeText>((value) => {\n if (value.startsWith(\"file:\")) return { type: \"relative\", path: value.slice(5) };\n else return { type: \"explicit-string\", content: value };\n }),\n ContentAnyTextLocal,\n]);\nexport type DescriptionContentText = z.infer<typeof DescriptionContentText>;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AAEO,MAAM,qBAAqB,GAAG;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACpD;AACA,KAAA,MAAM;AAGF,MAAM,qBAAqB,GAAG;AAClC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAClC,IAAA,QAAQ,EAAE;AACP,SAAA,MAAM;SACN,KAAK,CAAC,eAAe;SACrB,QAAQ,CAAC,gCAAgC,CAAC;AAC7C,IAAA,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CACrE;AACA,KAAA,MAAM;AAGF,MAAM,eAAe,GAAG;AAC5B,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AAC3B,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;SACN,QAAQ,CACP,2FAA2F,CAC5F;CACJ;AACA,KAAA,MAAM;AAGT,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,CAAA,eAAA,CAAiB,CAAC;AAE3C,MAAM,mBAAmB,GAAG;AAChC,KAAA,MAAM,CAAC;AACN,IAAA,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;AAChC,IAAA,IAAI,EAAE;AACH,SAAA,MAAM;AACN,SAAA,KAAK,CAAC,YAAY,EAAE,+BAA+B;SACnD,QAAQ,CAAC,mDAAmD,CAAC;CACjE;AACA,KAAA,MAAM;AAGF,MAAM,k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C9C;AACG,SAAA,MAAM;SACN,UAAU,CAAC,OAAO;SAClB,SAAS,CAAwB,CAAC,KAAK,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5F,qBAAqB;AACtB,CAAA;AAGM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAsB,CAAC,KAAK,KAAI;AAClD,QAAA,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;AAAE,YAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;;YAC3E,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE;AACzD,IAAA,CAAC,CAAC;IACF,mBAAmB;AACpB,CAAA;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
1
|
+
export * from "./common";
|
|
2
|
+
export * from "./content_types";
|
|
3
|
+
export * from "./semver";
|
|
4
|
+
export * from "./content_conversion";
|
|
5
|
+
export * from "./block_id";
|
|
6
|
+
export * from "./block_components";
|
|
7
|
+
export * from "./block_meta";
|
|
8
|
+
export * from "./block_description";
|
|
9
|
+
export * from "./block_manifest";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -6,7 +6,7 @@ var zod = require('zod');
|
|
|
6
6
|
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
7
7
|
const SemVer = zod.z
|
|
8
8
|
.string()
|
|
9
|
-
.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,
|
|
9
|
+
.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/, "Wrong version format, please use valid semver");
|
|
10
10
|
|
|
11
11
|
exports.SemVer = SemVer;
|
|
12
12
|
//# sourceMappingURL=semver.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semver.cjs","sources":["../../src/block_meta/semver.ts"],"sourcesContent":["import { z } from
|
|
1
|
+
{"version":3,"file":"semver.cjs","sources":["../../src/block_meta/semver.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// Regex taken from here:\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nexport const SemVer = z\n .string()\n .regex(\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,\n \"Wrong version format, please use valid semver\",\n );\n"],"names":["z"],"mappings":";;;;AAEA;AACA;AACO,MAAM,MAAM,GAAGA;AACnB,KAAA,MAAM;AACN,KAAA,KAAK,CACJ,qLAAqL,EACrL,+CAA+C;;;;"}
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
5
5
|
const SemVer = z
|
|
6
6
|
.string()
|
|
7
|
-
.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,
|
|
7
|
+
.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/, "Wrong version format, please use valid semver");
|
|
8
8
|
|
|
9
9
|
export { SemVer };
|
|
10
10
|
//# sourceMappingURL=semver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semver.js","sources":["../../src/block_meta/semver.ts"],"sourcesContent":["import { z } from
|
|
1
|
+
{"version":3,"file":"semver.js","sources":["../../src/block_meta/semver.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// Regex taken from here:\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nexport const SemVer = z\n .string()\n .regex(\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/,\n \"Wrong version format, please use valid semver\",\n );\n"],"names":[],"mappings":";;AAEA;AACA;AACO,MAAM,MAAM,GAAG;AACnB,KAAA,MAAM;AACN,KAAA,KAAK,CACJ,qLAAqL,EACrL,+CAA+C;;;;"}
|