Files
Oleg Isonen b832a8e808 refactor: Centralize Builder ID generation (#6323)
## Outcome

Builder-owned code now routes standard ID generation through
`@webstudio-is/sdk/createId` while preserving existing NanoID and UUID
formats.

Closes #6322

## Technical choices

- Use `createId("nano")` for Builder records, assets, transaction IDs,
and other existing NanoID-backed values.
- Use `createId()` for UUID-backed database records and browser-side
client IDs.
- Keep `BuilderRuntimeContext.createId` as an injectable dependency.
Runtime operations, copy/paste, and deterministic tests rely on that
injection.
- Keep Node's `randomUUID` in CLI paths that explicitly support running
without the Web Crypto global.
- Keep specialized generators for custom-alphabet project domains and
actual hash generation.
- Remove direct `nanoid` dependencies from packages where no specialized
use remains.
- Do not migrate existing data or change database schemas.

## Todo

- [x] Migrate Builder app ID creation.
- [x] Migrate project runtime and template defaults.
- [x] Migrate asset, project, domain, and authorization-token IDs.
- [x] Preserve runtime ID injection.
- [x] Review remaining direct generators as explicit exceptions.
- [x] Add NanoID-format regression coverage for the default runtime
context.
- [x] Review documentation impact: no user-facing documentation changes
are needed.
- [x] Review fixture impact: no fixture input or generated output format
changes are needed.
- [x] Run targeted tests, typechecks, lint, and package-boundary checks.

## Verification

- Targeted Builder tests: 153 passed after preserving runtime-context
injection.
- Project-build runtime tests: 270 passed.
- Asset uploader tests: 61 passed.
- Authorization-token tests: 17 passed.
- Project tests: 52 passed.
- Domain tests: 18 passed.
- CLI tests: 32 passed.
- Typechecks passed for Builder, project-build, asset-uploader,
authorization-token, project, and domain.
- `pnpm lint` passed.
- `pnpm check:package-boundaries` passed.
- The runtime-context format test was demonstrated to fail with a UUID
default and pass with the NanoID default.
- Agent evaluations were not run because they require separate explicit
approval.
2026-09-03 15:56:23 +02:00

111 lines
3.4 KiB
JSON

{
"name": "@webstudio-is/project-build",
"version": "0.0.0",
"description": "Webstudio Project Build",
"author": "Webstudio <github@webstudio.is>",
"homepage": "https://webstudio.is",
"license": "AGPL-3.0-or-later",
"private": true,
"type": "module",
"exports": {
".": {
"webstudio": "./src/index.ts",
"partykit": "./src/index.ts"
},
"./contracts": {
"webstudio": "./src/contracts.ts",
"import": "./src/contracts.ts",
"default": "./src/contracts.ts"
},
"./runtime": {
"webstudio": "./src/runtime.ts",
"import": "./src/runtime.ts",
"default": "./src/runtime.ts"
},
"./transfer": {
"webstudio": "./src/transfer.ts",
"import": "./src/transfer.ts",
"default": "./src/transfer.ts"
},
"./transfer/server": {
"webstudio": "./src/transfer.server.ts"
},
"./state": {
"webstudio": "./src/state.ts",
"import": "./src/state.ts",
"default": "./src/state.ts"
},
"./project-session": {
"webstudio": "./src/project-session.ts",
"import": "./src/project-session.ts",
"default": "./src/project-session.ts"
},
"./mcp": {
"webstudio": "./src/mcp.ts"
},
"./preview": {
"webstudio": "./src/preview.ts"
},
"./persistence": {
"webstudio": "./src/persistence.ts",
"import": "./src/persistence.ts",
"default": "./src/persistence.ts"
},
"./server": {
"webstudio": "./src/server.ts"
}
},
"sideEffects": [
"./src/state/immer.ts"
],
"scripts": {
"generate-docs": "node scripts/generate-docs.mjs && oxfmt src/docs.generated.ts",
"generate-runtime-operation-contracts": "tsx --import ../../scripts/register-react-global.ts --conditions=webstudio scripts/generate-runtime-operation-contracts.ts && oxfmt src/contracts/__generated__/runtime-operation-contracts.ts",
"typecheck": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"@emotion/hash": "^0.9.2",
"@modelcontextprotocol/sdk": "^1.10.0",
"@webstudio-is/content-engine": "workspace:*",
"@webstudio-is/authorization-token": "workspace:*",
"@webstudio-is/css-data": "workspace:*",
"@webstudio-is/css-engine": "workspace:*",
"@webstudio-is/expression": "workspace:*",
"@webstudio-is/fonts": "workspace:*",
"@webstudio-is/html-data": "workspace:*",
"@webstudio-is/postgrest": "workspace:*",
"@webstudio-is/project": "workspace:*",
"@webstudio-is/project-migrations": "workspace:*",
"@webstudio-is/query-builder": "workspace:*",
"@webstudio-is/react-sdk": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
"@webstudio-is/sdk-components-registry": "workspace:*",
"@webstudio-is/template": "workspace:*",
"@webstudio-is/trpc-interface": "workspace:*",
"@webstudio-is/vision": "workspace:*",
"@webstudio-is/wsauth": "workspace:*",
"acorn": "^8.14.1",
"acorn-jsx": "^5.3.2",
"allof-merge": "^0.6.8",
"bcp-47": "^2.1.0",
"change-case": "^5.4.4",
"css-tree": "^3.2.1",
"esbuild": "^0.25.3",
"fast-deep-equal": "^3.1.3",
"fastest-levenshtein": "^1.0.16",
"immer": "^10.1.1",
"papaparse": "^5.5.3",
"slugify": "^1.6.6",
"title-case": "^4.3.2",
"urlpattern-polyfill": "^10.1.0",
"valid-filename": "^4.0.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@types/papaparse": "^5.5.2",
"@webstudio-is/tsconfig": "workspace:*",
"vitest": "^3.1.2"
}
}