-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate table block to the structurer and BlockModelV3 #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bd6c24f
Migrate to block-tools structurer (automated refresh)
vadimpiven 7c0210f
Fix author-code for SDK 1.79 upgrade
vadimpiven 87ea4de
Add changeset for structurer migration
vadimpiven e85aefb
Migrate model to BlockModelV3 and createPlDataTableV3
vadimpiven d1fb84d
CI: enable test lane (test: true) with retry to absorb backend cold s…
vadimpiven 77b0f25
Migrate to new discovery API
mzueva 356486e
SDK upgrade
mzueva 6f35ee5
Changeset fix
mzueva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| "@platforma-open/milaboratories.table": patch | ||
| "@platforma-open/milaboratories.table.model": patch | ||
| "@platforma-open/milaboratories.table.ui": patch | ||
| "@platforma-open/milaboratories.table.workflow": patch | ||
| --- | ||
|
|
||
| Migrate to the block-tools structurer and to BlockModelV3. | ||
|
|
||
| - Adopt the tool-managed layout (oxlint/oxfmt, managed tsconfig/turbo/catalog) and | ||
| complete the SDK upgrade (model/ui-vue 1.79, workflow-tengo 6, tengo-builder 4). | ||
| - Migrate the model from the legacy V1 API to BlockModelV3 with a unified data | ||
| model; persisted state is carried over by a one-time legacy upgrader. All state | ||
| is UI-only (column selection + table grid state); args project to an empty object. | ||
| - Build the data table with createPlDataTableV3 (replacing createPlDataTableV2). | ||
| - UI bindings move from app.model.ui to app.model.data; the app uses defineAppV3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"version":2} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,3 @@ | ||
| { | ||
| "vitest.disableWorkspaceWarning": true, | ||
| "editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
| "[typescript]": { | ||
| "editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
| }, | ||
| "[vue]": { | ||
| "editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
| }, | ||
| "cSpell.words": [ | ||
| "datasource", | ||
| "pframe", | ||
| "prerun" | ||
| ], | ||
| "editor.codeActionsOnSave": { | ||
| "source.fixAll.eslint": "always" | ||
| }, | ||
| "eslint.enable": true, | ||
| "eslint.format.enable": true | ||
| "typescript.tsdk": "node_modules/typescript/lib" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // This file is managed by `block-tools structure`. Do not edit by hand. | ||
| // Narrow MCP / AI surface. | ||
|
|
||
| export type { BlockContract, BlockOutputs, BlockData } from "./index"; | ||
| export * from "./agents-extra"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Author-owned. `block-tools structure` does not modify this file. | ||
| // MCP / AI extension surface. Add types and functions the agent | ||
| // surface should expose. | ||
| // | ||
| // In the future this file will host JS functions the MCP runtime | ||
| // can execute. The `.d.ts` declarations stay visible to the agent; | ||
| // the JS bodies execute in the MCP code-execution context (the | ||
| // agent sees the types but not the implementation). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // Author-owned. `block-tools structure` does not modify this file. | ||
| // Add block-specific helper types or values the consumer surface | ||
| // should expose. Anything you `export` here flows out via the | ||
| // main entry (./index re-exports this file). | ||
| // | ||
| // Do NOT redefine: BlockContract, BlockOutputs, BlockData, | ||
| // BlockPointer, platforma, or the block-named <PascalName>Block* | ||
| // aliases — those names come from ./index and `export *` from this | ||
| // file would shadow them. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // This file is managed by `block-tools structure`. Do not edit by hand. | ||
| // Author content lives in ./block-extra.ts. | ||
|
|
||
| import { platforma } from "@platforma-open/milaboratories.table.model"; | ||
| import { | ||
| InferOutputsType, | ||
| InferDataType, | ||
| InferHrefType, | ||
| } from "@platforma-sdk/model"; | ||
|
|
||
| export { platforma }; | ||
|
|
||
| export type BlockContract = { | ||
| outputs: InferOutputsType<typeof platforma>; | ||
| data: InferDataType<typeof platforma>; | ||
| href: InferHrefType<typeof platforma>; | ||
| }; | ||
|
|
||
| export type BlockOutputs = BlockContract["outputs"]; | ||
| export type BlockData = BlockContract["data"]; | ||
|
|
||
| // import.meta.url is a file: URL (always forward-slash, even on Windows: | ||
| // file:///C:/…). We expose URLs, NOT paths — the facade stays dependency-free | ||
| // and loadable in minimal engines (e.g. QuickJS), and each consumer converts | ||
| // at its own edge with the right tool (fileURLToPath in Node), where Windows | ||
| // drive letters / %-encoding / UNC are handled correctly. The bundled entry | ||
| // sits one dir under the package root (dist/index.js, or src/index.ts in dev), | ||
| // so the root is two URL segments up. The structurer owns this layout — | ||
| // consumers read these URLs, they never reconstruct <root>/block-pack. | ||
| // | ||
| // TypeScript ships `ImportMeta.url` only in the `dom`/`webworker` libs; the | ||
| // facade tsconfig is lib-minimal (no `dom`, no `@types/node`) by design. We | ||
| // type the one ESM-standard member we use with a local cast rather than a | ||
| // `declare global` — a global augmentation would leak into the published | ||
| // `dist/index.d.ts` and clash with `@types/node`'s `ImportMeta` in full-Node | ||
| // consumers (test packages, the Middle Layer). | ||
| const selfUrl = (import.meta as ImportMeta & { url: string }).url; | ||
| const dirUrl = selfUrl.slice(0, selfUrl.lastIndexOf("/")); | ||
| const rootUrl = dirUrl.slice(0, dirUrl.lastIndexOf("/")); | ||
|
|
||
| export const BlockPointer = { | ||
| type: "from-pack-v2" as const, | ||
| packUrl: rootUrl + "/block-pack", | ||
| rootUrl, | ||
| } as const; | ||
|
|
||
| // Block-named aliases for readable cross-block imports in tests and | ||
| // consumer code. Same types / same runtime value as the universal | ||
| // names above; the aliases avoid `as`-renames at the import site. | ||
| export type TableBlockContract = BlockContract; | ||
| export type TableBlockOutputs = BlockOutputs; | ||
| export type TableBlockData = BlockData; | ||
| export const TableBlockPointer = BlockPointer; | ||
|
|
||
| export * from "./block-extra"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "extends": "@milaboratories/ts-configs/block/facade", | ||
| "include": ["src/**/*"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "extends": ["node_modules/@milaboratories/ts-builder/configs/oxfmt.json"], | ||
| "ignorePatterns": ["dist", "coverage", "CHANGELOG.md"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "extends": ["node_modules/@milaboratories/ts-builder/dist/configs/oxlint-block-model.json"] | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,39 @@ | ||
| { | ||
| "name": "@platforma-open/milaboratories.table.model", | ||
| "version": "1.1.2", | ||
| "private": true, | ||
| "description": "Block model", | ||
| "type": "module", | ||
| "main": "dist/index.cjs", | ||
| "module": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "sources": "./src/index.ts", | ||
| "import": "./dist/index.js" | ||
| }, | ||
| "./dist/*": "./dist/*" | ||
| }, | ||
| "scripts": { | ||
| "type-check": "ts-builder types --target block-model", | ||
| "build": "ts-builder build --target block-model && block-tools build-model", | ||
| "lint": "eslint ." | ||
| "fmt": "ts-builder format", | ||
| "watch": "ts-builder build --target block-model --watch", | ||
| "check": "ts-builder check --target block-model" | ||
| }, | ||
| "dependencies": { | ||
| "@milaboratories/helpers": "catalog:", | ||
| "@platforma-sdk/model": "catalog:" | ||
| }, | ||
| "devDependencies": { | ||
| "@milaboratories/ts-builder": "catalog:", | ||
| "@milaboratories/ts-configs": "catalog:", | ||
| "@platforma-sdk/block-tools": "catalog:", | ||
| "@platforma-sdk/eslint-config": "catalog:", | ||
| "@types/node": "catalog:", | ||
| "eslint": "catalog:", | ||
| "typescript": "catalog:" | ||
| "eslint": "catalog:" | ||
| }, | ||
| "peerDependencies": { | ||
| "@types/node": "*", | ||
| "typescript": "*" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { createPlDataTableStateV2, DataModelBuilder } from "@platforma-sdk/model"; | ||
| import type { BlockData, ColumnGroup, LegacyBlockArgs, LegacyUiState } from "./types"; | ||
|
|
||
| const emptyGroup = (): ColumnGroup => ({ | ||
| mainColumn: undefined, | ||
| additionalColumns: [], | ||
| enrichmentColumns: [], | ||
| }); | ||
|
|
||
| export const blockDataModel = new DataModelBuilder() | ||
| .from<BlockData>("v1") | ||
| // Legacy V1 stored everything under `uiState`; args was always empty. Pick the | ||
| // two fields we keep — obsolete keys (filtersOpen, filterModel, tableState, | ||
| // settingsOpened) are dropped here instead of by the old UI-side upgrader. | ||
| .upgradeLegacy<LegacyBlockArgs, LegacyUiState>(({ uiState }) => ({ | ||
| group: uiState?.group ?? emptyGroup(), | ||
| tableStateV2: uiState?.tableStateV2 ?? createPlDataTableStateV2(), | ||
| })) | ||
| .init(() => ({ | ||
| group: emptyGroup(), | ||
| tableStateV2: createPlDataTableStateV2(), | ||
| })); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.