@milaboratories/pl-model-common 1.15.2 → 1.15.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-common",
3
- "version": "1.15.2",
3
+ "version": "1.15.4",
4
4
  "description": "Platforma SDK Model",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -24,10 +24,10 @@
24
24
  "devDependencies": {
25
25
  "eslint": "^9.25.1",
26
26
  "typescript": "~5.5.4",
27
- "vite": "^5.4.11",
27
+ "vite": "^6.3.5",
28
28
  "vitest": "^2.1.9",
29
- "@milaboratories/platforma-build-configs": "1.0.3",
30
- "@platforma-sdk/eslint-config": "1.0.3"
29
+ "@platforma-sdk/eslint-config": "1.0.3",
30
+ "@milaboratories/platforma-build-configs": "1.0.3"
31
31
  },
32
32
  "scripts": {
33
33
  "type-check": "tsc --noEmit --composite false",
@@ -1,4 +1,5 @@
1
1
  import type { Branded } from '../branding';
2
+ import { z } from 'zod';
2
3
 
3
4
  /** Handle of locally downloaded blob. This handle is issued only after the
4
5
  * blob's content is downloaded locally, and ready for quick access. */
@@ -22,13 +23,14 @@ export interface BlobHandleAndSize<
22
23
  }
23
24
 
24
25
  /** Range in bytes, from should be less or equal than to. */
25
- export type RangeBytes = {
26
+ export const RangeBytes = z.object({
26
27
  /** Included left border. */
27
- from: number;
28
-
28
+ from: z.number(),
29
29
  /** Excluded right border. */
30
- to: number;
31
- };
30
+ to: z.number(),
31
+ });
32
+
33
+ export type RangeBytes = z.infer<typeof RangeBytes>;
32
34
 
33
35
  export function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {
34
36
  if (from == undefined || to == undefined) {
@@ -186,7 +186,11 @@ export type AxesId = AxisId[];
186
186
  /** Extracts axis ids from axis spec */
187
187
  export function getAxisId(spec: AxisSpec): AxisId {
188
188
  const { type, name, domain } = spec;
189
- return { type, name, ...(domain && { domain }) };
189
+ const result = { type, name };
190
+ if (domain && Object.entries(domain).length > 0) {
191
+ Object.assign(result, { domain });
192
+ }
193
+ return result;
190
194
  }
191
195
 
192
196
  /** Extracts axes ids from axes spec array from column spec */
@@ -194,7 +198,10 @@ export function getAxesId(spec: AxesSpec): AxesId {
194
198
  return spec.map(getAxisId);
195
199
  }
196
200
 
197
- /** Canonicalizes axis id */
201
+ /**
202
+ * Canonicalizes axis id
203
+ * @deprecated Use {@link canonicalizeJson} instead to preserve type
204
+ */
198
205
  export function canonicalizeAxisId(id: AxisId): string {
199
206
  return canonicalize(getAxisId(id))!;
200
207
  }