|
| 1 | +// This file is managed by `block-tools structure`. Do not edit by hand. |
| 2 | +// Author content lives in ./block-extra.ts. |
| 3 | + |
| 4 | +import { platforma } from "@platforma-open/milaboratories.immune-assay-data.model"; |
| 5 | +import { |
| 6 | + InferOutputsType, |
| 7 | + InferDataType, |
| 8 | + InferHrefType, |
| 9 | +} from "@platforma-sdk/model"; |
| 10 | + |
| 11 | +export { platforma }; |
| 12 | + |
| 13 | +export type BlockContract = { |
| 14 | + outputs: InferOutputsType<typeof platforma>; |
| 15 | + data: InferDataType<typeof platforma>; |
| 16 | + href: InferHrefType<typeof platforma>; |
| 17 | +}; |
| 18 | + |
| 19 | +export type BlockOutputs = BlockContract["outputs"]; |
| 20 | +export type BlockData = BlockContract["data"]; |
| 21 | + |
| 22 | +// import.meta.url is a file: URL (always forward-slash, even on Windows: |
| 23 | +// file:///C:/…). We expose URLs, NOT paths — the facade stays dependency-free |
| 24 | +// and loadable in minimal engines (e.g. QuickJS), and each consumer converts |
| 25 | +// at its own edge with the right tool (fileURLToPath in Node), where Windows |
| 26 | +// drive letters / %-encoding / UNC are handled correctly. The bundled entry |
| 27 | +// sits one dir under the package root (dist/index.js, or src/index.ts in dev), |
| 28 | +// so the root is two URL segments up. The structurer owns this layout — |
| 29 | +// consumers read these URLs, they never reconstruct <root>/block-pack. |
| 30 | +// |
| 31 | +// TypeScript ships `ImportMeta.url` only in the `dom`/`webworker` libs; the |
| 32 | +// facade tsconfig is lib-minimal (no `dom`, no `@types/node`) by design. We |
| 33 | +// type the one ESM-standard member we use with a local cast rather than a |
| 34 | +// `declare global` — a global augmentation would leak into the published |
| 35 | +// `dist/index.d.ts` and clash with `@types/node`'s `ImportMeta` in full-Node |
| 36 | +// consumers (test packages, the Middle Layer). |
| 37 | +const selfUrl = (import.meta as ImportMeta & { url: string }).url; |
| 38 | +const dirUrl = selfUrl.slice(0, selfUrl.lastIndexOf("/")); |
| 39 | +const rootUrl = dirUrl.slice(0, dirUrl.lastIndexOf("/")); |
| 40 | + |
| 41 | +export const BlockPointer = { |
| 42 | + type: "from-pack-v2" as const, |
| 43 | + packUrl: rootUrl + "/block-pack", |
| 44 | + rootUrl, |
| 45 | +} as const; |
| 46 | + |
| 47 | +// Block-named aliases for readable cross-block imports in tests and |
| 48 | +// consumer code. Same types / same runtime value as the universal |
| 49 | +// names above; the aliases avoid `as`-renames at the import site. |
| 50 | +export type ImmuneAssayDataBlockContract = BlockContract; |
| 51 | +export type ImmuneAssayDataBlockOutputs = BlockOutputs; |
| 52 | +export type ImmuneAssayDataBlockData = BlockData; |
| 53 | +export const ImmuneAssayDataBlockPointer = BlockPointer; |
| 54 | + |
| 55 | +export * from "./block-extra"; |
0 commit comments