@milaboratories/pl-model-middle-layer 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/block_meta/block_components.cjs +19 -26
  2. package/dist/block_meta/block_components.cjs.map +1 -1
  3. package/dist/block_meta/block_components.d.ts +46 -428
  4. package/dist/block_meta/block_components.d.ts.map +1 -1
  5. package/dist/block_meta/block_components.js +19 -23
  6. package/dist/block_meta/block_components.js.map +1 -1
  7. package/dist/block_meta/block_description.cjs +5 -3
  8. package/dist/block_meta/block_description.cjs.map +1 -1
  9. package/dist/block_meta/block_description.d.ts +240 -752
  10. package/dist/block_meta/block_description.d.ts.map +1 -1
  11. package/dist/block_meta/block_description.js +5 -3
  12. package/dist/block_meta/block_description.js.map +1 -1
  13. package/dist/block_meta/block_id.d.ts +4 -4
  14. package/dist/block_meta/block_manifest.cjs +10 -1
  15. package/dist/block_meta/block_manifest.cjs.map +1 -1
  16. package/dist/block_meta/block_manifest.d.ts +395 -973
  17. package/dist/block_meta/block_manifest.d.ts.map +1 -1
  18. package/dist/block_meta/block_manifest.js +11 -2
  19. package/dist/block_meta/block_manifest.js.map +1 -1
  20. package/dist/block_meta/block_meta.cjs.map +1 -1
  21. package/dist/block_meta/block_meta.d.ts +128 -210
  22. package/dist/block_meta/block_meta.d.ts.map +1 -1
  23. package/dist/block_meta/block_meta.js.map +1 -1
  24. package/dist/block_meta/content_types.cjs +25 -77
  25. package/dist/block_meta/content_types.cjs.map +1 -1
  26. package/dist/block_meta/content_types.d.ts +65 -381
  27. package/dist/block_meta/content_types.d.ts.map +1 -1
  28. package/dist/block_meta/content_types.js +26 -64
  29. package/dist/block_meta/content_types.js.map +1 -1
  30. package/dist/block_meta/index.d.ts +3 -3
  31. package/dist/block_registry/block_pack_spec.d.ts +16 -16
  32. package/dist/block_registry/overview.d.ts +1540 -1540
  33. package/dist/block_registry/registry_spec.d.ts +12 -12
  34. package/dist/index.cjs +1 -18
  35. package/dist/index.d.ts +4 -4
  36. package/dist/index.js +3 -3
  37. package/dist/pframe/internal_api/table.d.ts +1 -5
  38. package/dist/pframe/internal_api/table.d.ts.map +1 -1
  39. package/package.json +4 -4
  40. package/src/block_meta/block_components.ts +67 -42
  41. package/src/block_meta/block_description.ts +18 -3
  42. package/src/block_meta/block_manifest.ts +14 -3
  43. package/src/block_meta/block_meta.ts +40 -6
  44. package/src/block_meta/content_types.ts +149 -207
  45. package/src/pframe/internal_api/table.ts +1 -7
@@ -1,249 +1,191 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  //
4
- // Base content types
4
+ // Canonical content types. TypeScript is the source of truth. The zod
5
+ // schemas below are boundary validators pegged to these types via
6
+ // `satisfies`; they exist only to parse external data (`package.json`,
7
+ // registry manifests, registry overview files).
5
8
  //
6
9
 
7
- export const ContentExplicitString = z
8
- .object({
9
- type: z.literal("explicit-string"),
10
- content: z.string().describe("Actual string value"),
11
- })
12
- .strict();
13
- export type ContentExplicitString = z.infer<typeof ContentExplicitString>;
10
+ /** Inlined plain string (e.g. a short text snippet or markdown body). */
11
+ export type ContentExplicitString = {
12
+ type: "explicit-string";
13
+ content: string;
14
+ };
15
+
16
+ /** Inlined binary blob carried as base64 (e.g. a serialized logo image). */
17
+ export type ContentExplicitBase64 = {
18
+ type: "explicit-base64";
19
+ /** MIME type used to interpret `content`. */
20
+ mimeType: string;
21
+ /** Base64-encoded binary payload. */
22
+ content: string;
23
+ };
24
+
25
+ /** Inlined binary blob carried as raw bytes. Wire form only; not used in JSON. */
26
+ export type ContentExplicitBytes = {
27
+ type: "explicit-bytes";
28
+ /** MIME type used to interpret `content`. */
29
+ mimeType: string;
30
+ content: Uint8Array;
31
+ };
32
+
33
+ /** Reference to a file by path relative to the carrying structure. */
34
+ export type ContentRelative = {
35
+ type: "relative";
36
+ path: string;
37
+ };
38
+
39
+ /** Reference to a file at an absolute local path. */
40
+ export type ContentAbsoluteFile = {
41
+ type: "absolute-file";
42
+ file: string;
43
+ };
44
+
45
+ /**
46
+ * Reference to a folder at an absolute local path. Used for UI bundles
47
+ * delivered as folders; the desktop "add block" dialog reads such folders on
48
+ * demand instead of pulling every UI bundle eagerly.
49
+ */
50
+ export type ContentAbsoluteFolder = {
51
+ type: "absolute-folder";
52
+ folder: string;
53
+ };
54
+
55
+ /** Reference to a file by remote URL (e.g. served from the registry). */
56
+ export type ContentAbsoluteUrl = {
57
+ type: "absolute-url";
58
+ url: string;
59
+ };
60
+
61
+ /** Canonical union of every content carrier shape used across the platform. */
62
+ export type Content =
63
+ | ContentExplicitString
64
+ | ContentExplicitBase64
65
+ | ContentExplicitBytes
66
+ | ContentRelative
67
+ | ContentAbsoluteFile
68
+ | ContentAbsoluteFolder
69
+ | ContentAbsoluteUrl;
14
70
 
15
- export const ContentExplicitBase64 = z
16
- .object({
17
- type: z.literal("explicit-base64"),
18
- mimeType: z
19
- .string()
20
- .regex(/\w+\/[-+.\w]+/)
21
- .describe("MIME type to interpret content"),
22
- content: z.string().base64().describe("Base64 encoded binary value"),
23
- })
24
- .strict();
25
- export type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;
71
+ //
72
+ // Slot-specific content unions. Each names a set of carriers allowed in a
73
+ // particular stage of the pipeline (boundary input, manifest, resolved).
74
+ //
26
75
 
27
- export const ContentRelative = z
28
- .object({
29
- type: z.literal("relative"),
30
- path: z
31
- .string()
32
- .describe(
33
- "Address of the file, in most cases relative to the file which this structure is a part of",
34
- ),
35
- })
36
- .strict();
37
- export type ContentRelative = z.infer<typeof ContentRelative>;
76
+ /** Inlined or relative-path content (text/binary inlined, or relative path). */
77
+ export type ContentExplicitOrRelative =
78
+ | ContentExplicitString
79
+ | ContentExplicitBase64
80
+ | ContentRelative;
81
+
82
+ /** Any locally-resolvable content (inlined, relative path, or absolute file). */
83
+ export type ContentAnyLocal =
84
+ | ContentExplicitString
85
+ | ContentExplicitBase64
86
+ | ContentRelative
87
+ | ContentAbsoluteFile;
88
+
89
+ /** Text content available locally (inlined, relative path, or absolute file). */
90
+ export type ContentAnyTextLocal = ContentExplicitString | ContentRelative | ContentAbsoluteFile;
91
+
92
+ /** Binary content available locally (inlined base64, relative path, or absolute file). */
93
+ export type ContentAnyBinaryLocal = ContentExplicitBase64 | ContentRelative | ContentAbsoluteFile;
94
+
95
+ /** Binary content fully resolved (inlined base64 or absolute file). */
96
+ export type ContentAbsoluteBinaryLocal = ContentExplicitBase64 | ContentAbsoluteFile;
97
+
98
+ /** Text content fully resolved (inlined string or absolute file). */
99
+ export type ContentAbsoluteTextLocal = ContentExplicitString | ContentAbsoluteFile;
100
+
101
+ /** Binary content in manifest form (inlined base64 or path relative to the manifest). */
102
+ export type ContentRelativeBinary = ContentExplicitBase64 | ContentRelative;
103
+
104
+ /** Text content in manifest form (inlined string or path relative to the manifest). */
105
+ export type ContentRelativeText = ContentExplicitString | ContentRelative;
106
+
107
+ //
108
+ // Zod schemas — boundary validators only. The TS types above are the source
109
+ // of truth; each schema is pegged via `satisfies z.ZodType<T>`. Only the
110
+ // schemas referenced by sibling boundary files (`block_meta.ts`,
111
+ // `block_manifest.ts`) are exported.
112
+ //
38
113
 
39
114
  const absPathRegex = new RegExp(`^(/|[A-Z]:\\\\)`);
40
115
 
41
- export const ContentAbsoluteFile = z
116
+ const contentExplicitStringSchema = z
42
117
  .object({
43
- type: z.literal("absolute-file"),
44
- file: z
45
- .string()
46
- .regex(absPathRegex, "path to file must be absolute")
47
- .describe("Absolute address of the file in local file system"),
118
+ type: z.literal("explicit-string"),
119
+ content: z.string(),
48
120
  })
49
- .strict();
50
- export type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;
121
+ .strict() satisfies z.ZodType<ContentExplicitString>;
51
122
 
52
- export const ContentAbsoluteUrl = z
123
+ export const ContentExplicitBase64 = z
53
124
  .object({
54
- type: z.literal("absolute-url"),
55
- url: z.string().url().describe("Global URL to reach the requested file"),
125
+ type: z.literal("explicit-base64"),
126
+ mimeType: z.string().regex(/\w+\/[-+.\w]+/),
127
+ content: z.string().base64(),
56
128
  })
57
- .strict();
58
- export type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;
59
-
60
- //
61
- // Special content types
62
- //
129
+ .strict() satisfies z.ZodType<ContentExplicitBase64>;
63
130
 
64
131
  export const ContentExplicitBytes = z
65
132
  .object({
66
133
  type: z.literal("explicit-bytes"),
67
- mimeType: z
68
- .string()
69
- .regex(/\w+\/[-+.\w]+/)
70
- .describe("MIME type to interpret content"),
71
- content: z.instanceof(Uint8Array).describe("Raw content"),
134
+ mimeType: z.string().regex(/\w+\/[-+.\w]+/),
135
+ content: z.instanceof(Uint8Array),
72
136
  })
73
- .strict();
74
- export type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;
137
+ .strict() satisfies z.ZodType<ContentExplicitBytes>;
75
138
 
76
- export const ContentAbsoluteFolder = z
139
+ export const ContentRelative = z
77
140
  .object({
78
- type: z.literal("absolute-folder"),
79
- folder: z
80
- .string()
81
- .regex(absPathRegex, "path to folder must be absolute")
82
- .describe("Absolute address of the folder in local file system"),
141
+ type: z.literal("relative"),
142
+ path: z.string(),
83
143
  })
84
- .strict();
85
- export type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;
86
-
87
- //
88
- // Unions
89
- //
144
+ .strict() satisfies z.ZodType<ContentRelative>;
90
145
 
91
- export const ContentAny = z.discriminatedUnion("type", [
92
- ContentExplicitString,
93
- ContentExplicitBase64,
94
- ContentRelative,
95
- ContentAbsoluteFile,
96
- ContentAbsoluteUrl,
97
- ]);
98
- export type ContentAny = z.infer<typeof ContentAny>;
99
-
100
- export const ContentExplicitOrRelative = z.discriminatedUnion("type", [
101
- ContentExplicitString,
102
- ContentExplicitBase64,
103
- ContentRelative,
104
- ]);
105
- export type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;
106
-
107
- export const ContentAnyLocal = z.discriminatedUnion("type", [
108
- ContentExplicitString,
109
- ContentExplicitBase64,
110
- ContentRelative,
111
- ContentAbsoluteFile,
112
- ]);
113
- export type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;
146
+ const contentAbsoluteFileSchema = z
147
+ .object({
148
+ type: z.literal("absolute-file"),
149
+ file: z.string().regex(absPathRegex, "path to file must be absolute"),
150
+ })
151
+ .strict() satisfies z.ZodType<ContentAbsoluteFile>;
114
152
 
115
- export const ContentAnyRemote = z.discriminatedUnion("type", [
116
- ContentExplicitString,
153
+ export const ContentRelativeBinary = z.discriminatedUnion("type", [
117
154
  ContentExplicitBase64,
118
155
  ContentRelative,
119
- ContentAbsoluteUrl,
120
- ]);
121
- export type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;
122
-
123
- //
124
- // Narrow types with relative option
125
- //
126
-
127
- // export const ContentAnyBinaryRemote = z.discriminatedUnion('type', [
128
- // ContentExplicitBase64,
129
- // ContentRelative,
130
- // ContentAbsoluteUrl
131
- // ]);
132
- // export type ContentAnyBinaryRemote = z.infer<typeof ContentAnyBinaryRemote>;
156
+ ]) satisfies z.ZodType<ContentRelativeBinary>;
133
157
 
134
- export const ContentAnyBinaryLocal = z.discriminatedUnion("type", [
135
- ContentExplicitBase64,
136
- ContentRelative,
137
- ContentAbsoluteFile,
138
- ]);
139
- export type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;
140
-
141
- // export const ContentAnyTextRemote = z.discriminatedUnion('type', [
142
- // ContentExplicitString,
143
- // ContentRelative,
144
- // ContentAbsoluteUrl
145
- // ]);
146
- // export type ContentAnyTextRemote = z.infer<typeof ContentAnyTextRemote>;
147
-
148
- export const ContentAnyTextLocal = z.discriminatedUnion("type", [
149
- ContentExplicitString,
158
+ export const ContentRelativeText = z.discriminatedUnion("type", [
159
+ contentExplicitStringSchema,
150
160
  ContentRelative,
151
- ContentAbsoluteFile,
152
- ]);
153
- export type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;
161
+ ]) satisfies z.ZodType<ContentRelativeText>;
154
162
 
155
163
  //
156
- // Narrow absolute types
157
- //
158
-
159
- export const ContentAbsoluteBinaryRemote = z.discriminatedUnion("type", [
160
- ContentExplicitBase64,
161
- ContentAbsoluteUrl,
162
- ]);
163
- export type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;
164
-
165
- export const ContentAbsoluteBinaryLocal = z.discriminatedUnion("type", [
166
- ContentExplicitBase64,
167
- ContentAbsoluteFile,
168
- ]);
169
- export type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;
170
-
171
- export const ContentAbsoluteTextRemote = z.discriminatedUnion("type", [
172
- ContentExplicitString,
173
- ContentAbsoluteUrl,
174
- ]);
175
- export type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;
176
-
177
- export const ContentAbsoluteTextLocal = z.discriminatedUnion("type", [
178
- ContentExplicitString,
179
- ContentAbsoluteFile,
180
- ]);
181
- export type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;
182
-
164
+ // Boundary normalizing transforms — parse the loose forms authors write in
165
+ // `package.json`. Bare strings with the `file:` prefix become a
166
+ // `ContentRelative`; bare strings without the prefix become a
167
+ // `ContentExplicitString` (text only).
183
168
  //
184
- // Narrow relative types
185
- //
186
-
187
- export const ContentRelativeBinary = z.discriminatedUnion("type", [
188
- ContentExplicitBase64,
189
- ContentRelative,
190
- ]);
191
- export type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;
192
-
193
- export const ContentRelativeText = z.discriminatedUnion("type", [
194
- ContentExplicitString,
195
- ContentRelative,
196
- ]);
197
- export type ContentRelativeText = z.infer<typeof ContentRelativeText>;
198
-
199
- // export function ConstructContent(
200
- // contentType: 'text',
201
- // contextType: 'local'
202
- // ): typeof ContentAnyTextLocal;
203
- // export function ConstructContent(
204
- // contentType: 'text',
205
- // contextType: 'remote'
206
- // ): typeof ContentAnyTextRemote;
207
- // export function ConstructContent(
208
- // contentType: 'binary',
209
- // contextType: 'local'
210
- // ): typeof ContentAnyBinaryLocal;
211
- // export function ConstructContent(
212
- // contentType: 'binary',
213
- // contextType: 'remote'
214
- // ): typeof ContentAnyBinaryRemote;
215
- // export function ConstructContent(
216
- // contentType: ContentType,
217
- // contextType: ContextType
218
- // ):
219
- // | typeof ContentAnyTextLocal
220
- // | typeof ContentAnyTextRemote
221
- // | typeof ContentAnyBinaryLocal
222
- // | typeof ContentAnyBinaryRemote;
223
- // export function ConstructContent(contentType: ContentType, contextType: ContextType) {
224
- // return contentType === 'text'
225
- // ? contextType === 'local'
226
- // ? ContentAnyTextLocal
227
- // : ContentAnyTextRemote
228
- // : contextType === 'local'
229
- // ? ContentAnyBinaryLocal
230
- // : ContentAnyBinaryRemote;
231
- // }
232
169
 
233
170
  export const DescriptionContentBinary = z.union([
234
171
  z
235
172
  .string()
236
173
  .startsWith("file:")
237
- .transform<ContentRelativeBinary>((value) => ({ type: "relative", path: value.slice(5) })),
238
- ContentAnyBinaryLocal,
239
- ]);
240
- export type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;
174
+ .transform<ContentRelativeBinary>((value) => ({
175
+ type: "relative",
176
+ path: value.slice(5),
177
+ })),
178
+ z.discriminatedUnion("type", [ContentExplicitBase64, ContentRelative, contentAbsoluteFileSchema]),
179
+ ]) satisfies z.ZodType<ContentAnyBinaryLocal, z.ZodTypeDef, any>;
241
180
 
242
181
  export const DescriptionContentText = z.union([
243
182
  z.string().transform<ContentRelativeText>((value) => {
244
183
  if (value.startsWith("file:")) return { type: "relative", path: value.slice(5) };
245
- else return { type: "explicit-string", content: value };
184
+ return { type: "explicit-string", content: value };
246
185
  }),
247
- ContentAnyTextLocal,
248
- ]);
249
- export type DescriptionContentText = z.infer<typeof DescriptionContentText>;
186
+ z.discriminatedUnion("type", [
187
+ contentExplicitStringSchema,
188
+ ContentRelative,
189
+ contentAbsoluteFileSchema,
190
+ ]),
191
+ ]) satisfies z.ZodType<ContentAnyTextLocal, z.ZodTypeDef, any>;
@@ -70,7 +70,7 @@ export interface PTableV8 extends Disposable {
70
70
  }
71
71
 
72
72
  /**
73
- * Table view returned by `createTableV2`, `filter`, and `sort`.
73
+ * Table view returned by `createTableV2`.
74
74
  *
75
75
  * PTable can be thought as having a composite primary key, consisting
76
76
  * of axes, and a set of data columns derived from PColumn values.
@@ -113,12 +113,6 @@ export interface PTableV9 extends Disposable {
113
113
  },
114
114
  ): Promise<PTableVector[]>;
115
115
 
116
- /** Filters the table and returns new PTable instance */
117
- filter(tableId: PTableId, request: PTableRecordFilter[]): PTableV9;
118
-
119
- /** Sorts the table and returns new PTable instance. */
120
- sort(tableId: PTableId, request: PTableSorting[]): PTableV9;
121
-
122
116
  /** Deallocates all underlying resources */
123
117
  dispose(): void;
124
118
  }