@platforma-open/milaboratories.repertoire-diversity-2.model 1.5.4 → 1.5.6

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,39 +1,39 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.repertoire-diversity-2.model",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
- "main": "dist/index.cjs",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/index.d.ts",
14
+ "sources": "./src/index.ts"
15
+ },
16
+ "./dist/model.json": "./dist/model.json"
17
+ },
9
18
  "dependencies": {
10
- "@platforma-sdk/model": "^1.45.0",
11
- "@milaboratories/graph-maker": "^1.1.175"
19
+ "@platforma-sdk/model": "1.51.2",
20
+ "@milaboratories/graph-maker": "1.1.202"
12
21
  },
13
22
  "devDependencies": {
14
- "@platforma-sdk/block-tools": "^2.6.25",
15
- "typescript": "~5.5.4",
16
- "vite": "^6.2.2",
17
- "tsup": "~8.3.5",
18
- "@platforma-sdk/eslint-config": "^1.1.0"
19
- },
20
- "tsup": {
21
- "entry": [
22
- "src/index.ts"
23
- ],
24
- "splitting": false,
25
- "treeshake": true,
26
- "clean": true,
27
- "format": [
28
- "cjs",
29
- "esm"
30
- ],
31
- "dts": true,
32
- "minify": false,
33
- "sourcemap": true
23
+ "@milaboratories/ts-builder": "1.2.1",
24
+ "@milaboratories/ts-configs": "1.2.0",
25
+ "@platforma-sdk/block-tools": "2.6.29",
26
+ "@platforma-sdk/eslint-config": "1.2.0",
27
+ "@platforma-sdk/test": "1.51.3",
28
+ "typescript": "~5.6.3",
29
+ "vitest": "^4.0.7",
30
+ "eslint": "^9.25.1"
34
31
  },
35
32
  "scripts": {
36
- "build": "tsup && vite build && block-tools build-model",
37
- "lint": "eslint ."
33
+ "build": "ts-builder build --target block-model && block-tools build-model",
34
+ "watch": "ts-builder build --target block-model --watch",
35
+ "type-check": "ts-builder types --target block-model",
36
+ "lint": "eslint .",
37
+ "test": "vitest"
38
38
  }
39
39
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { GraphMakerState } from '@milaboratories/graph-maker';
2
- import type { InferOutputsType, PColumnIdAndSpec, PlDataTableStateV2, PlRef } from '@platforma-sdk/model';
2
+ import type { PColumnIdAndSpec, PlDataTableStateV2, PlRef } from '@platforma-sdk/model';
3
3
  import { BlockModel, createPFrameForGraphs, createPlDataTableStateV2, createPlDataTableV2 } from '@platforma-sdk/model';
4
4
 
5
5
  export * from './converters';
@@ -23,13 +23,14 @@ export type MetricUI = Metric & {
23
23
  };
24
24
 
25
25
  export type BlockArgs = {
26
+ defaultBlockLabel: string;
27
+ customBlockLabel: string;
26
28
  abundanceRef?: PlRef;
27
29
  metrics: Metric[];
28
30
  };
29
31
 
30
32
  export type UiState = {
31
33
  metrics: MetricUI[];
32
- blockTitle: string;
33
34
  tableState: PlDataTableStateV2;
34
35
  graphState: GraphMakerState;
35
36
  };
@@ -37,10 +38,11 @@ export type UiState = {
37
38
  export const model = BlockModel.create()
38
39
  .withArgs<BlockArgs>({
39
40
  metrics: [],
41
+ defaultBlockLabel: '',
42
+ customBlockLabel: '',
40
43
  })
41
44
 
42
45
  .withUiState<UiState>({
43
- blockTitle: 'Repertoire Diversity',
44
46
  graphState: {
45
47
  title: 'Repertoire Diversity',
46
48
  template: 'bar',
@@ -113,10 +115,10 @@ export const model = BlockModel.create()
113
115
  'pl7.app/abundance/isPrimary': 'true',
114
116
  },
115
117
  },
116
- ]),
118
+ ], { includeNativeLabel: true }),
117
119
  )
118
120
 
119
- .output('pt', (ctx) => {
121
+ .outputWithStatus('pt', (ctx) => {
120
122
  const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
121
123
  if (pCols === undefined) {
122
124
  return undefined;
@@ -125,7 +127,7 @@ export const model = BlockModel.create()
125
127
  return createPlDataTableV2(ctx, pCols, ctx.uiState.tableState);
126
128
  })
127
129
 
128
- .output('pf', (ctx) => {
130
+ .outputWithStatus('pf', (ctx) => {
129
131
  const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
130
132
  if (pCols === undefined) {
131
133
  return undefined;
@@ -153,7 +155,9 @@ export const model = BlockModel.create()
153
155
 
154
156
  .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
155
157
 
156
- .title((ctx) => ctx.uiState?.blockTitle ?? 'Repertoire Diversity')
158
+ .title(() => 'Repertoire Diversity')
159
+
160
+ .subtitle((ctx) => ctx.args.customBlockLabel || ctx.args.defaultBlockLabel)
157
161
 
158
162
  .sections((_) => [
159
163
  { type: 'link', href: '/', label: 'Main' },
@@ -161,5 +165,3 @@ export const model = BlockModel.create()
161
165
  ])
162
166
 
163
167
  .done(2);
164
-
165
- export type BlockOutputs = InferOutputsType<typeof model>;
package/tsconfig.json CHANGED
@@ -1,16 +1,5 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "es2022",
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- "esModuleInterop": true,
7
- "strict": true,
8
- "outDir": "./dist",
9
- "rootDir": "./src",
10
- "sourceMap": true,
11
- "declaration": true
12
- },
13
- "types": [],
2
+ "extends": "@milaboratories/ts-configs/block/model",
14
3
  "include": ["src/**/*"],
15
4
  "exclude": ["node_modules", "dist"]
16
5
  }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node'
7
+ }
8
+ });
9
+
package/dist/index.d.cts DELETED
@@ -1,76 +0,0 @@
1
- import * as _platforma_sdk_model from '@platforma-sdk/model';
2
- import { PlRef, PlDataTableStateV2, InferOutputsType } from '@platforma-sdk/model';
3
- import { GraphMakerState } from '@milaboratories/graph-maker';
4
-
5
- declare const convertMetricsUiToArgs: (metrics: MetricUI[]) => Metric[];
6
-
7
- type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
8
- type Metric = {
9
- type: DiversityType | undefined;
10
- downsampling: {
11
- type?: 'none' | 'top' | 'cumtop' | 'hypergeometric';
12
- valueChooser?: 'min' | 'fixed' | 'max' | 'auto';
13
- n?: number;
14
- };
15
- };
16
- type MetricUI = Metric & {
17
- id: string;
18
- isExpanded?: boolean;
19
- };
20
- type BlockArgs = {
21
- abundanceRef?: PlRef;
22
- metrics: Metric[];
23
- };
24
- type UiState = {
25
- metrics: MetricUI[];
26
- blockTitle: string;
27
- tableState: PlDataTableStateV2;
28
- graphState: GraphMakerState;
29
- };
30
- declare const model: _platforma_sdk_model.PlatformaV2<BlockArgs, {
31
- abundanceOptions: _platforma_sdk_model.ValueOrErrors<{
32
- readonly ref: {
33
- readonly __isRef: true;
34
- readonly blockId: string;
35
- readonly name: string;
36
- readonly requireEnrichments?: true | undefined;
37
- };
38
- readonly label: string;
39
- }[]>;
40
- pt: _platforma_sdk_model.ValueOrErrors<{
41
- sourceId: string | null;
42
- fullTableHandle: _platforma_sdk_model.PTableHandle;
43
- visibleTableHandle: _platforma_sdk_model.PTableHandle;
44
- } | undefined>;
45
- pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
46
- pcols: _platforma_sdk_model.ValueOrErrors<{
47
- columnId: _platforma_sdk_model.PObjectId;
48
- spec: {
49
- readonly valueType: _platforma_sdk_model.ValueType;
50
- readonly kind: "PColumn";
51
- readonly name: string;
52
- readonly domain?: {
53
- [x: string]: string;
54
- } | undefined;
55
- readonly annotations?: {
56
- [x: string]: string;
57
- } | undefined;
58
- readonly parentAxes?: number[] | undefined;
59
- readonly axesSpec: {
60
- readonly type: _platforma_sdk_model.ValueType;
61
- readonly name: string;
62
- readonly domain?: {
63
- [x: string]: string;
64
- } | undefined;
65
- readonly annotations?: {
66
- [x: string]: string;
67
- } | undefined;
68
- readonly parentAxes?: number[] | undefined;
69
- }[];
70
- };
71
- }[] | undefined>;
72
- isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
73
- }, UiState, "/" | "/diversityGraph">;
74
- type BlockOutputs = InferOutputsType<typeof model>;
75
-
76
- export { type BlockArgs, type BlockOutputs, type DiversityType, type Metric, type MetricUI, type UiState, convertMetricsUiToArgs, model };
package/vite.config.mts DELETED
@@ -1,20 +0,0 @@
1
- import { defineConfig } from 'vite';
2
-
3
- export default defineConfig({
4
- build: {
5
- emptyOutDir: false,
6
- lib: {
7
- entry: 'src/index.ts',
8
- name: 'model',
9
- fileName: (format) => `my-lib.${format}.js`
10
- },
11
- minify: false,
12
- sourcemap: true,
13
- rollupOptions: {
14
- output: {
15
- format: 'iife',
16
- entryFileNames: 'bundle.js'
17
- }
18
- }
19
- }
20
- });