@milaboratories/pl-model-middle-layer 1.8.6 → 1.8.8

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.
Files changed (124) hide show
  1. package/dist/author_marker.d.ts +0 -1
  2. package/dist/block_meta/block_components.cjs +45 -0
  3. package/dist/block_meta/block_components.cjs.map +1 -0
  4. package/dist/block_meta/block_components.d.ts +0 -1
  5. package/dist/block_meta/block_components.js +39 -0
  6. package/dist/block_meta/block_components.js.map +1 -0
  7. package/dist/block_meta/block_description.cjs +55 -0
  8. package/dist/block_meta/block_description.cjs.map +1 -0
  9. package/dist/block_meta/block_description.d.ts +0 -1
  10. package/dist/block_meta/block_description.js +30 -0
  11. package/dist/block_meta/block_description.js.map +1 -0
  12. package/dist/block_meta/block_id.cjs +46 -0
  13. package/dist/block_meta/block_id.cjs.map +1 -0
  14. package/dist/block_meta/block_id.d.ts +0 -1
  15. package/dist/block_meta/block_id.js +39 -0
  16. package/dist/block_meta/block_id.js.map +1 -0
  17. package/dist/block_meta/block_manifest.cjs +62 -0
  18. package/dist/block_meta/block_manifest.cjs.map +1 -0
  19. package/dist/block_meta/block_manifest.d.ts +5 -7
  20. package/dist/block_meta/block_manifest.js +34 -0
  21. package/dist/block_meta/block_manifest.js.map +1 -0
  22. package/dist/block_meta/block_meta.cjs +48 -0
  23. package/dist/block_meta/block_meta.cjs.map +1 -0
  24. package/dist/block_meta/block_meta.d.ts +0 -1
  25. package/dist/block_meta/block_meta.js +43 -0
  26. package/dist/block_meta/block_meta.js.map +1 -0
  27. package/dist/block_meta/common.d.ts +0 -1
  28. package/dist/block_meta/content_conversion.cjs +25 -0
  29. package/dist/block_meta/content_conversion.cjs.map +1 -0
  30. package/dist/block_meta/content_conversion.d.ts +0 -1
  31. package/dist/block_meta/content_conversion.js +22 -0
  32. package/dist/block_meta/content_conversion.js.map +1 -0
  33. package/dist/block_meta/content_types.cjs +223 -0
  34. package/dist/block_meta/content_types.cjs.map +1 -0
  35. package/dist/block_meta/content_types.d.ts +0 -1
  36. package/dist/block_meta/content_types.js +201 -0
  37. package/dist/block_meta/content_types.js.map +1 -0
  38. package/dist/block_meta/index.d.ts +0 -1
  39. package/dist/block_meta/semver.cjs +12 -0
  40. package/dist/block_meta/semver.cjs.map +1 -0
  41. package/dist/block_meta/semver.d.ts +0 -1
  42. package/dist/block_meta/semver.js +10 -0
  43. package/dist/block_meta/semver.js.map +1 -0
  44. package/dist/block_registry/block_pack_spec.cjs +56 -0
  45. package/dist/block_registry/block_pack_spec.cjs.map +1 -0
  46. package/dist/block_registry/block_pack_spec.d.ts +0 -1
  47. package/dist/block_registry/block_pack_spec.js +50 -0
  48. package/dist/block_registry/block_pack_spec.js.map +1 -0
  49. package/dist/block_registry/index.d.ts +0 -1
  50. package/dist/block_registry/overview.cjs +79 -0
  51. package/dist/block_registry/overview.cjs.map +1 -0
  52. package/dist/block_registry/overview.d.ts +9 -11
  53. package/dist/block_registry/overview.js +69 -0
  54. package/dist/block_registry/overview.js.map +1 -0
  55. package/dist/block_registry/registry_spec.cjs +36 -0
  56. package/dist/block_registry/registry_spec.cjs.map +1 -0
  57. package/dist/block_registry/registry_spec.d.ts +0 -1
  58. package/dist/block_registry/registry_spec.js +29 -0
  59. package/dist/block_registry/registry_spec.js.map +1 -0
  60. package/dist/block_settings.cjs +6 -0
  61. package/dist/block_settings.cjs.map +1 -0
  62. package/dist/block_settings.d.ts +0 -1
  63. package/dist/block_settings.js +4 -0
  64. package/dist/block_settings.js.map +1 -0
  65. package/dist/block_state.d.ts +0 -1
  66. package/dist/index.cjs +93 -0
  67. package/dist/index.cjs.map +1 -0
  68. package/dist/index.d.ts +0 -1
  69. package/dist/index.js +14 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/pframe/index.d.ts +0 -1
  72. package/dist/pframe/internal_api/api_factory.d.ts +8 -2
  73. package/dist/pframe/internal_api/api_read.d.ts +0 -1
  74. package/dist/pframe/internal_api/common.d.ts +0 -1
  75. package/dist/pframe/internal_api/create_table.d.ts +0 -1
  76. package/dist/pframe/internal_api/delete_column.d.ts +0 -1
  77. package/dist/pframe/internal_api/find_columns.d.ts +0 -1
  78. package/dist/pframe/internal_api/index.cjs +3 -0
  79. package/dist/pframe/internal_api/index.cjs.map +1 -0
  80. package/dist/pframe/internal_api/index.d.ts +0 -1
  81. package/dist/pframe/internal_api/index.js +2 -0
  82. package/dist/pframe/internal_api/index.js.map +1 -0
  83. package/dist/pframe/internal_api/pframe.d.ts +0 -1
  84. package/dist/pframe/internal_api/table.d.ts +0 -1
  85. package/dist/project.d.ts +0 -1
  86. package/dist/project_list.d.ts +0 -1
  87. package/dist/project_overview.d.ts +0 -1
  88. package/dist/update_info.d.ts +0 -1
  89. package/package.json +13 -11
  90. package/src/pframe/internal_api/api_factory.ts +21 -1
  91. package/dist/author_marker.d.ts.map +0 -1
  92. package/dist/block_meta/block_components.d.ts.map +0 -1
  93. package/dist/block_meta/block_description.d.ts.map +0 -1
  94. package/dist/block_meta/block_id.d.ts.map +0 -1
  95. package/dist/block_meta/block_manifest.d.ts.map +0 -1
  96. package/dist/block_meta/block_meta.d.ts.map +0 -1
  97. package/dist/block_meta/common.d.ts.map +0 -1
  98. package/dist/block_meta/content_conversion.d.ts.map +0 -1
  99. package/dist/block_meta/content_types.d.ts.map +0 -1
  100. package/dist/block_meta/index.d.ts.map +0 -1
  101. package/dist/block_meta/semver.d.ts.map +0 -1
  102. package/dist/block_registry/block_pack_spec.d.ts.map +0 -1
  103. package/dist/block_registry/index.d.ts.map +0 -1
  104. package/dist/block_registry/overview.d.ts.map +0 -1
  105. package/dist/block_registry/registry_spec.d.ts.map +0 -1
  106. package/dist/block_settings.d.ts.map +0 -1
  107. package/dist/block_state.d.ts.map +0 -1
  108. package/dist/index.d.ts.map +0 -1
  109. package/dist/index.mjs +0 -371
  110. package/dist/index.mjs.map +0 -1
  111. package/dist/pframe/index.d.ts.map +0 -1
  112. package/dist/pframe/internal_api/api_factory.d.ts.map +0 -1
  113. package/dist/pframe/internal_api/api_read.d.ts.map +0 -1
  114. package/dist/pframe/internal_api/common.d.ts.map +0 -1
  115. package/dist/pframe/internal_api/create_table.d.ts.map +0 -1
  116. package/dist/pframe/internal_api/delete_column.d.ts.map +0 -1
  117. package/dist/pframe/internal_api/find_columns.d.ts.map +0 -1
  118. package/dist/pframe/internal_api/index.d.ts.map +0 -1
  119. package/dist/pframe/internal_api/pframe.d.ts.map +0 -1
  120. package/dist/pframe/internal_api/table.d.ts.map +0 -1
  121. package/dist/project.d.ts.map +0 -1
  122. package/dist/project_list.d.ts.map +0 -1
  123. package/dist/project_overview.d.ts.map +0 -1
  124. package/dist/update_info.d.ts.map +0 -1
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ function mapRemoteToAbsolute(rootUrl) {
4
+ const rootWithSlash = rootUrl.endsWith('/') ? rootUrl : `${rootUrl}/`;
5
+ return (value) => value.type === 'relative'
6
+ ? { type: 'absolute-url', url: rootWithSlash + value.path }
7
+ : value;
8
+ }
9
+ /**
10
+ * Creates transformer of relative content paths, that adds a specific prefix to the relative path.
11
+ *
12
+ * If prefix = "nested-path/", paths like "somefile.txt" will be transformed to "nested-path/somefile.txt".
13
+ *
14
+ * @param prefix prefix to add to the relaive path, slesh at the end will be added automatically if missed
15
+ */
16
+ function addPrefixToRelative(prefix) {
17
+ const prefixWithSlash = prefix.endsWith('/') ? prefix : `${prefix}/`;
18
+ return (value) => (value.type === 'relative'
19
+ ? { type: 'relative', path: prefixWithSlash + value.path }
20
+ : value);
21
+ }
22
+
23
+ exports.addPrefixToRelative = addPrefixToRelative;
24
+ exports.mapRemoteToAbsolute = mapRemoteToAbsolute;
25
+ //# sourceMappingURL=content_conversion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content_conversion.cjs","sources":["../../src/block_meta/content_conversion.ts"],"sourcesContent":["import {\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 relaive path, slesh 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;;;;;"}
@@ -8,4 +8,3 @@ export declare function mapRemoteToAbsolute(rootUrl: string): <T extends Content
8
8
  * @param prefix prefix to add to the relaive path, slesh at the end will be added automatically if missed
9
9
  */
10
10
  export declare function addPrefixToRelative(prefix: string): <T extends ContentExplicitOrRelative>(value: T) => T;
11
- //# sourceMappingURL=content_conversion.d.ts.map
@@ -0,0 +1,22 @@
1
+ function mapRemoteToAbsolute(rootUrl) {
2
+ const rootWithSlash = rootUrl.endsWith('/') ? rootUrl : `${rootUrl}/`;
3
+ return (value) => value.type === 'relative'
4
+ ? { type: 'absolute-url', url: rootWithSlash + value.path }
5
+ : value;
6
+ }
7
+ /**
8
+ * Creates transformer of relative content paths, that adds a specific prefix to the relative path.
9
+ *
10
+ * If prefix = "nested-path/", paths like "somefile.txt" will be transformed to "nested-path/somefile.txt".
11
+ *
12
+ * @param prefix prefix to add to the relaive path, slesh at the end will be added automatically if missed
13
+ */
14
+ function addPrefixToRelative(prefix) {
15
+ const prefixWithSlash = prefix.endsWith('/') ? prefix : `${prefix}/`;
16
+ return (value) => (value.type === 'relative'
17
+ ? { type: 'relative', path: prefixWithSlash + value.path }
18
+ : value);
19
+ }
20
+
21
+ export { addPrefixToRelative, mapRemoteToAbsolute };
22
+ //# sourceMappingURL=content_conversion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content_conversion.js","sources":["../../src/block_meta/content_conversion.ts"],"sourcesContent":["import {\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 relaive path, slesh 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;;;;"}
@@ -0,0 +1,223 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ //
6
+ // Base content types
7
+ //
8
+ const ContentExplicitString = zod.z
9
+ .object({
10
+ type: zod.z.literal('explicit-string'),
11
+ content: zod.z.string().describe('Actual string value')
12
+ })
13
+ .strict();
14
+ const ContentExplicitBase64 = zod.z
15
+ .object({
16
+ type: zod.z.literal('explicit-base64'),
17
+ mimeType: zod.z
18
+ .string()
19
+ .regex(/\w+\/[-+.\w]+/)
20
+ .describe('MIME type to interpret content'),
21
+ content: zod.z.string().base64().describe('Base64 encoded binary value')
22
+ })
23
+ .strict();
24
+ const ContentRelative = zod.z
25
+ .object({
26
+ type: zod.z.literal('relative'),
27
+ path: zod.z
28
+ .string()
29
+ .describe('Address of the file, in most cases relative to the file which this structure is a part of')
30
+ })
31
+ .strict();
32
+ const absPathRegex = new RegExp(`^(/|[A-Z]:\\\\)`);
33
+ const ContentAbsoluteFile = zod.z
34
+ .object({
35
+ type: zod.z.literal('absolute-file'),
36
+ file: zod.z
37
+ .string()
38
+ .regex(absPathRegex, 'path to file must be absolute')
39
+ .describe('Absolute address of the file in local file system')
40
+ })
41
+ .strict();
42
+ const ContentAbsoluteUrl = zod.z
43
+ .object({
44
+ type: zod.z.literal('absolute-url'),
45
+ url: zod.z.string().url().describe('Global URL to reach the requested file')
46
+ })
47
+ .strict();
48
+ //
49
+ // Special content types
50
+ //
51
+ const ContentExplicitBytes = zod.z
52
+ .object({
53
+ type: zod.z.literal('explicit-bytes'),
54
+ mimeType: zod.z
55
+ .string()
56
+ .regex(/\w+\/[-+.\w]+/)
57
+ .describe('MIME type to interpret content'),
58
+ content: zod.z.instanceof(Uint8Array).describe('Raw content')
59
+ })
60
+ .strict();
61
+ const ContentAbsoluteFolder = zod.z
62
+ .object({
63
+ type: zod.z.literal('absolute-folder'),
64
+ folder: zod.z
65
+ .string()
66
+ .regex(absPathRegex, 'path to folder must be absolute')
67
+ .describe('Absolute address of the folder in local file system')
68
+ })
69
+ .strict();
70
+ //
71
+ // Unions
72
+ //
73
+ const ContentAny = zod.z.discriminatedUnion('type', [
74
+ ContentExplicitString,
75
+ ContentExplicitBase64,
76
+ ContentRelative,
77
+ ContentAbsoluteFile,
78
+ ContentAbsoluteUrl
79
+ ]);
80
+ const ContentExplicitOrRelative = zod.z.discriminatedUnion('type', [
81
+ ContentExplicitString,
82
+ ContentExplicitBase64,
83
+ ContentRelative
84
+ ]);
85
+ const ContentAnyLocal = zod.z.discriminatedUnion('type', [
86
+ ContentExplicitString,
87
+ ContentExplicitBase64,
88
+ ContentRelative,
89
+ ContentAbsoluteFile
90
+ ]);
91
+ const ContentAnyRemote = zod.z.discriminatedUnion('type', [
92
+ ContentExplicitString,
93
+ ContentExplicitBase64,
94
+ ContentRelative,
95
+ ContentAbsoluteUrl
96
+ ]);
97
+ //
98
+ // Narrow types with relative option
99
+ //
100
+ // export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [
101
+ // ContentExplicitBase64,
102
+ // ContentRelative,
103
+ // ContentAbsoluteUrl
104
+ // ]);
105
+ // export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;
106
+ const ContentAnyBinaryLocal = zod.z.discriminatedUnion('type', [
107
+ ContentExplicitBase64,
108
+ ContentRelative,
109
+ ContentAbsoluteFile
110
+ ]);
111
+ // export const ContentAnyTextRemote = z.discriminatedUnion('type', [
112
+ // ContentExplicitString,
113
+ // ContentRelative,
114
+ // ContentAbsoluteUrl
115
+ // ]);
116
+ // export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;
117
+ const ContentAnyTextLocal = zod.z.discriminatedUnion('type', [
118
+ ContentExplicitString,
119
+ ContentRelative,
120
+ ContentAbsoluteFile
121
+ ]);
122
+ //
123
+ // Narrow absolute types
124
+ //
125
+ const ContentAbsoluteBinaryRemote = zod.z.discriminatedUnion('type', [
126
+ ContentExplicitBase64,
127
+ ContentAbsoluteUrl
128
+ ]);
129
+ const ContentAbsoluteBinaryLocal = zod.z.discriminatedUnion('type', [
130
+ ContentExplicitBase64,
131
+ ContentAbsoluteFile
132
+ ]);
133
+ const ContentAbsoluteTextRemote = zod.z.discriminatedUnion('type', [
134
+ ContentExplicitString,
135
+ ContentAbsoluteUrl
136
+ ]);
137
+ const ContentAbsoluteTextLocal = zod.z.discriminatedUnion('type', [
138
+ ContentExplicitString,
139
+ ContentAbsoluteFile
140
+ ]);
141
+ //
142
+ // Narrow relative types
143
+ //
144
+ const ContentRelativeBinary = zod.z.discriminatedUnion('type', [
145
+ ContentExplicitBase64,
146
+ ContentRelative
147
+ ]);
148
+ const ContentRelativeText = zod.z.discriminatedUnion('type', [
149
+ ContentExplicitString,
150
+ ContentRelative
151
+ ]);
152
+ // export function ConstructContent(
153
+ // contentType: 'text',
154
+ // contextType: 'local'
155
+ // ): typeof ContentAnyTextLocal;
156
+ // export function ConstructContent(
157
+ // contentType: 'text',
158
+ // contextType: 'remote'
159
+ // ): typeof ContentAnyTextRemote;
160
+ // export function ConstructContent(
161
+ // contentType: 'binary',
162
+ // contextType: 'local'
163
+ // ): typeof ContentAnyBinaryLocal;
164
+ // export function ConstructContent(
165
+ // contentType: 'binary',
166
+ // contextType: 'remote'
167
+ // ): typeof ContentAnyBinaryRemote;
168
+ // export function ConstructContent(
169
+ // contentType: ContentType,
170
+ // contextType: ContextType
171
+ // ):
172
+ // | typeof ContentAnyTextLocal
173
+ // | typeof ContentAnyTextRemote
174
+ // | typeof ContentAnyBinaryLocal
175
+ // | typeof ContentAnyBinaryRemote;
176
+ // export function ConstructContent(contentType: ContentType, contextType: ContextType) {
177
+ // return contentType === 'text'
178
+ // ? contextType === 'local'
179
+ // ? ContentAnyTextLocal
180
+ // : ContentAnyTextRemote
181
+ // : contextType === 'local'
182
+ // ? ContentAnyBinaryLocal
183
+ // : ContentAnyBinaryRemote;
184
+ // }
185
+ const DescriptionContentBinary = zod.z.union([
186
+ zod.z
187
+ .string()
188
+ .startsWith('file:')
189
+ .transform((value, ctx) => ({ type: 'relative', path: value.slice(5) })),
190
+ ContentAnyBinaryLocal
191
+ ]);
192
+ const DescriptionContentText = zod.z.union([
193
+ zod.z.string().transform((value, ctx) => {
194
+ if (value.startsWith('file:'))
195
+ return { type: 'relative', path: value.slice(5) };
196
+ else
197
+ return { type: 'explicit-string', content: value };
198
+ }),
199
+ ContentAnyTextLocal
200
+ ]);
201
+
202
+ exports.ContentAbsoluteBinaryLocal = ContentAbsoluteBinaryLocal;
203
+ exports.ContentAbsoluteBinaryRemote = ContentAbsoluteBinaryRemote;
204
+ exports.ContentAbsoluteFile = ContentAbsoluteFile;
205
+ exports.ContentAbsoluteFolder = ContentAbsoluteFolder;
206
+ exports.ContentAbsoluteTextLocal = ContentAbsoluteTextLocal;
207
+ exports.ContentAbsoluteTextRemote = ContentAbsoluteTextRemote;
208
+ exports.ContentAbsoluteUrl = ContentAbsoluteUrl;
209
+ exports.ContentAny = ContentAny;
210
+ exports.ContentAnyBinaryLocal = ContentAnyBinaryLocal;
211
+ exports.ContentAnyLocal = ContentAnyLocal;
212
+ exports.ContentAnyRemote = ContentAnyRemote;
213
+ exports.ContentAnyTextLocal = ContentAnyTextLocal;
214
+ exports.ContentExplicitBase64 = ContentExplicitBase64;
215
+ exports.ContentExplicitBytes = ContentExplicitBytes;
216
+ exports.ContentExplicitOrRelative = ContentExplicitOrRelative;
217
+ exports.ContentExplicitString = ContentExplicitString;
218
+ exports.ContentRelative = ContentRelative;
219
+ exports.ContentRelativeBinary = ContentRelativeBinary;
220
+ exports.ContentRelativeText = ContentRelativeText;
221
+ exports.DescriptionContentBinary = DescriptionContentBinary;
222
+ exports.DescriptionContentText = DescriptionContentText;
223
+ //# sourceMappingURL=content_types.cjs.map
@@ -0,0 +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, ctx) => ({ 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, ctx) => {\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;CACnD;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;CACpE;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;CAEhG;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;CAChE;AACA,KAAA,MAAM;AAGF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AM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACjG;AACD,CAAA;AAGM,MAAM,sBAAsB,GAAGA,KAAC,CAAC,KAAK,CAAC;IAC5CA,KAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAsB,CAAC,KAAK,EAAE,GAAG,KAAI;AACvD,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;AACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -510,4 +510,3 @@ export declare const DescriptionContentText: z.ZodUnion<[z.ZodEffects<z.ZodStrin
510
510
  file: string;
511
511
  }>]>]>;
512
512
  export type DescriptionContentText = z.infer<typeof DescriptionContentText>;
513
- //# sourceMappingURL=content_types.d.ts.map
@@ -0,0 +1,201 @@
1
+ import { z } from 'zod';
2
+
3
+ //
4
+ // Base content types
5
+ //
6
+ const ContentExplicitString = z
7
+ .object({
8
+ type: z.literal('explicit-string'),
9
+ content: z.string().describe('Actual string value')
10
+ })
11
+ .strict();
12
+ const ContentExplicitBase64 = z
13
+ .object({
14
+ type: z.literal('explicit-base64'),
15
+ mimeType: z
16
+ .string()
17
+ .regex(/\w+\/[-+.\w]+/)
18
+ .describe('MIME type to interpret content'),
19
+ content: z.string().base64().describe('Base64 encoded binary value')
20
+ })
21
+ .strict();
22
+ const ContentRelative = z
23
+ .object({
24
+ type: z.literal('relative'),
25
+ path: z
26
+ .string()
27
+ .describe('Address of the file, in most cases relative to the file which this structure is a part of')
28
+ })
29
+ .strict();
30
+ const absPathRegex = new RegExp(`^(/|[A-Z]:\\\\)`);
31
+ const ContentAbsoluteFile = z
32
+ .object({
33
+ type: z.literal('absolute-file'),
34
+ file: z
35
+ .string()
36
+ .regex(absPathRegex, 'path to file must be absolute')
37
+ .describe('Absolute address of the file in local file system')
38
+ })
39
+ .strict();
40
+ const ContentAbsoluteUrl = z
41
+ .object({
42
+ type: z.literal('absolute-url'),
43
+ url: z.string().url().describe('Global URL to reach the requested file')
44
+ })
45
+ .strict();
46
+ //
47
+ // Special content types
48
+ //
49
+ const ContentExplicitBytes = z
50
+ .object({
51
+ type: z.literal('explicit-bytes'),
52
+ mimeType: z
53
+ .string()
54
+ .regex(/\w+\/[-+.\w]+/)
55
+ .describe('MIME type to interpret content'),
56
+ content: z.instanceof(Uint8Array).describe('Raw content')
57
+ })
58
+ .strict();
59
+ const ContentAbsoluteFolder = z
60
+ .object({
61
+ type: z.literal('absolute-folder'),
62
+ folder: z
63
+ .string()
64
+ .regex(absPathRegex, 'path to folder must be absolute')
65
+ .describe('Absolute address of the folder in local file system')
66
+ })
67
+ .strict();
68
+ //
69
+ // Unions
70
+ //
71
+ const ContentAny = z.discriminatedUnion('type', [
72
+ ContentExplicitString,
73
+ ContentExplicitBase64,
74
+ ContentRelative,
75
+ ContentAbsoluteFile,
76
+ ContentAbsoluteUrl
77
+ ]);
78
+ const ContentExplicitOrRelative = z.discriminatedUnion('type', [
79
+ ContentExplicitString,
80
+ ContentExplicitBase64,
81
+ ContentRelative
82
+ ]);
83
+ const ContentAnyLocal = z.discriminatedUnion('type', [
84
+ ContentExplicitString,
85
+ ContentExplicitBase64,
86
+ ContentRelative,
87
+ ContentAbsoluteFile
88
+ ]);
89
+ const ContentAnyRemote = z.discriminatedUnion('type', [
90
+ ContentExplicitString,
91
+ ContentExplicitBase64,
92
+ ContentRelative,
93
+ ContentAbsoluteUrl
94
+ ]);
95
+ //
96
+ // Narrow types with relative option
97
+ //
98
+ // export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [
99
+ // ContentExplicitBase64,
100
+ // ContentRelative,
101
+ // ContentAbsoluteUrl
102
+ // ]);
103
+ // export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;
104
+ const ContentAnyBinaryLocal = z.discriminatedUnion('type', [
105
+ ContentExplicitBase64,
106
+ ContentRelative,
107
+ ContentAbsoluteFile
108
+ ]);
109
+ // export const ContentAnyTextRemote = z.discriminatedUnion('type', [
110
+ // ContentExplicitString,
111
+ // ContentRelative,
112
+ // ContentAbsoluteUrl
113
+ // ]);
114
+ // export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;
115
+ const ContentAnyTextLocal = z.discriminatedUnion('type', [
116
+ ContentExplicitString,
117
+ ContentRelative,
118
+ ContentAbsoluteFile
119
+ ]);
120
+ //
121
+ // Narrow absolute types
122
+ //
123
+ const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [
124
+ ContentExplicitBase64,
125
+ ContentAbsoluteUrl
126
+ ]);
127
+ const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [
128
+ ContentExplicitBase64,
129
+ ContentAbsoluteFile
130
+ ]);
131
+ const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [
132
+ ContentExplicitString,
133
+ ContentAbsoluteUrl
134
+ ]);
135
+ const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [
136
+ ContentExplicitString,
137
+ ContentAbsoluteFile
138
+ ]);
139
+ //
140
+ // Narrow relative types
141
+ //
142
+ const ContentRelativeBinary = z.discriminatedUnion('type', [
143
+ ContentExplicitBase64,
144
+ ContentRelative
145
+ ]);
146
+ const ContentRelativeText = z.discriminatedUnion('type', [
147
+ ContentExplicitString,
148
+ ContentRelative
149
+ ]);
150
+ // export function ConstructContent(
151
+ // contentType: 'text',
152
+ // contextType: 'local'
153
+ // ): typeof ContentAnyTextLocal;
154
+ // export function ConstructContent(
155
+ // contentType: 'text',
156
+ // contextType: 'remote'
157
+ // ): typeof ContentAnyTextRemote;
158
+ // export function ConstructContent(
159
+ // contentType: 'binary',
160
+ // contextType: 'local'
161
+ // ): typeof ContentAnyBinaryLocal;
162
+ // export function ConstructContent(
163
+ // contentType: 'binary',
164
+ // contextType: 'remote'
165
+ // ): typeof ContentAnyBinaryRemote;
166
+ // export function ConstructContent(
167
+ // contentType: ContentType,
168
+ // contextType: ContextType
169
+ // ):
170
+ // | typeof ContentAnyTextLocal
171
+ // | typeof ContentAnyTextRemote
172
+ // | typeof ContentAnyBinaryLocal
173
+ // | typeof ContentAnyBinaryRemote;
174
+ // export function ConstructContent(contentType: ContentType, contextType: ContextType) {
175
+ // return contentType === 'text'
176
+ // ? contextType === 'local'
177
+ // ? ContentAnyTextLocal
178
+ // : ContentAnyTextRemote
179
+ // : contextType === 'local'
180
+ // ? ContentAnyBinaryLocal
181
+ // : ContentAnyBinaryRemote;
182
+ // }
183
+ const DescriptionContentBinary = z.union([
184
+ z
185
+ .string()
186
+ .startsWith('file:')
187
+ .transform((value, ctx) => ({ type: 'relative', path: value.slice(5) })),
188
+ ContentAnyBinaryLocal
189
+ ]);
190
+ const DescriptionContentText = z.union([
191
+ z.string().transform((value, ctx) => {
192
+ if (value.startsWith('file:'))
193
+ return { type: 'relative', path: value.slice(5) };
194
+ else
195
+ return { type: 'explicit-string', content: value };
196
+ }),
197
+ ContentAnyTextLocal
198
+ ]);
199
+
200
+ export { ContentAbsoluteBinaryLocal, ContentAbsoluteBinaryRemote, ContentAbsoluteFile, ContentAbsoluteFolder, ContentAbsoluteTextLocal, ContentAbsoluteTextRemote, ContentAbsoluteUrl, ContentAny, ContentAnyBinaryLocal, ContentAnyLocal, ContentAnyRemote, ContentAnyTextLocal, ContentExplicitBase64, ContentExplicitBytes, ContentExplicitOrRelative, ContentExplicitString, ContentRelative, ContentRelativeBinary, ContentRelativeText, DescriptionContentBinary, DescriptionContentText };
201
+ //# sourceMappingURL=content_types.js.map
@@ -0,0 +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, ctx) => ({ 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, ctx) => {\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;CACnD;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;CACpE;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;CAEhG;AACA,KAAA,MAAM;AAGT,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,CAAA,eAAA,CAAiB,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A;AACA;AACA;AACA;AACA;AACA;AACA;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,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACjG;AACD,CAAA;AAGM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAsB,CAAC,KAAK,EAAE,GAAG,KAAI;AACvD,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;AACD,CAAA;;;;"}
@@ -7,4 +7,3 @@ export * from './block_components';
7
7
  export * from './block_meta';
8
8
  export * from './block_description';
9
9
  export * from './block_manifest';
10
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // Regex taken from here:
6
+ // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
7
+ const SemVer = zod.z
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-]+)*))?$/, 'Wrong version format, please use valid semver');
10
+
11
+ exports.SemVer = SemVer;
12
+ //# sourceMappingURL=semver.cjs.map
@@ -0,0 +1 @@
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;;;;"}
@@ -1,3 +1,2 @@
1
1
  import { z } from 'zod';
2
2
  export declare const SemVer: z.ZodString;
3
- //# sourceMappingURL=semver.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+
3
+ // Regex taken from here:
4
+ // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
5
+ const SemVer = z
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-]+)*))?$/, 'Wrong version format, please use valid semver');
8
+
9
+ export { SemVer };
10
+ //# sourceMappingURL=semver.js.map
@@ -0,0 +1 @@
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;;;;"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+ require('../block_meta/content_types.cjs');
5
+ require('../block_meta/semver.cjs');
6
+ var block_id = require('../block_meta/block_id.cjs');
7
+ require('../block_meta/block_components.cjs');
8
+ require('../block_meta/block_meta.cjs');
9
+ require('../block_meta/block_description.cjs');
10
+ require('../block_meta/block_manifest.cjs');
11
+
12
+ /** Block pack from local folder, to be used during block development. Old layout.
13
+ * @deprecated don't use */
14
+ const BlockPackDevV1 = zod.z.object({
15
+ type: zod.z.literal('dev-v1'),
16
+ folder: zod.z.string(),
17
+ mtime: zod.z.string().optional()
18
+ });
19
+ /** Block pack from local folder, to be used during block development. New layout. */
20
+ const BlockPackDevV2 = zod.z.object({
21
+ type: zod.z.literal('dev-v2'),
22
+ folder: zod.z.string(),
23
+ mtime: zod.z.string().optional()
24
+ });
25
+ /**
26
+ * Block pack from registry with version 2 layout, to be loaded directly
27
+ * from the client.
28
+ * @deprecated don't use
29
+ * */
30
+ const BlockPackFromRegistryV1 = zod.z.object({
31
+ type: zod.z.literal('from-registry-v1'),
32
+ registryUrl: zod.z.string(),
33
+ id: block_id.BlockPackId
34
+ });
35
+ /** Block pack from registry with version 2 layout, to be loaded directly
36
+ * from the client. */
37
+ const BlockPackFromRegistryV2 = zod.z.object({
38
+ type: zod.z.literal('from-registry-v2'),
39
+ registryUrl: zod.z.string(),
40
+ id: block_id.BlockPackId,
41
+ channel: zod.z.string().optional()
42
+ });
43
+ /** Information about block origin, can be used to instantiate new blocks */
44
+ const BlockPackSpec = zod.z.discriminatedUnion('type', [
45
+ BlockPackDevV1,
46
+ BlockPackDevV2,
47
+ BlockPackFromRegistryV1,
48
+ BlockPackFromRegistryV2
49
+ ]);
50
+
51
+ exports.BlockPackDevV1 = BlockPackDevV1;
52
+ exports.BlockPackDevV2 = BlockPackDevV2;
53
+ exports.BlockPackFromRegistryV1 = BlockPackFromRegistryV1;
54
+ exports.BlockPackFromRegistryV2 = BlockPackFromRegistryV2;
55
+ exports.BlockPackSpec = BlockPackSpec;
56
+ //# sourceMappingURL=block_pack_spec.cjs.map