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

71 lines
2.1 KiB
JSON

{
"name": "@webstudio-is/react-sdk",
"version": "0.0.0-webstudio-version",
"description": "Webstudio JavaScript / TypeScript API",
"author": "Webstudio <github@webstudio.is>",
"homepage": "https://webstudio.is",
"type": "module",
"scripts": {
"build": "rm -rf lib && esbuild src/index.ts src/runtime.ts src/standard-attributes.ts --outdir=lib --bundle --format=esm --packages=external",
"dts": "tsc --project tsconfig.dts.json",
"typecheck": "tsc --noEmit",
"test": "vitest run"
},
"devDependencies": {
"@types/react": "^18.2.70",
"@types/react-dom": "^18.2.25",
"@webstudio-is/template": "workspace:*",
"@webstudio-is/tsconfig": "workspace:*",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"strip-indent": "^4.0.0",
"type-fest": "^4.37.0",
"typescript": "7.0.2",
"vitest": "^3.1.2",
"zod": "^4.4.3"
},
"peerDependencies": {
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"zod": "^4.4.3"
},
"dependencies": {
"@webstudio-is/content-engine": "workspace:*",
"@webstudio-is/css-engine": "workspace:*",
"@webstudio-is/expression": "workspace:*",
"@webstudio-is/fonts": "workspace:*",
"@webstudio-is/icons": "workspace:^",
"@webstudio-is/image": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
"change-case": "^5.4.4"
},
"exports": {
".": {
"webstudio": "./src/index.ts",
"types": "./lib/types/index.d.ts",
"import": "./lib/index.js"
},
"./runtime": {
"webstudio": "./src/runtime.ts",
"types": "./lib/types/runtime.d.ts",
"import": "./lib/runtime.js"
},
"./standard-attributes": {
"webstudio": "./src/standard-attributes.ts",
"types": "./lib/types/standard-attributes.d.ts",
"import": "./lib/standard-attributes.js"
},
"./placeholder": {
"types": "./placeholder.d.ts"
}
},
"files": [
"lib/*",
"./placeholder.d.ts",
"!*.{test,stories}.*"
],
"license": "AGPL-3.0-or-later",
"private": false,
"sideEffects": false
}